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 LDKIOError LDKIOError_from_js(int32_t ord) {
197 case 0: return LDKIOError_NotFound;
198 case 1: return LDKIOError_PermissionDenied;
199 case 2: return LDKIOError_ConnectionRefused;
200 case 3: return LDKIOError_ConnectionReset;
201 case 4: return LDKIOError_ConnectionAborted;
202 case 5: return LDKIOError_NotConnected;
203 case 6: return LDKIOError_AddrInUse;
204 case 7: return LDKIOError_AddrNotAvailable;
205 case 8: return LDKIOError_BrokenPipe;
206 case 9: return LDKIOError_AlreadyExists;
207 case 10: return LDKIOError_WouldBlock;
208 case 11: return LDKIOError_InvalidInput;
209 case 12: return LDKIOError_InvalidData;
210 case 13: return LDKIOError_TimedOut;
211 case 14: return LDKIOError_WriteZero;
212 case 15: return LDKIOError_Interrupted;
213 case 16: return LDKIOError_Other;
214 case 17: return LDKIOError_UnexpectedEof;
218 static inline int32_t LDKIOError_to_js(LDKIOError val) {
220 case LDKIOError_NotFound: return 0;
221 case LDKIOError_PermissionDenied: return 1;
222 case LDKIOError_ConnectionRefused: return 2;
223 case LDKIOError_ConnectionReset: return 3;
224 case LDKIOError_ConnectionAborted: return 4;
225 case LDKIOError_NotConnected: return 5;
226 case LDKIOError_AddrInUse: return 6;
227 case LDKIOError_AddrNotAvailable: return 7;
228 case LDKIOError_BrokenPipe: return 8;
229 case LDKIOError_AlreadyExists: return 9;
230 case LDKIOError_WouldBlock: return 10;
231 case LDKIOError_InvalidInput: return 11;
232 case LDKIOError_InvalidData: return 12;
233 case LDKIOError_TimedOut: return 13;
234 case LDKIOError_WriteZero: return 14;
235 case LDKIOError_Interrupted: return 15;
236 case LDKIOError_Other: return 16;
237 case LDKIOError_UnexpectedEof: return 17;
241 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
243 case 0: return LDKLevel_Gossip;
244 case 1: return LDKLevel_Trace;
245 case 2: return LDKLevel_Debug;
246 case 3: return LDKLevel_Info;
247 case 4: return LDKLevel_Warn;
248 case 5: return LDKLevel_Error;
252 static inline int32_t LDKLevel_to_js(LDKLevel val) {
254 case LDKLevel_Gossip: return 0;
255 case LDKLevel_Trace: return 1;
256 case LDKLevel_Debug: return 2;
257 case LDKLevel_Info: return 3;
258 case LDKLevel_Warn: return 4;
259 case LDKLevel_Error: return 5;
263 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
265 case 0: return LDKNetwork_Bitcoin;
266 case 1: return LDKNetwork_Testnet;
267 case 2: return LDKNetwork_Regtest;
268 case 3: return LDKNetwork_Signet;
272 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
274 case LDKNetwork_Bitcoin: return 0;
275 case LDKNetwork_Testnet: return 1;
276 case LDKNetwork_Regtest: return 2;
277 case LDKNetwork_Signet: return 3;
281 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
283 case 0: return LDKRecipient_Node;
284 case 1: return LDKRecipient_PhantomNode;
288 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
290 case LDKRecipient_Node: return 0;
291 case LDKRecipient_PhantomNode: return 1;
295 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
297 case 0: return LDKSecp256k1Error_IncorrectSignature;
298 case 1: return LDKSecp256k1Error_InvalidMessage;
299 case 2: return LDKSecp256k1Error_InvalidPublicKey;
300 case 3: return LDKSecp256k1Error_InvalidSignature;
301 case 4: return LDKSecp256k1Error_InvalidSecretKey;
302 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
303 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
304 case 7: return LDKSecp256k1Error_InvalidTweak;
305 case 8: return LDKSecp256k1Error_NotEnoughMemory;
306 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
307 case 10: return LDKSecp256k1Error_InvalidParityValue;
311 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
313 case LDKSecp256k1Error_IncorrectSignature: return 0;
314 case LDKSecp256k1Error_InvalidMessage: return 1;
315 case LDKSecp256k1Error_InvalidPublicKey: return 2;
316 case LDKSecp256k1Error_InvalidSignature: return 3;
317 case LDKSecp256k1Error_InvalidSecretKey: return 4;
318 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
319 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
320 case LDKSecp256k1Error_InvalidTweak: return 7;
321 case LDKSecp256k1Error_NotEnoughMemory: return 8;
322 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
323 case LDKSecp256k1Error_InvalidParityValue: return 10;
327 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
329 case 0: return LDKSemanticError_NoPaymentHash;
330 case 1: return LDKSemanticError_MultiplePaymentHashes;
331 case 2: return LDKSemanticError_NoDescription;
332 case 3: return LDKSemanticError_MultipleDescriptions;
333 case 4: return LDKSemanticError_NoPaymentSecret;
334 case 5: return LDKSemanticError_MultiplePaymentSecrets;
335 case 6: return LDKSemanticError_InvalidFeatures;
336 case 7: return LDKSemanticError_InvalidRecoveryId;
337 case 8: return LDKSemanticError_InvalidSignature;
338 case 9: return LDKSemanticError_ImpreciseAmount;
342 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
344 case LDKSemanticError_NoPaymentHash: return 0;
345 case LDKSemanticError_MultiplePaymentHashes: return 1;
346 case LDKSemanticError_NoDescription: return 2;
347 case LDKSemanticError_MultipleDescriptions: return 3;
348 case LDKSemanticError_NoPaymentSecret: return 4;
349 case LDKSemanticError_MultiplePaymentSecrets: return 5;
350 case LDKSemanticError_InvalidFeatures: return 6;
351 case LDKSemanticError_InvalidRecoveryId: return 7;
352 case LDKSemanticError_InvalidSignature: return 8;
353 case LDKSemanticError_ImpreciseAmount: return 9;
357 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
359 case 0: return LDKSiPrefix_Milli;
360 case 1: return LDKSiPrefix_Micro;
361 case 2: return LDKSiPrefix_Nano;
362 case 3: return LDKSiPrefix_Pico;
366 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
368 case LDKSiPrefix_Milli: return 0;
369 case LDKSiPrefix_Micro: return 1;
370 case LDKSiPrefix_Nano: return 2;
371 case LDKSiPrefix_Pico: return 3;
375 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint32_t ptr) {
376 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
378 case LDKBech32Error_MissingSeparator: return 0;
379 case LDKBech32Error_InvalidChecksum: return 1;
380 case LDKBech32Error_InvalidLength: return 2;
381 case LDKBech32Error_InvalidChar: return 3;
382 case LDKBech32Error_InvalidData: return 4;
383 case LDKBech32Error_InvalidPadding: return 5;
384 case LDKBech32Error_MixedCase: return 6;
388 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint32_t ptr) {
389 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
390 assert(obj->tag == LDKBech32Error_InvalidChar);
391 int32_t invalid_char_conv = obj->invalid_char;
392 return invalid_char_conv;
394 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint32_t ptr) {
395 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
396 assert(obj->tag == LDKBech32Error_InvalidData);
397 int8_t invalid_data_conv = obj->invalid_data;
398 return invalid_data_conv;
400 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
401 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
402 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
405 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) {
406 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
407 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
408 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
409 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
410 CVec_u8Z_free(ret_var);
414 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) {
415 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
416 int64_t ret_conv = TxOut_get_value(thing_conv);
420 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
421 CHECK(owner->result_ok);
422 return *owner->contents.result;
424 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
425 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
426 CResult_NoneNoneZ_get_ok(owner_conv);
429 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
430 CHECK(!owner->result_ok);
431 return *owner->contents.err;
433 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
434 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
435 CResult_NoneNoneZ_get_err(owner_conv);
438 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
439 CHECK(owner->result_ok);
440 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
442 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint32_t owner) {
443 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
444 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
445 uint32_t ret_ref = 0;
446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
449 ret_ref = (uintptr_t)ret_var.inner;
450 if (ret_var.is_owned) {
456 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
457 CHECK(!owner->result_ok);
458 return DecodeError_clone(&*owner->contents.err);
460 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint32_t owner) {
461 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
462 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
463 uint32_t ret_ref = 0;
464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
467 ret_ref = (uintptr_t)ret_var.inner;
468 if (ret_var.is_owned) {
474 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
475 CHECK(owner->result_ok);
476 return *owner->contents.result;
478 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
479 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
480 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
481 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
485 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
486 CHECK(!owner->result_ok);
487 return *owner->contents.err;
489 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
490 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
491 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
495 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
496 CHECK(owner->result_ok);
497 return *owner->contents.result;
499 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
500 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
501 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
502 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
506 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
507 CHECK(!owner->result_ok);
508 return *owner->contents.err;
510 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
511 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
512 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
516 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
517 CHECK(owner->result_ok);
518 return TxCreationKeys_clone(&*owner->contents.result);
520 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
521 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
522 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
523 uint32_t ret_ref = 0;
524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
527 ret_ref = (uintptr_t)ret_var.inner;
528 if (ret_var.is_owned) {
534 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
535 CHECK(!owner->result_ok);
536 return DecodeError_clone(&*owner->contents.err);
538 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
539 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
540 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
541 uint32_t ret_ref = 0;
542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
545 ret_ref = (uintptr_t)ret_var.inner;
546 if (ret_var.is_owned) {
552 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
553 CHECK(owner->result_ok);
554 return ChannelPublicKeys_clone(&*owner->contents.result);
556 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
557 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
558 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
559 uint32_t ret_ref = 0;
560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
563 ret_ref = (uintptr_t)ret_var.inner;
564 if (ret_var.is_owned) {
570 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
571 CHECK(!owner->result_ok);
572 return DecodeError_clone(&*owner->contents.err);
574 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
575 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
576 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
577 uint32_t ret_ref = 0;
578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
581 ret_ref = (uintptr_t)ret_var.inner;
582 if (ret_var.is_owned) {
588 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
589 CHECK(owner->result_ok);
590 return TxCreationKeys_clone(&*owner->contents.result);
592 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
593 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
594 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
595 uint32_t ret_ref = 0;
596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
599 ret_ref = (uintptr_t)ret_var.inner;
600 if (ret_var.is_owned) {
606 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
607 CHECK(!owner->result_ok);
608 return *owner->contents.err;
610 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
611 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
612 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
616 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
617 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
619 case LDKCOption_u32Z_Some: return 0;
620 case LDKCOption_u32Z_None: return 1;
624 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
625 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
626 assert(obj->tag == LDKCOption_u32Z_Some);
627 int32_t some_conv = obj->some;
630 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
631 CHECK(owner->result_ok);
632 return HTLCOutputInCommitment_clone(&*owner->contents.result);
634 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
635 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
636 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
637 uint32_t ret_ref = 0;
638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
641 ret_ref = (uintptr_t)ret_var.inner;
642 if (ret_var.is_owned) {
648 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
649 CHECK(!owner->result_ok);
650 return DecodeError_clone(&*owner->contents.err);
652 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
653 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
654 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
655 uint32_t ret_ref = 0;
656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
659 ret_ref = (uintptr_t)ret_var.inner;
660 if (ret_var.is_owned) {
666 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
667 CHECK(owner->result_ok);
668 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
670 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
671 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
672 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
673 uint32_t ret_ref = 0;
674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
677 ret_ref = (uintptr_t)ret_var.inner;
678 if (ret_var.is_owned) {
684 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
685 CHECK(!owner->result_ok);
686 return DecodeError_clone(&*owner->contents.err);
688 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
689 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
690 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
691 uint32_t ret_ref = 0;
692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
695 ret_ref = (uintptr_t)ret_var.inner;
696 if (ret_var.is_owned) {
702 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
703 CHECK(owner->result_ok);
704 return ChannelTransactionParameters_clone(&*owner->contents.result);
706 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
707 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
708 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
709 uint32_t ret_ref = 0;
710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
713 ret_ref = (uintptr_t)ret_var.inner;
714 if (ret_var.is_owned) {
720 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
721 CHECK(!owner->result_ok);
722 return DecodeError_clone(&*owner->contents.err);
724 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
725 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
726 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
727 uint32_t ret_ref = 0;
728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
731 ret_ref = (uintptr_t)ret_var.inner;
732 if (ret_var.is_owned) {
738 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
739 CHECK(owner->result_ok);
740 return HolderCommitmentTransaction_clone(&*owner->contents.result);
742 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
743 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
744 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
745 uint32_t ret_ref = 0;
746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
749 ret_ref = (uintptr_t)ret_var.inner;
750 if (ret_var.is_owned) {
756 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
757 CHECK(!owner->result_ok);
758 return DecodeError_clone(&*owner->contents.err);
760 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
761 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
762 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
763 uint32_t ret_ref = 0;
764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
767 ret_ref = (uintptr_t)ret_var.inner;
768 if (ret_var.is_owned) {
774 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
775 CHECK(owner->result_ok);
776 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
778 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
779 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
780 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
781 uint32_t ret_ref = 0;
782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
785 ret_ref = (uintptr_t)ret_var.inner;
786 if (ret_var.is_owned) {
792 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
793 CHECK(!owner->result_ok);
794 return DecodeError_clone(&*owner->contents.err);
796 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
797 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
798 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
799 uint32_t ret_ref = 0;
800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
803 ret_ref = (uintptr_t)ret_var.inner;
804 if (ret_var.is_owned) {
810 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
811 CHECK(owner->result_ok);
812 return &*owner->contents.result;
814 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
815 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
816 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
817 uint32_t ret_ref = 0;
818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
821 ret_ref = (uintptr_t)ret_var.inner & ~1;
825 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
826 CHECK(!owner->result_ok);
827 return *owner->contents.err;
829 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
830 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
831 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
834 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
835 CHECK(owner->result_ok);
836 return CommitmentTransaction_clone(&*owner->contents.result);
838 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
839 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
840 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
841 uint32_t ret_ref = 0;
842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
845 ret_ref = (uintptr_t)ret_var.inner;
846 if (ret_var.is_owned) {
852 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
853 CHECK(!owner->result_ok);
854 return DecodeError_clone(&*owner->contents.err);
856 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
857 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
858 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
859 uint32_t ret_ref = 0;
860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
863 ret_ref = (uintptr_t)ret_var.inner;
864 if (ret_var.is_owned) {
870 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
871 CHECK(owner->result_ok);
872 return &*owner->contents.result;
874 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
875 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
876 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
877 uint32_t ret_ref = 0;
878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
881 ret_ref = (uintptr_t)ret_var.inner & ~1;
885 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
886 CHECK(!owner->result_ok);
887 return *owner->contents.err;
889 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
890 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
891 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
894 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
895 CHECK(owner->result_ok);
896 return *owner->contents.result;
898 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
899 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
900 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
901 ptrArray ret_arr = NULL;
902 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
903 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
904 for (size_t m = 0; m < ret_var.datalen; m++) {
905 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
906 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
907 ret_arr_ptr[m] = ret_conv_12_arr;
913 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
914 CHECK(!owner->result_ok);
915 return *owner->contents.err;
917 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
918 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
919 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
922 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
923 CHECK(owner->result_ok);
924 return ShutdownScript_clone(&*owner->contents.result);
926 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
927 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
928 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
929 uint32_t ret_ref = 0;
930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
933 ret_ref = (uintptr_t)ret_var.inner;
934 if (ret_var.is_owned) {
940 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
941 CHECK(!owner->result_ok);
942 return DecodeError_clone(&*owner->contents.err);
944 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
945 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
946 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
947 uint32_t ret_ref = 0;
948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
951 ret_ref = (uintptr_t)ret_var.inner;
952 if (ret_var.is_owned) {
958 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
959 CHECK(owner->result_ok);
960 return ShutdownScript_clone(&*owner->contents.result);
962 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
963 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
964 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
965 uint32_t ret_ref = 0;
966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
969 ret_ref = (uintptr_t)ret_var.inner;
970 if (ret_var.is_owned) {
976 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
977 CHECK(!owner->result_ok);
978 return InvalidShutdownScript_clone(&*owner->contents.err);
980 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
981 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
982 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
983 uint32_t ret_ref = 0;
984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
987 ret_ref = (uintptr_t)ret_var.inner;
988 if (ret_var.is_owned) {
994 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
995 CHECK(owner->result_ok);
996 return RouteHop_clone(&*owner->contents.result);
998 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
999 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1000 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1001 uint32_t ret_ref = 0;
1002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1005 ret_ref = (uintptr_t)ret_var.inner;
1006 if (ret_var.is_owned) {
1012 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1013 CHECK(!owner->result_ok);
1014 return DecodeError_clone(&*owner->contents.err);
1016 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
1017 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1018 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1019 uint32_t ret_ref = 0;
1020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1023 ret_ref = (uintptr_t)ret_var.inner;
1024 if (ret_var.is_owned) {
1030 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1031 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1032 for (size_t i = 0; i < ret.datalen; i++) {
1033 ret.data[i] = RouteHop_clone(&orig->data[i]);
1037 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1038 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1039 for (size_t i = 0; i < ret.datalen; i++) {
1040 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1044 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1045 CHECK(owner->result_ok);
1046 return Route_clone(&*owner->contents.result);
1048 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
1049 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1050 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1051 uint32_t ret_ref = 0;
1052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1055 ret_ref = (uintptr_t)ret_var.inner;
1056 if (ret_var.is_owned) {
1062 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1063 CHECK(!owner->result_ok);
1064 return DecodeError_clone(&*owner->contents.err);
1066 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
1067 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1068 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1069 uint32_t ret_ref = 0;
1070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1073 ret_ref = (uintptr_t)ret_var.inner;
1074 if (ret_var.is_owned) {
1080 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1081 CHECK(owner->result_ok);
1082 return RouteParameters_clone(&*owner->contents.result);
1084 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
1085 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1086 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1087 uint32_t ret_ref = 0;
1088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1091 ret_ref = (uintptr_t)ret_var.inner;
1092 if (ret_var.is_owned) {
1098 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1099 CHECK(!owner->result_ok);
1100 return DecodeError_clone(&*owner->contents.err);
1102 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
1103 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1104 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1105 uint32_t ret_ref = 0;
1106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1109 ret_ref = (uintptr_t)ret_var.inner;
1110 if (ret_var.is_owned) {
1116 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1117 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1118 for (size_t i = 0; i < ret.datalen; i++) {
1119 ret.data[i] = RouteHint_clone(&orig->data[i]);
1123 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1124 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1126 case LDKCOption_u64Z_Some: return 0;
1127 case LDKCOption_u64Z_None: return 1;
1131 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1132 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1133 assert(obj->tag == LDKCOption_u64Z_Some);
1134 int64_t some_conv = obj->some;
1137 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1138 CHECK(owner->result_ok);
1139 return PaymentParameters_clone(&*owner->contents.result);
1141 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint32_t owner) {
1142 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1143 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1144 uint32_t ret_ref = 0;
1145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1148 ret_ref = (uintptr_t)ret_var.inner;
1149 if (ret_var.is_owned) {
1155 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1156 CHECK(!owner->result_ok);
1157 return DecodeError_clone(&*owner->contents.err);
1159 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint32_t owner) {
1160 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1161 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1162 uint32_t ret_ref = 0;
1163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1166 ret_ref = (uintptr_t)ret_var.inner;
1167 if (ret_var.is_owned) {
1173 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1174 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1175 for (size_t i = 0; i < ret.datalen; i++) {
1176 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1180 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1181 CHECK(owner->result_ok);
1182 return RouteHint_clone(&*owner->contents.result);
1184 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
1185 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1186 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1187 uint32_t ret_ref = 0;
1188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1191 ret_ref = (uintptr_t)ret_var.inner;
1192 if (ret_var.is_owned) {
1198 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1199 CHECK(!owner->result_ok);
1200 return DecodeError_clone(&*owner->contents.err);
1202 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
1203 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1204 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1205 uint32_t ret_ref = 0;
1206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1209 ret_ref = (uintptr_t)ret_var.inner;
1210 if (ret_var.is_owned) {
1216 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1217 CHECK(owner->result_ok);
1218 return RouteHintHop_clone(&*owner->contents.result);
1220 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
1221 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1222 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1223 uint32_t ret_ref = 0;
1224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1227 ret_ref = (uintptr_t)ret_var.inner;
1228 if (ret_var.is_owned) {
1234 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1235 CHECK(!owner->result_ok);
1236 return DecodeError_clone(&*owner->contents.err);
1238 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
1239 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1240 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1241 uint32_t ret_ref = 0;
1242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1245 ret_ref = (uintptr_t)ret_var.inner;
1246 if (ret_var.is_owned) {
1252 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1253 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1254 for (size_t i = 0; i < ret.datalen; i++) {
1255 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1259 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1260 CHECK(owner->result_ok);
1261 return Route_clone(&*owner->contents.result);
1263 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
1264 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1265 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1266 uint32_t ret_ref = 0;
1267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1270 ret_ref = (uintptr_t)ret_var.inner;
1271 if (ret_var.is_owned) {
1277 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1278 CHECK(!owner->result_ok);
1279 return LightningError_clone(&*owner->contents.err);
1281 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
1282 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1283 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1284 uint32_t ret_ref = 0;
1285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1288 ret_ref = (uintptr_t)ret_var.inner;
1289 if (ret_var.is_owned) {
1295 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1296 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1298 case LDKPaymentPurpose_InvoicePayment: return 0;
1299 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1303 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1304 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1305 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1306 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1307 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1308 return payment_preimage_arr;
1310 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1311 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1312 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1313 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1314 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1315 return payment_secret_arr;
1317 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1318 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1319 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1320 int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1321 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1322 return spontaneous_payment_arr;
1324 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1325 CHECK(owner->result_ok);
1326 return PaymentPurpose_clone(&*owner->contents.result);
1328 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint32_t owner) {
1329 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1330 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1331 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1332 uint32_t ret_ref = (uintptr_t)ret_copy;
1336 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1337 CHECK(!owner->result_ok);
1338 return DecodeError_clone(&*owner->contents.err);
1340 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint32_t owner) {
1341 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1342 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1343 uint32_t ret_ref = 0;
1344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1347 ret_ref = (uintptr_t)ret_var.inner;
1348 if (ret_var.is_owned) {
1354 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1355 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1357 case LDKClosureReason_CounterpartyForceClosed: return 0;
1358 case LDKClosureReason_HolderForceClosed: return 1;
1359 case LDKClosureReason_CooperativeClosure: return 2;
1360 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1361 case LDKClosureReason_FundingTimedOut: return 4;
1362 case LDKClosureReason_ProcessingError: return 5;
1363 case LDKClosureReason_DisconnectedPeer: return 6;
1364 case LDKClosureReason_OutdatedChannelManager: return 7;
1368 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1369 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1370 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1371 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1372 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1373 return peer_msg_conv;
1375 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1376 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1377 assert(obj->tag == LDKClosureReason_ProcessingError);
1378 LDKStr err_str = obj->processing_error.err;
1379 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1382 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
1383 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1385 case LDKCOption_ClosureReasonZ_Some: return 0;
1386 case LDKCOption_ClosureReasonZ_None: return 1;
1390 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
1391 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1392 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1393 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1396 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1397 CHECK(owner->result_ok);
1398 return COption_ClosureReasonZ_clone(&*owner->contents.result);
1400 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
1401 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1402 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1403 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1404 uint32_t ret_ref = (uintptr_t)ret_copy;
1408 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1409 CHECK(!owner->result_ok);
1410 return DecodeError_clone(&*owner->contents.err);
1412 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
1413 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1414 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1415 uint32_t ret_ref = 0;
1416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1419 ret_ref = (uintptr_t)ret_var.inner;
1420 if (ret_var.is_owned) {
1426 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1427 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1429 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1430 case LDKNetworkUpdate_ChannelFailure: return 1;
1431 case LDKNetworkUpdate_NodeFailure: return 2;
1435 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1436 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1437 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1438 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1439 uint32_t msg_ref = 0;
1440 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1441 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1442 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1443 msg_ref = (uintptr_t)msg_var.inner & ~1;
1446 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint32_t ptr) {
1447 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1448 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1449 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1450 return short_channel_id_conv;
1452 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint32_t ptr) {
1453 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1454 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1455 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1456 return is_permanent_conv;
1458 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1459 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1460 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1461 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1462 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1465 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1466 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1467 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1468 jboolean is_permanent_conv = obj->node_failure.is_permanent;
1469 return is_permanent_conv;
1471 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1472 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1474 case LDKCOption_NetworkUpdateZ_Some: return 0;
1475 case LDKCOption_NetworkUpdateZ_None: return 1;
1479 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1480 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1481 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1482 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1485 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1486 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1488 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1489 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1490 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1494 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1495 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1496 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1497 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1498 uint32_t outpoint_ref = 0;
1499 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1500 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1501 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1502 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
1503 return outpoint_ref;
1505 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1506 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1507 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1508 uint32_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1509 return (uint32_t)output_ref;
1511 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1512 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1513 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1514 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1515 uint32_t delayed_payment_output_ref = 0;
1516 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1517 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1518 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1519 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
1520 return delayed_payment_output_ref;
1522 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1523 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1524 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1525 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1526 uint32_t static_payment_output_ref = 0;
1527 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1528 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1529 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1530 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
1531 return static_payment_output_ref;
1533 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1534 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1535 for (size_t i = 0; i < ret.datalen; i++) {
1536 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1540 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1541 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1543 case LDKEvent_FundingGenerationReady: return 0;
1544 case LDKEvent_PaymentReceived: return 1;
1545 case LDKEvent_PaymentClaimed: return 2;
1546 case LDKEvent_PaymentSent: return 3;
1547 case LDKEvent_PaymentFailed: return 4;
1548 case LDKEvent_PaymentPathSuccessful: return 5;
1549 case LDKEvent_PaymentPathFailed: return 6;
1550 case LDKEvent_PendingHTLCsForwardable: return 7;
1551 case LDKEvent_SpendableOutputs: return 8;
1552 case LDKEvent_PaymentForwarded: return 9;
1553 case LDKEvent_ChannelClosed: return 10;
1554 case LDKEvent_DiscardFunding: return 11;
1555 case LDKEvent_OpenChannelRequest: return 12;
1559 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1560 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1561 assert(obj->tag == LDKEvent_FundingGenerationReady);
1562 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1563 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1564 return temporary_channel_id_arr;
1566 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint32_t ptr) {
1567 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1568 assert(obj->tag == LDKEvent_FundingGenerationReady);
1569 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1570 memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1571 return counterparty_node_id_arr;
1573 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1574 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1575 assert(obj->tag == LDKEvent_FundingGenerationReady);
1576 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1577 return channel_value_satoshis_conv;
1579 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1580 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1581 assert(obj->tag == LDKEvent_FundingGenerationReady);
1582 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1583 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1584 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1585 return output_script_arr;
1587 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1588 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1589 assert(obj->tag == LDKEvent_FundingGenerationReady);
1590 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1591 return user_channel_id_conv;
1593 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1594 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1595 assert(obj->tag == LDKEvent_PaymentReceived);
1596 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1597 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1598 return payment_hash_arr;
1600 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint32_t ptr) {
1601 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1602 assert(obj->tag == LDKEvent_PaymentReceived);
1603 int64_t amount_msat_conv = obj->payment_received.amount_msat;
1604 return amount_msat_conv;
1606 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1607 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1608 assert(obj->tag == LDKEvent_PaymentReceived);
1609 uint32_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
1612 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint32_t ptr) {
1613 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1614 assert(obj->tag == LDKEvent_PaymentClaimed);
1615 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1616 memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1617 return payment_hash_arr;
1619 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint32_t ptr) {
1620 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1621 assert(obj->tag == LDKEvent_PaymentClaimed);
1622 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1623 return amount_msat_conv;
1625 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint32_t ptr) {
1626 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1627 assert(obj->tag == LDKEvent_PaymentClaimed);
1628 uint32_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
1631 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1632 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1633 assert(obj->tag == LDKEvent_PaymentSent);
1634 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1635 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1636 return payment_id_arr;
1638 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1639 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1640 assert(obj->tag == LDKEvent_PaymentSent);
1641 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1642 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1643 return payment_preimage_arr;
1645 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1646 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1647 assert(obj->tag == LDKEvent_PaymentSent);
1648 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1649 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1650 return payment_hash_arr;
1652 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1653 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1654 assert(obj->tag == LDKEvent_PaymentSent);
1655 uint32_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
1656 return fee_paid_msat_ref;
1658 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1659 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1660 assert(obj->tag == LDKEvent_PaymentFailed);
1661 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1662 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1663 return payment_id_arr;
1665 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1666 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1667 assert(obj->tag == LDKEvent_PaymentFailed);
1668 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1669 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1670 return payment_hash_arr;
1672 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1673 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1674 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1675 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1676 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1677 return payment_id_arr;
1679 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1680 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1681 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1682 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1683 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1684 return payment_hash_arr;
1686 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1687 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1688 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1689 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1690 uint32_tArray path_arr = NULL;
1691 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1692 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1693 for (size_t k = 0; k < path_var.datalen; k++) {
1694 LDKRouteHop path_conv_10_var = path_var.data[k];
1695 uint32_t path_conv_10_ref = 0;
1696 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1697 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1698 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1699 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1700 path_arr_ptr[k] = path_conv_10_ref;
1705 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1706 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1707 assert(obj->tag == LDKEvent_PaymentPathFailed);
1708 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1709 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1710 return payment_id_arr;
1712 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1713 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1714 assert(obj->tag == LDKEvent_PaymentPathFailed);
1715 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1716 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1717 return payment_hash_arr;
1719 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1720 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1721 assert(obj->tag == LDKEvent_PaymentPathFailed);
1722 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1723 return rejected_by_dest_conv;
1725 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1726 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1727 assert(obj->tag == LDKEvent_PaymentPathFailed);
1728 uint32_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
1729 return network_update_ref;
1731 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1732 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1733 assert(obj->tag == LDKEvent_PaymentPathFailed);
1734 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1735 return all_paths_failed_conv;
1737 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1738 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1739 assert(obj->tag == LDKEvent_PaymentPathFailed);
1740 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1741 uint32_tArray path_arr = NULL;
1742 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1743 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1744 for (size_t k = 0; k < path_var.datalen; k++) {
1745 LDKRouteHop path_conv_10_var = path_var.data[k];
1746 uint32_t path_conv_10_ref = 0;
1747 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1748 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1749 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1750 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1751 path_arr_ptr[k] = path_conv_10_ref;
1756 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1757 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1758 assert(obj->tag == LDKEvent_PaymentPathFailed);
1759 uint32_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
1760 return short_channel_id_ref;
1762 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1763 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1764 assert(obj->tag == LDKEvent_PaymentPathFailed);
1765 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1766 uint32_t retry_ref = 0;
1767 if ((uintptr_t)retry_var.inner > 4096) {
1768 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1771 retry_ref = (uintptr_t)retry_var.inner & ~1;
1775 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1776 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1777 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1778 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1779 return time_forwardable_conv;
1781 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1782 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1783 assert(obj->tag == LDKEvent_SpendableOutputs);
1784 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1785 uint32_tArray outputs_arr = NULL;
1786 outputs_arr = init_uint32_tArray(outputs_var.datalen, __LINE__);
1787 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1788 for (size_t b = 0; b < outputs_var.datalen; b++) {
1789 uint32_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
1790 outputs_arr_ptr[b] = outputs_conv_27_ref;
1795 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint32_t ptr) {
1796 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1797 assert(obj->tag == LDKEvent_PaymentForwarded);
1798 int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1799 memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1800 return prev_channel_id_arr;
1802 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint32_t ptr) {
1803 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1804 assert(obj->tag == LDKEvent_PaymentForwarded);
1805 int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1806 memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1807 return next_channel_id_arr;
1809 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1810 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1811 assert(obj->tag == LDKEvent_PaymentForwarded);
1812 uint32_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1813 return fee_earned_msat_ref;
1815 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1816 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1817 assert(obj->tag == LDKEvent_PaymentForwarded);
1818 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1819 return claim_from_onchain_tx_conv;
1821 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1822 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1823 assert(obj->tag == LDKEvent_ChannelClosed);
1824 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1825 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1826 return channel_id_arr;
1828 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1829 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1830 assert(obj->tag == LDKEvent_ChannelClosed);
1831 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1832 return user_channel_id_conv;
1834 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1835 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1836 assert(obj->tag == LDKEvent_ChannelClosed);
1837 uint32_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
1840 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1841 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1842 assert(obj->tag == LDKEvent_DiscardFunding);
1843 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1844 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1845 return channel_id_arr;
1847 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1848 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1849 assert(obj->tag == LDKEvent_DiscardFunding);
1850 LDKTransaction transaction_var = obj->discard_funding.transaction;
1851 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1852 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1853 return transaction_arr;
1855 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint32_t ptr) {
1856 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1857 assert(obj->tag == LDKEvent_OpenChannelRequest);
1858 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1859 memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1860 return temporary_channel_id_arr;
1862 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint32_t ptr) {
1863 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1864 assert(obj->tag == LDKEvent_OpenChannelRequest);
1865 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1866 memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1867 return counterparty_node_id_arr;
1869 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint32_t ptr) {
1870 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1871 assert(obj->tag == LDKEvent_OpenChannelRequest);
1872 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1873 return funding_satoshis_conv;
1875 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint32_t ptr) {
1876 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1877 assert(obj->tag == LDKEvent_OpenChannelRequest);
1878 int64_t push_msat_conv = obj->open_channel_request.push_msat;
1879 return push_msat_conv;
1881 uint32_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint32_t ptr) {
1882 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1883 assert(obj->tag == LDKEvent_OpenChannelRequest);
1884 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1885 uint32_t channel_type_ref = 0;
1886 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1889 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
1890 return channel_type_ref;
1892 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
1893 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1895 case LDKCOption_EventZ_Some: return 0;
1896 case LDKCOption_EventZ_None: return 1;
1900 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
1901 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1902 assert(obj->tag == LDKCOption_EventZ_Some);
1903 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1906 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1907 CHECK(owner->result_ok);
1908 return COption_EventZ_clone(&*owner->contents.result);
1910 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
1911 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1912 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1913 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1914 uint32_t ret_ref = (uintptr_t)ret_copy;
1918 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1919 CHECK(!owner->result_ok);
1920 return DecodeError_clone(&*owner->contents.err);
1922 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
1923 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1924 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1925 uint32_t ret_ref = 0;
1926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1929 ret_ref = (uintptr_t)ret_var.inner;
1930 if (ret_var.is_owned) {
1936 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
1937 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1939 case LDKErrorAction_DisconnectPeer: return 0;
1940 case LDKErrorAction_IgnoreError: return 1;
1941 case LDKErrorAction_IgnoreAndLog: return 2;
1942 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1943 case LDKErrorAction_SendErrorMessage: return 4;
1944 case LDKErrorAction_SendWarningMessage: return 5;
1948 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
1949 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1950 assert(obj->tag == LDKErrorAction_DisconnectPeer);
1951 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1952 uint32_t msg_ref = 0;
1953 if ((uintptr_t)msg_var.inner > 4096) {
1954 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1957 msg_ref = (uintptr_t)msg_var.inner & ~1;
1961 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
1962 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1963 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
1964 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1965 return ignore_and_log_conv;
1967 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
1968 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1969 assert(obj->tag == LDKErrorAction_SendErrorMessage);
1970 LDKErrorMessage msg_var = obj->send_error_message.msg;
1971 uint32_t msg_ref = 0;
1972 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1975 msg_ref = (uintptr_t)msg_var.inner & ~1;
1978 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint32_t ptr) {
1979 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1980 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1981 LDKWarningMessage msg_var = obj->send_warning_message.msg;
1982 uint32_t msg_ref = 0;
1983 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1984 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1985 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1986 msg_ref = (uintptr_t)msg_var.inner & ~1;
1989 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint32_t ptr) {
1990 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1991 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1992 uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
1993 return log_level_conv;
1995 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
1996 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1998 case LDKMessageSendEvent_SendAcceptChannel: return 0;
1999 case LDKMessageSendEvent_SendOpenChannel: return 1;
2000 case LDKMessageSendEvent_SendFundingCreated: return 2;
2001 case LDKMessageSendEvent_SendFundingSigned: return 3;
2002 case LDKMessageSendEvent_SendChannelReady: return 4;
2003 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2004 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2005 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2006 case LDKMessageSendEvent_SendClosingSigned: return 8;
2007 case LDKMessageSendEvent_SendShutdown: return 9;
2008 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2009 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2010 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2011 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2012 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2013 case LDKMessageSendEvent_HandleError: return 15;
2014 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2015 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2016 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2017 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2021 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2022 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2023 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2024 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2025 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2028 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2029 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2030 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2031 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2032 uint32_t msg_ref = 0;
2033 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2036 msg_ref = (uintptr_t)msg_var.inner & ~1;
2039 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2040 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2041 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2042 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2043 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2046 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2047 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2048 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2049 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2050 uint32_t msg_ref = 0;
2051 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2052 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2054 msg_ref = (uintptr_t)msg_var.inner & ~1;
2057 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2058 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2059 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2060 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2061 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2064 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2065 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2066 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2067 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2068 uint32_t msg_ref = 0;
2069 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2070 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2072 msg_ref = (uintptr_t)msg_var.inner & ~1;
2075 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2076 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2077 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2078 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2079 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2082 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2083 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2084 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2085 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2086 uint32_t msg_ref = 0;
2087 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2088 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2090 msg_ref = (uintptr_t)msg_var.inner & ~1;
2093 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint32_t ptr) {
2094 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2095 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2096 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2097 memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2100 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint32_t ptr) {
2101 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2102 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2103 LDKChannelReady msg_var = obj->send_channel_ready.msg;
2104 uint32_t msg_ref = 0;
2105 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2106 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2107 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2108 msg_ref = (uintptr_t)msg_var.inner & ~1;
2111 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2112 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2113 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2114 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2115 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2118 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2119 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2120 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2121 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2122 uint32_t msg_ref = 0;
2123 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2124 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2125 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2126 msg_ref = (uintptr_t)msg_var.inner & ~1;
2129 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
2130 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2131 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2132 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2133 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2136 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
2137 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2138 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2139 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2140 uint32_t updates_ref = 0;
2141 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2144 updates_ref = (uintptr_t)updates_var.inner & ~1;
2147 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
2148 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2149 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2150 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2151 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2154 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
2155 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2156 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2157 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2158 uint32_t msg_ref = 0;
2159 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2160 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2161 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2162 msg_ref = (uintptr_t)msg_var.inner & ~1;
2165 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
2166 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2167 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2168 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2169 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2172 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
2173 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2174 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2175 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2176 uint32_t msg_ref = 0;
2177 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2178 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2180 msg_ref = (uintptr_t)msg_var.inner & ~1;
2183 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
2184 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2185 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2186 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2187 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2190 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
2191 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2192 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2193 LDKShutdown msg_var = obj->send_shutdown.msg;
2194 uint32_t msg_ref = 0;
2195 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2196 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2197 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2198 msg_ref = (uintptr_t)msg_var.inner & ~1;
2201 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
2202 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2203 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2204 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2205 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2208 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
2209 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2210 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2211 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2212 uint32_t msg_ref = 0;
2213 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2214 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2215 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2216 msg_ref = (uintptr_t)msg_var.inner & ~1;
2219 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
2220 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2221 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2222 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2223 uint32_t msg_ref = 0;
2224 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2225 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2227 msg_ref = (uintptr_t)msg_var.inner & ~1;
2230 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
2231 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2232 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2233 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2234 uint32_t update_msg_ref = 0;
2235 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2236 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2237 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2238 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2239 return update_msg_ref;
2241 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
2242 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2243 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2244 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2245 uint32_t msg_ref = 0;
2246 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2247 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2248 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2249 msg_ref = (uintptr_t)msg_var.inner & ~1;
2252 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
2253 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2254 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2255 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2256 uint32_t msg_ref = 0;
2257 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2258 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2259 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2260 msg_ref = (uintptr_t)msg_var.inner & ~1;
2263 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
2264 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2265 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2266 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2267 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2270 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
2271 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2272 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2273 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2274 uint32_t msg_ref = 0;
2275 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2276 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2277 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2278 msg_ref = (uintptr_t)msg_var.inner & ~1;
2281 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
2282 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2283 assert(obj->tag == LDKMessageSendEvent_HandleError);
2284 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2285 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2288 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
2289 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2290 assert(obj->tag == LDKMessageSendEvent_HandleError);
2291 uint32_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2294 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
2295 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2296 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2297 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2298 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2301 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
2302 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2303 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2304 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2305 uint32_t msg_ref = 0;
2306 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2307 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2308 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2309 msg_ref = (uintptr_t)msg_var.inner & ~1;
2312 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
2313 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2314 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2315 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2316 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2319 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
2320 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2321 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2322 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2323 uint32_t msg_ref = 0;
2324 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2327 msg_ref = (uintptr_t)msg_var.inner & ~1;
2330 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
2331 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2332 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2333 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2334 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2337 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
2338 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2339 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2340 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2341 uint32_t msg_ref = 0;
2342 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2343 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2344 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2345 msg_ref = (uintptr_t)msg_var.inner & ~1;
2348 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint32_t ptr) {
2349 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2350 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2351 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2352 memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2355 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint32_t ptr) {
2356 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2357 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2358 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2359 uint32_t msg_ref = 0;
2360 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2361 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2362 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2363 msg_ref = (uintptr_t)msg_var.inner & ~1;
2366 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2367 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2368 for (size_t i = 0; i < ret.datalen; i++) {
2369 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2373 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2374 CHECK(owner->result_ok);
2375 return TxOut_clone(&*owner->contents.result);
2377 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
2378 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2379 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2380 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2381 return (uint32_t)ret_ref;
2384 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2385 CHECK(!owner->result_ok);
2386 return AccessError_clone(&*owner->contents.err);
2388 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
2389 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2390 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2394 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2397 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
2398 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2399 uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2403 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2406 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
2407 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2408 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2409 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2410 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2414 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2415 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2416 for (size_t i = 0; i < ret.datalen; i++) {
2417 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2421 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2422 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2423 for (size_t i = 0; i < ret.datalen; i++) {
2424 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2428 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2429 CHECK(owner->result_ok);
2430 return *owner->contents.result;
2432 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
2433 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2434 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2437 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2438 CHECK(!owner->result_ok);
2439 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2441 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
2442 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2443 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2447 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
2448 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2450 case LDKMonitorEvent_HTLCEvent: return 0;
2451 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2452 case LDKMonitorEvent_UpdateCompleted: return 2;
2453 case LDKMonitorEvent_UpdateFailed: return 3;
2457 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
2458 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2459 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2460 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2461 uint32_t htlc_event_ref = 0;
2462 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2463 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2464 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2465 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2466 return htlc_event_ref;
2468 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
2469 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2470 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2471 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2472 uint32_t commitment_tx_confirmed_ref = 0;
2473 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2474 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2475 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2476 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2477 return commitment_tx_confirmed_ref;
2479 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
2480 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2481 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2482 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2483 uint32_t funding_txo_ref = 0;
2484 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2485 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2486 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2487 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2488 return funding_txo_ref;
2490 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
2491 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2492 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2493 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2494 return monitor_update_id_conv;
2496 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
2497 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2498 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2499 LDKOutPoint update_failed_var = obj->update_failed;
2500 uint32_t update_failed_ref = 0;
2501 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2502 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2503 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2504 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2505 return update_failed_ref;
2507 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2508 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2509 for (size_t i = 0; i < ret.datalen; i++) {
2510 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2514 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2515 return OutPoint_clone(&owner->a);
2517 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a(uint32_t owner) {
2518 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2519 LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv);
2520 uint32_t ret_ref = 0;
2521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2524 ret_ref = (uintptr_t)ret_var.inner;
2525 if (ret_var.is_owned) {
2531 static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2532 return CVec_MonitorEventZ_clone(&owner->b);
2534 uint32_tArray __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b(uint32_t owner) {
2535 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2536 LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv);
2537 uint32_tArray ret_arr = NULL;
2538 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
2539 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
2540 for (size_t o = 0; o < ret_var.datalen; o++) {
2541 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2542 *ret_conv_14_copy = ret_var.data[o];
2543 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
2544 ret_arr_ptr[o] = ret_conv_14_ref;
2551 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) {
2552 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen };
2553 for (size_t i = 0; i < ret.datalen; i++) {
2554 ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]);
2558 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
2559 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2561 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2562 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2566 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
2567 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2568 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2569 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2570 *some_conv = obj->some;
2571 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2572 return ((uint32_t)some_conv);
2574 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2575 CHECK(owner->result_ok);
2576 return FixedPenaltyScorer_clone(&*owner->contents.result);
2578 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint32_t owner) {
2579 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2580 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2581 uint32_t ret_ref = 0;
2582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2585 ret_ref = (uintptr_t)ret_var.inner;
2586 if (ret_var.is_owned) {
2592 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2593 CHECK(!owner->result_ok);
2594 return DecodeError_clone(&*owner->contents.err);
2596 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint32_t owner) {
2597 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2598 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2599 uint32_t ret_ref = 0;
2600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2603 ret_ref = (uintptr_t)ret_var.inner;
2604 if (ret_var.is_owned) {
2610 typedef struct LDKLogger_JCalls {
2611 atomic_size_t refcnt;
2612 uint32_t instance_ptr;
2614 static void LDKLogger_JCalls_free(void* this_arg) {
2615 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2616 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2620 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2621 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2622 LDKRecord record_var = *record;
2623 uint32_t record_ref = 0;
2624 record_var = Record_clone(&record_var);
2625 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2626 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2627 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2628 record_ref = (uintptr_t)record_var.inner;
2629 if (record_var.is_owned) {
2632 js_invoke_function_u_u(j_calls->instance_ptr, 0, (uint32_t)record_ref);
2634 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2635 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2636 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2638 static inline LDKLogger LDKLogger_init (JSValue o) {
2639 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2640 atomic_init(&calls->refcnt, 1);
2641 calls->instance_ptr = o;
2644 .this_arg = (void*) calls,
2645 .log = log_LDKLogger_jcall,
2646 .free = LDKLogger_JCalls_free,
2650 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2651 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2652 *res_ptr = LDKLogger_init(o);
2653 return (long)res_ptr;
2655 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2656 CHECK(owner->result_ok);
2657 return &*owner->contents.result;
2659 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint32_t owner) {
2660 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2661 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2662 uint32_t ret_ref = 0;
2663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2666 ret_ref = (uintptr_t)ret_var.inner & ~1;
2670 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2671 CHECK(!owner->result_ok);
2672 return DecodeError_clone(&*owner->contents.err);
2674 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint32_t owner) {
2675 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2676 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2677 uint32_t ret_ref = 0;
2678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2681 ret_ref = (uintptr_t)ret_var.inner;
2682 if (ret_var.is_owned) {
2688 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2689 CHECK(owner->result_ok);
2690 return InitFeatures_clone(&*owner->contents.result);
2692 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2693 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2694 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2695 uint32_t ret_ref = 0;
2696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2699 ret_ref = (uintptr_t)ret_var.inner;
2700 if (ret_var.is_owned) {
2706 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2707 CHECK(!owner->result_ok);
2708 return DecodeError_clone(&*owner->contents.err);
2710 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2711 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2712 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2713 uint32_t ret_ref = 0;
2714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2717 ret_ref = (uintptr_t)ret_var.inner;
2718 if (ret_var.is_owned) {
2724 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2725 CHECK(owner->result_ok);
2726 return ChannelFeatures_clone(&*owner->contents.result);
2728 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2729 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2730 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2731 uint32_t ret_ref = 0;
2732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2735 ret_ref = (uintptr_t)ret_var.inner;
2736 if (ret_var.is_owned) {
2742 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2743 CHECK(!owner->result_ok);
2744 return DecodeError_clone(&*owner->contents.err);
2746 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2747 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2748 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2749 uint32_t ret_ref = 0;
2750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2753 ret_ref = (uintptr_t)ret_var.inner;
2754 if (ret_var.is_owned) {
2760 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2761 CHECK(owner->result_ok);
2762 return NodeFeatures_clone(&*owner->contents.result);
2764 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2765 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2766 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2767 uint32_t ret_ref = 0;
2768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2771 ret_ref = (uintptr_t)ret_var.inner;
2772 if (ret_var.is_owned) {
2778 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2779 CHECK(!owner->result_ok);
2780 return DecodeError_clone(&*owner->contents.err);
2782 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2783 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2784 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2785 uint32_t ret_ref = 0;
2786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2789 ret_ref = (uintptr_t)ret_var.inner;
2790 if (ret_var.is_owned) {
2796 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2797 CHECK(owner->result_ok);
2798 return InvoiceFeatures_clone(&*owner->contents.result);
2800 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2801 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2802 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2803 uint32_t ret_ref = 0;
2804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2807 ret_ref = (uintptr_t)ret_var.inner;
2808 if (ret_var.is_owned) {
2814 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2815 CHECK(!owner->result_ok);
2816 return DecodeError_clone(&*owner->contents.err);
2818 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2819 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2820 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2821 uint32_t ret_ref = 0;
2822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2825 ret_ref = (uintptr_t)ret_var.inner;
2826 if (ret_var.is_owned) {
2832 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2833 CHECK(owner->result_ok);
2834 return ChannelTypeFeatures_clone(&*owner->contents.result);
2836 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2837 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2838 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2839 uint32_t ret_ref = 0;
2840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2843 ret_ref = (uintptr_t)ret_var.inner;
2844 if (ret_var.is_owned) {
2850 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2851 CHECK(!owner->result_ok);
2852 return DecodeError_clone(&*owner->contents.err);
2854 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2855 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2856 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2857 uint32_t ret_ref = 0;
2858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2861 ret_ref = (uintptr_t)ret_var.inner;
2862 if (ret_var.is_owned) {
2868 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2869 CHECK(owner->result_ok);
2870 return NodeId_clone(&*owner->contents.result);
2872 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
2873 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2874 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2875 uint32_t ret_ref = 0;
2876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2879 ret_ref = (uintptr_t)ret_var.inner;
2880 if (ret_var.is_owned) {
2886 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2887 CHECK(!owner->result_ok);
2888 return DecodeError_clone(&*owner->contents.err);
2890 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
2891 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2892 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2893 uint32_t ret_ref = 0;
2894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2897 ret_ref = (uintptr_t)ret_var.inner;
2898 if (ret_var.is_owned) {
2904 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2905 CHECK(owner->result_ok);
2906 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2908 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
2909 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2910 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2911 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2912 uint32_t ret_ref = (uintptr_t)ret_copy;
2916 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2917 CHECK(!owner->result_ok);
2918 return DecodeError_clone(&*owner->contents.err);
2920 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
2921 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2922 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2923 uint32_t ret_ref = 0;
2924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2927 ret_ref = (uintptr_t)ret_var.inner;
2928 if (ret_var.is_owned) {
2934 typedef struct LDKAccess_JCalls {
2935 atomic_size_t refcnt;
2936 uint32_t instance_ptr;
2938 static void LDKAccess_JCalls_free(void* this_arg) {
2939 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2940 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2944 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2945 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2946 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2947 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2948 int64_t short_channel_id_conv = short_channel_id;
2949 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id_conv);
2950 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2951 CHECK_ACCESS(ret_ptr);
2952 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2956 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2957 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2958 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2960 static inline LDKAccess LDKAccess_init (JSValue o) {
2961 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2962 atomic_init(&calls->refcnt, 1);
2963 calls->instance_ptr = o;
2966 .this_arg = (void*) calls,
2967 .get_utxo = get_utxo_LDKAccess_jcall,
2968 .free = LDKAccess_JCalls_free,
2972 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2973 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2974 *res_ptr = LDKAccess_init(o);
2975 return (long)res_ptr;
2977 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) {
2978 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
2979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2980 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2981 unsigned char genesis_hash_arr[32];
2982 CHECK(genesis_hash->arr_len == 32);
2983 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2984 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2985 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2986 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2987 return (uint32_t)ret_conv;
2990 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
2991 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
2993 case LDKCOption_AccessZ_Some: return 0;
2994 case LDKCOption_AccessZ_None: return 1;
2998 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
2999 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3000 assert(obj->tag == LDKCOption_AccessZ_Some);
3001 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3002 *some_ret = obj->some;
3003 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3004 if ((*some_ret).free == LDKAccess_JCalls_free) {
3005 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3006 LDKAccess_JCalls_cloned(&(*some_ret));
3008 return (uint32_t)some_ret;
3010 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3011 CHECK(owner->result_ok);
3012 return *owner->contents.result;
3014 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3015 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3016 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3020 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3021 CHECK(!owner->result_ok);
3022 return LightningError_clone(&*owner->contents.err);
3024 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3025 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3026 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3027 uint32_t ret_ref = 0;
3028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3031 ret_ref = (uintptr_t)ret_var.inner;
3032 if (ret_var.is_owned) {
3038 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3039 return ChannelAnnouncement_clone(&owner->a);
3041 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3042 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3043 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3044 uint32_t ret_ref = 0;
3045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3048 ret_ref = (uintptr_t)ret_var.inner;
3049 if (ret_var.is_owned) {
3055 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3056 return ChannelUpdate_clone(&owner->b);
3058 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3059 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3060 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3061 uint32_t ret_ref = 0;
3062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3065 ret_ref = (uintptr_t)ret_var.inner;
3066 if (ret_var.is_owned) {
3072 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3073 return ChannelUpdate_clone(&owner->c);
3075 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3076 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3077 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3078 uint32_t ret_ref = 0;
3079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3082 ret_ref = (uintptr_t)ret_var.inner;
3083 if (ret_var.is_owned) {
3089 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3090 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3091 for (size_t i = 0; i < ret.datalen; i++) {
3092 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3096 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3097 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3098 for (size_t i = 0; i < ret.datalen; i++) {
3099 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3103 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3104 CHECK(owner->result_ok);
3105 return *owner->contents.result;
3107 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
3108 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3109 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3112 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3113 CHECK(!owner->result_ok);
3114 return LightningError_clone(&*owner->contents.err);
3116 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
3117 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3118 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3119 uint32_t ret_ref = 0;
3120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3123 ret_ref = (uintptr_t)ret_var.inner;
3124 if (ret_var.is_owned) {
3130 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3131 CHECK(owner->result_ok);
3132 return ChannelUpdateInfo_clone(&*owner->contents.result);
3134 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
3135 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3136 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3137 uint32_t ret_ref = 0;
3138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3141 ret_ref = (uintptr_t)ret_var.inner;
3142 if (ret_var.is_owned) {
3148 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3149 CHECK(!owner->result_ok);
3150 return DecodeError_clone(&*owner->contents.err);
3152 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
3153 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3154 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3155 uint32_t ret_ref = 0;
3156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3159 ret_ref = (uintptr_t)ret_var.inner;
3160 if (ret_var.is_owned) {
3166 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3167 CHECK(owner->result_ok);
3168 return ChannelInfo_clone(&*owner->contents.result);
3170 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3171 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3172 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3173 uint32_t ret_ref = 0;
3174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3177 ret_ref = (uintptr_t)ret_var.inner;
3178 if (ret_var.is_owned) {
3184 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3185 CHECK(!owner->result_ok);
3186 return DecodeError_clone(&*owner->contents.err);
3188 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3189 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3190 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3191 uint32_t ret_ref = 0;
3192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3195 ret_ref = (uintptr_t)ret_var.inner;
3196 if (ret_var.is_owned) {
3202 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3203 CHECK(owner->result_ok);
3204 return RoutingFees_clone(&*owner->contents.result);
3206 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3207 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3208 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3209 uint32_t ret_ref = 0;
3210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3213 ret_ref = (uintptr_t)ret_var.inner;
3214 if (ret_var.is_owned) {
3220 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3221 CHECK(!owner->result_ok);
3222 return DecodeError_clone(&*owner->contents.err);
3224 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3225 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3226 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3227 uint32_t ret_ref = 0;
3228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3231 ret_ref = (uintptr_t)ret_var.inner;
3232 if (ret_var.is_owned) {
3238 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3239 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3241 case LDKNetAddress_IPv4: return 0;
3242 case LDKNetAddress_IPv6: return 1;
3243 case LDKNetAddress_OnionV2: return 2;
3244 case LDKNetAddress_OnionV3: return 3;
3248 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3249 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3250 assert(obj->tag == LDKNetAddress_IPv4);
3251 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3252 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3255 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3256 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3257 assert(obj->tag == LDKNetAddress_IPv4);
3258 int16_t port_conv = obj->i_pv4.port;
3261 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3262 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3263 assert(obj->tag == LDKNetAddress_IPv6);
3264 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3265 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3268 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3269 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3270 assert(obj->tag == LDKNetAddress_IPv6);
3271 int16_t port_conv = obj->i_pv6.port;
3274 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3275 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3276 assert(obj->tag == LDKNetAddress_OnionV2);
3277 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3278 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3279 return onion_v2_arr;
3281 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3282 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3283 assert(obj->tag == LDKNetAddress_OnionV3);
3284 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3285 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3286 return ed25519_pubkey_arr;
3288 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3289 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3290 assert(obj->tag == LDKNetAddress_OnionV3);
3291 int16_t checksum_conv = obj->onion_v3.checksum;
3292 return checksum_conv;
3294 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3295 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3296 assert(obj->tag == LDKNetAddress_OnionV3);
3297 int8_t version_conv = obj->onion_v3.version;
3298 return version_conv;
3300 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3301 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3302 assert(obj->tag == LDKNetAddress_OnionV3);
3303 int16_t port_conv = obj->onion_v3.port;
3306 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3307 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3308 for (size_t i = 0; i < ret.datalen; i++) {
3309 ret.data[i] = NetAddress_clone(&orig->data[i]);
3313 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3314 CHECK(owner->result_ok);
3315 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3317 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3318 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3319 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3320 uint32_t ret_ref = 0;
3321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3324 ret_ref = (uintptr_t)ret_var.inner;
3325 if (ret_var.is_owned) {
3331 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3332 CHECK(!owner->result_ok);
3333 return DecodeError_clone(&*owner->contents.err);
3335 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3336 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3337 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3338 uint32_t ret_ref = 0;
3339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3342 ret_ref = (uintptr_t)ret_var.inner;
3343 if (ret_var.is_owned) {
3349 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3350 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3351 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3354 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3355 CHECK(owner->result_ok);
3356 return NodeInfo_clone(&*owner->contents.result);
3358 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3359 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3360 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3361 uint32_t ret_ref = 0;
3362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3365 ret_ref = (uintptr_t)ret_var.inner;
3366 if (ret_var.is_owned) {
3372 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3373 CHECK(!owner->result_ok);
3374 return DecodeError_clone(&*owner->contents.err);
3376 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3377 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3378 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3379 uint32_t ret_ref = 0;
3380 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3381 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3383 ret_ref = (uintptr_t)ret_var.inner;
3384 if (ret_var.is_owned) {
3390 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3391 CHECK(owner->result_ok);
3392 return &*owner->contents.result;
3394 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3395 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3396 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3397 uint32_t ret_ref = 0;
3398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3401 ret_ref = (uintptr_t)ret_var.inner & ~1;
3405 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3406 CHECK(!owner->result_ok);
3407 return DecodeError_clone(&*owner->contents.err);
3409 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3410 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3411 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3412 uint32_t ret_ref = 0;
3413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3416 ret_ref = (uintptr_t)ret_var.inner;
3417 if (ret_var.is_owned) {
3423 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3424 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3426 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3427 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3431 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3432 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3433 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3434 LDKCVec_NetAddressZ some_var = obj->some;
3435 uint32_tArray some_arr = NULL;
3436 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
3437 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3438 for (size_t m = 0; m < some_var.datalen; m++) {
3439 uint32_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
3440 some_arr_ptr[m] = some_conv_12_ref;
3445 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3446 CHECK(owner->result_ok);
3447 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3449 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3450 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3451 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3452 uint32_t ret_ref = 0;
3453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3456 ret_ref = (uintptr_t)ret_var.inner;
3457 if (ret_var.is_owned) {
3463 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3464 CHECK(!owner->result_ok);
3465 return DecodeError_clone(&*owner->contents.err);
3467 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3468 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3469 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3470 uint32_t ret_ref = 0;
3471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3474 ret_ref = (uintptr_t)ret_var.inner;
3475 if (ret_var.is_owned) {
3481 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3482 CHECK(owner->result_ok);
3483 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3485 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3486 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3487 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3488 uint32_t ret_ref = 0;
3489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3492 ret_ref = (uintptr_t)ret_var.inner;
3493 if (ret_var.is_owned) {
3499 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3500 CHECK(!owner->result_ok);
3501 return DecodeError_clone(&*owner->contents.err);
3503 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3504 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3505 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3506 uint32_t ret_ref = 0;
3507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3510 ret_ref = (uintptr_t)ret_var.inner;
3511 if (ret_var.is_owned) {
3517 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3518 CHECK(owner->result_ok);
3519 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3521 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3522 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3523 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3524 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3525 uint32_t ret_ref = (uintptr_t)ret_copy;
3529 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3530 CHECK(!owner->result_ok);
3531 return DecodeError_clone(&*owner->contents.err);
3533 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3534 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3535 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3536 uint32_t ret_ref = 0;
3537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3540 ret_ref = (uintptr_t)ret_var.inner;
3541 if (ret_var.is_owned) {
3547 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3548 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3549 for (size_t i = 0; i < ret.datalen; i++) {
3550 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3554 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3557 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
3558 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3559 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3560 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3564 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3567 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
3568 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3569 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3570 ptrArray ret_arr = NULL;
3571 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3572 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3573 for (size_t m = 0; m < ret_var.datalen; m++) {
3574 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3575 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3576 ret_arr_ptr[m] = ret_conv_12_arr;
3582 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3583 CHECK(owner->result_ok);
3584 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3586 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
3587 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3588 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3589 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3590 return ((uint32_t)ret_conv);
3593 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3594 CHECK(!owner->result_ok);
3595 return *owner->contents.err;
3597 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
3598 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3599 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3602 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3603 CHECK(owner->result_ok);
3604 return *owner->contents.result;
3606 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
3607 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3608 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3609 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3613 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3614 CHECK(!owner->result_ok);
3615 return *owner->contents.err;
3617 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
3618 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3619 CResult_SignatureNoneZ_get_err(owner_conv);
3622 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3625 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
3626 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3627 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3628 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3632 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3635 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
3636 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3637 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3638 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3642 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3643 CHECK(owner->result_ok);
3644 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3646 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
3647 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3648 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3649 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3650 return ((uint32_t)ret_conv);
3653 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3654 CHECK(!owner->result_ok);
3655 return *owner->contents.err;
3657 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
3658 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3659 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3662 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3663 CHECK(owner->result_ok);
3664 return *owner->contents.result;
3666 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
3667 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3668 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3669 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3673 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3674 CHECK(!owner->result_ok);
3675 return *owner->contents.err;
3677 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
3678 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3679 CResult_SecretKeyNoneZ_get_err(owner_conv);
3682 typedef struct LDKBaseSign_JCalls {
3683 atomic_size_t refcnt;
3684 uint32_t instance_ptr;
3685 } LDKBaseSign_JCalls;
3686 static void LDKBaseSign_JCalls_free(void* this_arg) {
3687 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3688 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3692 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3693 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3694 int64_t idx_conv = idx;
3695 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 2, (uint32_t)idx_conv);
3696 LDKPublicKey ret_ref;
3697 CHECK(ret->arr_len == 33);
3698 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3701 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3702 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3703 int64_t idx_conv = idx;
3704 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 3, (uint32_t)idx_conv);
3705 LDKThirtyTwoBytes ret_ref;
3706 CHECK(ret->arr_len == 32);
3707 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3710 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3711 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3712 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3713 uint32_t holder_tx_ref = 0;
3714 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3715 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3716 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3717 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3718 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3719 if (holder_tx_var.is_owned) {
3722 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3723 ptrArray preimages_arr = NULL;
3724 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3725 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3726 for (size_t m = 0; m < preimages_var.datalen; m++) {
3727 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3728 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3729 preimages_arr_ptr[m] = preimages_conv_12_arr;
3732 FREE(preimages_var.data);
3733 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 4, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
3734 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3735 CHECK_ACCESS(ret_ptr);
3736 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3740 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3741 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3742 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 5);
3743 LDKThirtyTwoBytes ret_ref;
3744 CHECK(ret->arr_len == 32);
3745 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3748 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3749 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3750 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3751 uint32_t commitment_tx_ref = 0;
3752 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3753 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3756 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3757 if (commitment_tx_var.is_owned) {
3758 commitment_tx_ref |= 1;
3760 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3761 ptrArray preimages_arr = NULL;
3762 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3763 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3764 for (size_t m = 0; m < preimages_var.datalen; m++) {
3765 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3766 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3767 preimages_arr_ptr[m] = preimages_conv_12_arr;
3770 FREE(preimages_var.data);
3771 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
3772 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3773 CHECK_ACCESS(ret_ptr);
3774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3778 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3779 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3780 int64_t idx_conv = idx;
3781 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3782 memcpy(secret_arr->elems, *secret, 32);
3783 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 7, (uint32_t)idx_conv, (uint32_t)secret_arr);
3784 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3785 CHECK_ACCESS(ret_ptr);
3786 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3790 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3791 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3792 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3793 uint32_t commitment_tx_ref = 0;
3794 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3795 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3796 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3797 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3798 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3799 if (commitment_tx_var.is_owned) {
3800 commitment_tx_ref |= 1;
3802 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 8, (uint32_t)commitment_tx_ref);
3803 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3804 CHECK_ACCESS(ret_ptr);
3805 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3809 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]) {
3810 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3811 LDKTransaction justice_tx_var = justice_tx;
3812 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3813 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3814 Transaction_free(justice_tx_var);
3815 uint32_t input_conv = input;
3816 int64_t amount_conv = amount;
3817 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3818 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3819 uint32_t ret = js_invoke_function_u_uuuu(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr);
3820 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3821 CHECK_ACCESS(ret_ptr);
3822 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3826 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) {
3827 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3828 LDKTransaction justice_tx_var = justice_tx;
3829 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3830 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3831 Transaction_free(justice_tx_var);
3832 uint32_t input_conv = input;
3833 int64_t amount_conv = amount;
3834 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3835 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3836 LDKHTLCOutputInCommitment htlc_var = *htlc;
3837 uint32_t htlc_ref = 0;
3838 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3839 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3840 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3841 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3842 htlc_ref = (uintptr_t)htlc_var.inner;
3843 if (htlc_var.is_owned) {
3846 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
3847 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3848 CHECK_ACCESS(ret_ptr);
3849 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3853 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) {
3854 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3855 LDKTransaction htlc_tx_var = htlc_tx;
3856 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3857 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3858 Transaction_free(htlc_tx_var);
3859 uint32_t input_conv = input;
3860 int64_t amount_conv = amount;
3861 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3862 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3863 LDKHTLCOutputInCommitment htlc_var = *htlc;
3864 uint32_t htlc_ref = 0;
3865 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3866 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3867 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3868 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3869 htlc_ref = (uintptr_t)htlc_var.inner;
3870 if (htlc_var.is_owned) {
3873 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
3874 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3875 CHECK_ACCESS(ret_ptr);
3876 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3880 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3881 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3882 LDKClosingTransaction closing_tx_var = *closing_tx;
3883 uint32_t closing_tx_ref = 0;
3884 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3885 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3886 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3887 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3888 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3889 if (closing_tx_var.is_owned) {
3890 closing_tx_ref |= 1;
3892 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 12, (uint32_t)closing_tx_ref);
3893 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3894 CHECK_ACCESS(ret_ptr);
3895 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3899 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3900 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3901 LDKUnsignedChannelAnnouncement msg_var = *msg;
3902 uint32_t msg_ref = 0;
3903 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3904 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3905 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3906 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3907 msg_ref = (uintptr_t)msg_var.inner;
3908 if (msg_var.is_owned) {
3911 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 13, (uint32_t)msg_ref);
3912 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3913 CHECK_ACCESS(ret_ptr);
3914 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3918 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3919 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3920 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3921 uint32_t channel_parameters_ref = 0;
3922 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3923 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3924 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3925 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3926 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3927 if (channel_parameters_var.is_owned) {
3928 channel_parameters_ref |= 1;
3930 js_invoke_function_u_u(j_calls->instance_ptr, 14, (uint32_t)channel_parameters_ref);
3932 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3933 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3934 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3936 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
3937 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3938 atomic_init(&calls->refcnt, 1);
3939 calls->instance_ptr = o;
3941 LDKChannelPublicKeys pubkeys_conv;
3942 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3943 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3944 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3947 .this_arg = (void*) calls,
3948 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3949 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3950 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3951 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3952 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3953 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3954 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3955 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3956 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3957 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3958 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3959 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3960 .ready_channel = ready_channel_LDKBaseSign_jcall,
3961 .free = LDKBaseSign_JCalls_free,
3962 .pubkeys = pubkeys_conv,
3963 .set_pubkeys = NULL,
3967 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
3968 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3969 *res_ptr = LDKBaseSign_init(o, pubkeys);
3970 return (long)res_ptr;
3972 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
3973 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3974 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3975 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3976 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3977 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3981 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
3982 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3983 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3984 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3985 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3986 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3990 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) {
3991 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3992 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3993 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3994 LDKHolderCommitmentTransaction holder_tx_conv;
3995 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3996 holder_tx_conv.is_owned = false;
3997 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3998 LDKCVec_PaymentPreimageZ preimages_constr;
3999 preimages_constr.datalen = preimages->arr_len;
4000 if (preimages_constr.datalen > 0)
4001 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4003 preimages_constr.data = NULL;
4004 int8_tArray* preimages_vals = (void*) preimages->elems;
4005 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4006 int8_tArray preimages_conv_12 = preimages_vals[m];
4007 LDKThirtyTwoBytes preimages_conv_12_ref;
4008 CHECK(preimages_conv_12->arr_len == 32);
4009 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4010 preimages_constr.data[m] = preimages_conv_12_ref;
4013 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4014 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4015 return (uint32_t)ret_conv;
4018 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
4019 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4020 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4021 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4022 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4023 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4027 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) {
4028 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4030 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4031 LDKCommitmentTransaction commitment_tx_conv;
4032 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4033 commitment_tx_conv.is_owned = false;
4034 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4035 LDKCVec_PaymentPreimageZ preimages_constr;
4036 preimages_constr.datalen = preimages->arr_len;
4037 if (preimages_constr.datalen > 0)
4038 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4040 preimages_constr.data = NULL;
4041 int8_tArray* preimages_vals = (void*) preimages->elems;
4042 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4043 int8_tArray preimages_conv_12 = preimages_vals[m];
4044 LDKThirtyTwoBytes preimages_conv_12_ref;
4045 CHECK(preimages_conv_12->arr_len == 32);
4046 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4047 preimages_constr.data[m] = preimages_conv_12_ref;
4050 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4051 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4052 return (uint32_t)ret_conv;
4055 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) {
4056 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4057 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4058 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4059 unsigned char secret_arr[32];
4060 CHECK(secret->arr_len == 32);
4061 memcpy(secret_arr, secret->elems, 32); FREE(secret);
4062 unsigned char (*secret_ref)[32] = &secret_arr;
4063 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4064 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4065 return (uint32_t)ret_conv;
4068 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) {
4069 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4071 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4072 LDKHolderCommitmentTransaction commitment_tx_conv;
4073 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4074 commitment_tx_conv.is_owned = false;
4075 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4076 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4077 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4078 return (uint32_t)ret_conv;
4081 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_output"))) TS_BaseSign_sign_justice_revoked_output(uint32_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) {
4082 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4083 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4084 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4085 LDKTransaction justice_tx_ref;
4086 justice_tx_ref.datalen = justice_tx->arr_len;
4087 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4088 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4089 justice_tx_ref.data_is_owned = true;
4090 unsigned char per_commitment_key_arr[32];
4091 CHECK(per_commitment_key->arr_len == 32);
4092 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4093 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4094 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4095 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4096 return (uint32_t)ret_conv;
4099 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) TS_BaseSign_sign_justice_revoked_htlc(uint32_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
4100 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4101 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4102 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4103 LDKTransaction justice_tx_ref;
4104 justice_tx_ref.datalen = justice_tx->arr_len;
4105 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4106 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4107 justice_tx_ref.data_is_owned = true;
4108 unsigned char per_commitment_key_arr[32];
4109 CHECK(per_commitment_key->arr_len == 32);
4110 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4111 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4112 LDKHTLCOutputInCommitment htlc_conv;
4113 htlc_conv.inner = (void*)(htlc & (~1));
4114 htlc_conv.is_owned = false;
4115 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4116 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4117 *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);
4118 return (uint32_t)ret_conv;
4121 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transaction"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
4122 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4123 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4124 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4125 LDKTransaction htlc_tx_ref;
4126 htlc_tx_ref.datalen = htlc_tx->arr_len;
4127 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4128 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4129 htlc_tx_ref.data_is_owned = true;
4130 LDKPublicKey per_commitment_point_ref;
4131 CHECK(per_commitment_point->arr_len == 33);
4132 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4133 LDKHTLCOutputInCommitment htlc_conv;
4134 htlc_conv.inner = (void*)(htlc & (~1));
4135 htlc_conv.is_owned = false;
4136 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4137 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4138 *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);
4139 return (uint32_t)ret_conv;
4142 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
4143 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4144 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4145 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4146 LDKClosingTransaction closing_tx_conv;
4147 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4148 closing_tx_conv.is_owned = false;
4149 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4150 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4151 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4152 return (uint32_t)ret_conv;
4155 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
4156 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4157 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4158 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4159 LDKUnsignedChannelAnnouncement msg_conv;
4160 msg_conv.inner = (void*)(msg & (~1));
4161 msg_conv.is_owned = false;
4162 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4163 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4164 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4165 return (uint32_t)ret_conv;
4168 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
4169 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4170 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4171 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4172 LDKChannelTransactionParameters channel_parameters_conv;
4173 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4174 channel_parameters_conv.is_owned = false;
4175 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4176 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4179 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4180 if (this_arg->set_pubkeys != NULL)
4181 this_arg->set_pubkeys(this_arg);
4182 return this_arg->pubkeys;
4184 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
4185 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4186 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4187 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4188 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4189 uint32_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 typedef struct LDKSign_JCalls {
4201 atomic_size_t refcnt;
4202 uint32_t instance_ptr;
4203 LDKBaseSign_JCalls* BaseSign;
4205 static void LDKSign_JCalls_free(void* this_arg) {
4206 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4207 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4211 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4212 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4213 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 15);
4214 LDKCVec_u8Z ret_ref;
4215 ret_ref.datalen = ret->arr_len;
4216 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4217 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4220 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4221 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4222 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4223 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4225 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4226 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4227 atomic_init(&calls->refcnt, 1);
4228 calls->instance_ptr = o;
4230 LDKChannelPublicKeys pubkeys_conv;
4231 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4232 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4233 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4236 .this_arg = (void*) calls,
4237 .write = write_LDKSign_jcall,
4238 .cloned = LDKSign_JCalls_cloned,
4239 .free = LDKSign_JCalls_free,
4240 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4242 calls->BaseSign = ret.BaseSign.this_arg;
4245 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4246 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4247 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4248 return (long)res_ptr;
4250 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
4251 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4252 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4253 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4254 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4255 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4256 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4257 CVec_u8Z_free(ret_var);
4261 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4262 CHECK(owner->result_ok);
4263 return Sign_clone(&*owner->contents.result);
4265 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
4266 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4267 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4268 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4269 return (uint32_t)ret_ret;
4272 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4273 CHECK(!owner->result_ok);
4274 return DecodeError_clone(&*owner->contents.err);
4276 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
4277 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4278 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4279 uint32_t ret_ref = 0;
4280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4283 ret_ref = (uintptr_t)ret_var.inner;
4284 if (ret_var.is_owned) {
4290 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4291 CHECK(owner->result_ok);
4292 return *owner->contents.result;
4294 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
4295 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4296 int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4297 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4301 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4302 CHECK(!owner->result_ok);
4303 return *owner->contents.err;
4305 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
4306 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4307 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4310 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4311 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4312 for (size_t i = 0; i < ret.datalen; i++) {
4313 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4317 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4318 CHECK(owner->result_ok);
4319 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4321 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
4322 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4323 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4324 ptrArray ret_arr = NULL;
4325 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4326 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
4327 for (size_t m = 0; m < ret_var.datalen; m++) {
4328 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4329 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4330 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4331 CVec_u8Z_free(ret_conv_12_var);
4332 ret_arr_ptr[m] = ret_conv_12_arr;
4339 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4340 CHECK(!owner->result_ok);
4341 return *owner->contents.err;
4343 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
4344 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4345 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4348 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4349 CHECK(owner->result_ok);
4350 return InMemorySigner_clone(&*owner->contents.result);
4352 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
4353 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4354 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4355 uint32_t ret_ref = 0;
4356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4359 ret_ref = (uintptr_t)ret_var.inner;
4360 if (ret_var.is_owned) {
4366 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4367 CHECK(!owner->result_ok);
4368 return DecodeError_clone(&*owner->contents.err);
4370 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
4371 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4372 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4373 uint32_t ret_ref = 0;
4374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4377 ret_ref = (uintptr_t)ret_var.inner;
4378 if (ret_var.is_owned) {
4384 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4385 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4386 for (size_t i = 0; i < ret.datalen; i++) {
4387 ret.data[i] = TxOut_clone(&orig->data[i]);
4391 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4392 CHECK(owner->result_ok);
4393 return *owner->contents.result;
4395 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
4396 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4397 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4398 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4399 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4403 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4404 CHECK(!owner->result_ok);
4405 return *owner->contents.err;
4407 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
4408 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4409 CResult_TransactionNoneZ_get_err(owner_conv);
4412 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
4413 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4415 case LDKCOption_u16Z_Some: return 0;
4416 case LDKCOption_u16Z_None: return 1;
4420 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
4421 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4422 assert(obj->tag == LDKCOption_u16Z_Some);
4423 int16_t some_conv = obj->some;
4426 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
4427 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4429 case LDKAPIError_APIMisuseError: return 0;
4430 case LDKAPIError_FeeRateTooHigh: return 1;
4431 case LDKAPIError_RouteError: return 2;
4432 case LDKAPIError_ChannelUnavailable: return 3;
4433 case LDKAPIError_MonitorUpdateFailed: return 4;
4434 case LDKAPIError_IncompatibleShutdownScript: return 5;
4438 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
4439 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4440 assert(obj->tag == LDKAPIError_APIMisuseError);
4441 LDKStr err_str = obj->api_misuse_error.err;
4442 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4445 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
4446 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4447 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4448 LDKStr err_str = obj->fee_rate_too_high.err;
4449 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4452 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
4453 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4454 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4455 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4456 return feerate_conv;
4458 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
4459 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4460 assert(obj->tag == LDKAPIError_RouteError);
4461 LDKStr err_str = obj->route_error.err;
4462 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4465 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
4466 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4467 assert(obj->tag == LDKAPIError_ChannelUnavailable);
4468 LDKStr err_str = obj->channel_unavailable.err;
4469 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4472 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
4473 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4474 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4475 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4476 uint32_t script_ref = 0;
4477 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4478 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4479 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4480 script_ref = (uintptr_t)script_var.inner & ~1;
4483 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4484 CHECK(owner->result_ok);
4485 return *owner->contents.result;
4487 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
4488 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4489 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4492 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4493 CHECK(!owner->result_ok);
4494 return APIError_clone(&*owner->contents.err);
4496 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
4497 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4498 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4499 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4500 uint32_t ret_ref = (uintptr_t)ret_copy;
4504 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4505 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4506 for (size_t i = 0; i < ret.datalen; i++) {
4507 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4511 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4512 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4513 for (size_t i = 0; i < ret.datalen; i++) {
4514 ret.data[i] = APIError_clone(&orig->data[i]);
4518 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4519 CHECK(owner->result_ok);
4520 return ThirtyTwoBytes_clone(&*owner->contents.result);
4522 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
4523 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4524 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4525 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4529 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4530 CHECK(!owner->result_ok);
4531 return APIError_clone(&*owner->contents.err);
4533 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
4534 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4535 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4536 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4537 uint32_t ret_ref = (uintptr_t)ret_copy;
4541 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
4542 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4544 case LDKPaymentSendFailure_ParameterError: return 0;
4545 case LDKPaymentSendFailure_PathParameterError: return 1;
4546 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4547 case LDKPaymentSendFailure_PartialFailure: return 3;
4551 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
4552 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4553 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4554 uint32_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4555 return parameter_error_ref;
4557 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
4558 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4559 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4560 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4561 uint32_tArray path_parameter_error_arr = NULL;
4562 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen, __LINE__);
4563 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
4564 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4565 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4566 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4567 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4568 path_parameter_error_arr_ptr[w] = (uint32_t)path_parameter_error_conv_22_conv;
4571 return path_parameter_error_arr;
4573 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
4574 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4575 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4576 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4577 uint32_tArray all_failed_retry_safe_arr = NULL;
4578 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4579 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
4580 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4581 uint32_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4582 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4585 return all_failed_retry_safe_arr;
4587 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
4588 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4589 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4590 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4591 uint32_tArray results_arr = NULL;
4592 results_arr = init_uint32_tArray(results_var.datalen, __LINE__);
4593 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
4594 for (size_t w = 0; w < results_var.datalen; w++) {
4595 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4596 *results_conv_22_conv = results_var.data[w];
4597 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4598 results_arr_ptr[w] = (uint32_t)results_conv_22_conv;
4603 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
4604 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4605 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4606 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4607 uint32_t failed_paths_retry_ref = 0;
4608 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4609 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4610 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4611 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4612 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4614 return failed_paths_retry_ref;
4616 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
4617 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4618 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4619 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4620 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4621 return payment_id_arr;
4623 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4624 CHECK(owner->result_ok);
4625 return ThirtyTwoBytes_clone(&*owner->contents.result);
4627 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
4628 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4629 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4630 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4634 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4635 CHECK(!owner->result_ok);
4636 return PaymentSendFailure_clone(&*owner->contents.err);
4638 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
4639 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4640 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4641 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4642 uint32_t ret_ref = (uintptr_t)ret_copy;
4646 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4647 CHECK(owner->result_ok);
4648 return *owner->contents.result;
4650 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
4651 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4652 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4655 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4656 CHECK(!owner->result_ok);
4657 return PaymentSendFailure_clone(&*owner->contents.err);
4659 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
4660 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4661 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4662 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4663 uint32_t ret_ref = (uintptr_t)ret_copy;
4667 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4668 return ThirtyTwoBytes_clone(&owner->a);
4670 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
4671 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4672 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4673 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4677 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4678 return ThirtyTwoBytes_clone(&owner->b);
4680 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
4681 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4682 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4683 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4687 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4688 CHECK(owner->result_ok);
4689 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4691 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
4692 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4693 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4694 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4695 return ((uint32_t)ret_conv);
4698 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4699 CHECK(!owner->result_ok);
4700 return PaymentSendFailure_clone(&*owner->contents.err);
4702 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
4703 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4704 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4705 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4706 uint32_t ret_ref = (uintptr_t)ret_copy;
4710 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4711 return ThirtyTwoBytes_clone(&owner->a);
4713 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
4714 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4715 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4716 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4720 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4721 return ThirtyTwoBytes_clone(&owner->b);
4723 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
4724 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4725 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4726 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4730 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4731 CHECK(owner->result_ok);
4732 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4734 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
4735 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4736 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4737 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4738 return ((uint32_t)ret_conv);
4741 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4742 CHECK(!owner->result_ok);
4743 return *owner->contents.err;
4745 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
4746 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4747 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4750 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4751 CHECK(owner->result_ok);
4752 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4754 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
4755 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4756 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4757 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4758 return ((uint32_t)ret_conv);
4761 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4762 CHECK(!owner->result_ok);
4763 return APIError_clone(&*owner->contents.err);
4765 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
4766 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4767 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4768 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4769 uint32_t ret_ref = (uintptr_t)ret_copy;
4773 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4774 CHECK(owner->result_ok);
4775 return ThirtyTwoBytes_clone(&*owner->contents.result);
4777 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
4778 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4779 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4780 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4784 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4785 CHECK(!owner->result_ok);
4786 return *owner->contents.err;
4788 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
4789 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4790 CResult_PaymentSecretNoneZ_get_err(owner_conv);
4793 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4794 CHECK(owner->result_ok);
4795 return ThirtyTwoBytes_clone(&*owner->contents.result);
4797 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
4798 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4799 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4800 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4804 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4805 CHECK(!owner->result_ok);
4806 return APIError_clone(&*owner->contents.err);
4808 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
4809 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4810 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4811 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4812 uint32_t ret_ref = (uintptr_t)ret_copy;
4816 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4817 CHECK(owner->result_ok);
4818 return ThirtyTwoBytes_clone(&*owner->contents.result);
4820 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
4821 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4822 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4823 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4827 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4828 CHECK(!owner->result_ok);
4829 return APIError_clone(&*owner->contents.err);
4831 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
4832 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4833 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4834 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4835 uint32_t ret_ref = (uintptr_t)ret_copy;
4839 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4840 CHECK(owner->result_ok);
4841 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
4843 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint32_t owner) {
4844 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4845 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4846 uint32_t ret_ref = 0;
4847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4850 ret_ref = (uintptr_t)ret_var.inner;
4851 if (ret_var.is_owned) {
4857 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4858 CHECK(!owner->result_ok);
4859 return DecodeError_clone(&*owner->contents.err);
4861 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint32_t owner) {
4862 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4863 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4864 uint32_t ret_ref = 0;
4865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4868 ret_ref = (uintptr_t)ret_var.inner;
4869 if (ret_var.is_owned) {
4875 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4876 CHECK(owner->result_ok);
4877 return ChannelCounterparty_clone(&*owner->contents.result);
4879 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint32_t owner) {
4880 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4881 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4882 uint32_t ret_ref = 0;
4883 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4884 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4886 ret_ref = (uintptr_t)ret_var.inner;
4887 if (ret_var.is_owned) {
4893 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4894 CHECK(!owner->result_ok);
4895 return DecodeError_clone(&*owner->contents.err);
4897 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint32_t owner) {
4898 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4899 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4900 uint32_t ret_ref = 0;
4901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4904 ret_ref = (uintptr_t)ret_var.inner;
4905 if (ret_var.is_owned) {
4911 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4912 CHECK(owner->result_ok);
4913 return ChannelDetails_clone(&*owner->contents.result);
4915 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint32_t owner) {
4916 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4917 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4918 uint32_t ret_ref = 0;
4919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4922 ret_ref = (uintptr_t)ret_var.inner;
4923 if (ret_var.is_owned) {
4929 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4930 CHECK(!owner->result_ok);
4931 return DecodeError_clone(&*owner->contents.err);
4933 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint32_t owner) {
4934 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4935 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4936 uint32_t ret_ref = 0;
4937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4940 ret_ref = (uintptr_t)ret_var.inner;
4941 if (ret_var.is_owned) {
4947 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4948 CHECK(owner->result_ok);
4949 return PhantomRouteHints_clone(&*owner->contents.result);
4951 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint32_t owner) {
4952 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4953 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4954 uint32_t ret_ref = 0;
4955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4958 ret_ref = (uintptr_t)ret_var.inner;
4959 if (ret_var.is_owned) {
4965 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4966 CHECK(!owner->result_ok);
4967 return DecodeError_clone(&*owner->contents.err);
4969 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint32_t owner) {
4970 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4971 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4972 uint32_t ret_ref = 0;
4973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4976 ret_ref = (uintptr_t)ret_var.inner;
4977 if (ret_var.is_owned) {
4983 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4984 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4985 for (size_t i = 0; i < ret.datalen; i++) {
4986 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4990 typedef struct LDKWatch_JCalls {
4991 atomic_size_t refcnt;
4992 uint32_t instance_ptr;
4994 static void LDKWatch_JCalls_free(void* this_arg) {
4995 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4996 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5000 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5001 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5002 LDKOutPoint funding_txo_var = funding_txo;
5003 uint32_t funding_txo_ref = 0;
5004 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5005 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5006 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5007 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5008 if (funding_txo_var.is_owned) {
5009 funding_txo_ref |= 1;
5011 LDKChannelMonitor monitor_var = monitor;
5012 uint32_t monitor_ref = 0;
5013 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5014 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5015 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5016 monitor_ref = (uintptr_t)monitor_var.inner;
5017 if (monitor_var.is_owned) {
5020 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 16, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
5021 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5022 CHECK_ACCESS(ret_ptr);
5023 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5027 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5028 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5029 LDKOutPoint funding_txo_var = funding_txo;
5030 uint32_t funding_txo_ref = 0;
5031 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5032 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5033 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5034 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5035 if (funding_txo_var.is_owned) {
5036 funding_txo_ref |= 1;
5038 LDKChannelMonitorUpdate update_var = update;
5039 uint32_t update_ref = 0;
5040 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5043 update_ref = (uintptr_t)update_var.inner;
5044 if (update_var.is_owned) {
5047 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 17, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
5048 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5049 CHECK_ACCESS(ret_ptr);
5050 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5054 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5055 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5056 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 18);
5057 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr;
5058 ret_constr.datalen = ret->arr_len;
5059 if (ret_constr.datalen > 0)
5060 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
5062 ret_constr.data = NULL;
5063 uint32_t* ret_vals = ret->elems;
5064 for (size_t m = 0; m < ret_constr.datalen; m++) {
5065 uint32_t ret_conv_38 = ret_vals[m];
5066 void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1);
5067 CHECK_ACCESS(ret_conv_38_ptr);
5068 LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr);
5069 FREE((void*)ret_conv_38);
5070 ret_constr.data[m] = ret_conv_38_conv;
5075 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5076 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5079 static inline LDKWatch LDKWatch_init (JSValue o) {
5080 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5081 atomic_init(&calls->refcnt, 1);
5082 calls->instance_ptr = o;
5085 .this_arg = (void*) calls,
5086 .watch_channel = watch_channel_LDKWatch_jcall,
5087 .update_channel = update_channel_LDKWatch_jcall,
5088 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5089 .free = LDKWatch_JCalls_free,
5093 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5094 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5095 *res_ptr = LDKWatch_init(o);
5096 return (long)res_ptr;
5098 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5099 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5100 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5101 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5102 LDKOutPoint funding_txo_conv;
5103 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5104 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5105 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5106 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5107 LDKChannelMonitor monitor_conv;
5108 monitor_conv.inner = (void*)(monitor & (~1));
5109 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5110 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5111 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5112 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5113 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5114 return (uint32_t)ret_conv;
5117 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5118 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5119 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5120 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5121 LDKOutPoint funding_txo_conv;
5122 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5123 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5124 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5125 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5126 LDKChannelMonitorUpdate update_conv;
5127 update_conv.inner = (void*)(update & (~1));
5128 update_conv.is_owned = (update & 1) || (update == 0);
5129 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5130 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5131 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5132 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5133 return (uint32_t)ret_conv;
5136 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5137 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5138 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5139 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5140 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5141 uint32_tArray ret_arr = NULL;
5142 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5143 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5144 for (size_t m = 0; m < ret_var.datalen; m++) {
5145 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
5146 *ret_conv_38_conv = ret_var.data[m];
5147 ret_arr_ptr[m] = ((uint32_t)ret_conv_38_conv);
5154 typedef struct LDKBroadcasterInterface_JCalls {
5155 atomic_size_t refcnt;
5156 uint32_t instance_ptr;
5157 } LDKBroadcasterInterface_JCalls;
5158 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5159 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5160 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5164 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5165 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5166 LDKTransaction tx_var = tx;
5167 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5168 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5169 Transaction_free(tx_var);
5170 js_invoke_function_u_u(j_calls->instance_ptr, 19, (uint32_t)tx_arr);
5172 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5173 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5174 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5176 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5177 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5178 atomic_init(&calls->refcnt, 1);
5179 calls->instance_ptr = o;
5181 LDKBroadcasterInterface ret = {
5182 .this_arg = (void*) calls,
5183 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5184 .free = LDKBroadcasterInterface_JCalls_free,
5188 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5189 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5190 *res_ptr = LDKBroadcasterInterface_init(o);
5191 return (long)res_ptr;
5193 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
5194 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5195 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5196 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5197 LDKTransaction tx_ref;
5198 tx_ref.datalen = tx->arr_len;
5199 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5200 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5201 tx_ref.data_is_owned = true;
5202 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5205 typedef struct LDKKeysInterface_JCalls {
5206 atomic_size_t refcnt;
5207 uint32_t instance_ptr;
5208 } LDKKeysInterface_JCalls;
5209 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5210 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5211 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5215 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5216 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5217 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5218 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 20, (uint32_t)recipient_conv);
5219 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5220 CHECK_ACCESS(ret_ptr);
5221 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5225 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5226 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5227 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 21);
5228 LDKCVec_u8Z ret_ref;
5229 ret_ref.datalen = ret->arr_len;
5230 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5231 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5234 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5235 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5236 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 22);
5237 LDKShutdownScript ret_conv;
5238 ret_conv.inner = (void*)(ret & (~1));
5239 ret_conv.is_owned = (ret & 1) || (ret == 0);
5240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5243 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5244 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5245 jboolean inbound_conv = inbound;
5246 int64_t channel_value_satoshis_conv = channel_value_satoshis;
5247 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 23, (uint32_t)inbound_conv, (uint32_t)channel_value_satoshis_conv);
5248 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5249 CHECK_ACCESS(ret_ptr);
5250 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5254 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5255 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5256 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 24);
5257 LDKThirtyTwoBytes ret_ref;
5258 CHECK(ret->arr_len == 32);
5259 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5262 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5263 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5264 LDKu8slice reader_var = reader;
5265 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5266 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5267 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 25, (uint32_t)reader_arr);
5268 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5269 CHECK_ACCESS(ret_ptr);
5270 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5274 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5275 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5276 LDKu8slice hrp_bytes_var = hrp_bytes;
5277 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5278 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5279 LDKCVec_u5Z invoice_data_var = invoice_data;
5280 ptrArray invoice_data_arr = NULL;
5281 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5282 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
5283 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5284 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5285 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5288 FREE(invoice_data_var.data);
5289 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5290 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 26, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, (uint32_t)receipient_conv);
5291 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5292 CHECK_ACCESS(ret_ptr);
5293 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5297 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5298 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5299 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 27);
5300 LDKThirtyTwoBytes ret_ref;
5301 CHECK(ret->arr_len == 32);
5302 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5305 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5306 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5307 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5309 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5310 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5311 atomic_init(&calls->refcnt, 1);
5312 calls->instance_ptr = o;
5314 LDKKeysInterface ret = {
5315 .this_arg = (void*) calls,
5316 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5317 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5318 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5319 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5320 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5321 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5322 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5323 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5324 .free = LDKKeysInterface_JCalls_free,
5328 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5329 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5330 *res_ptr = LDKKeysInterface_init(o);
5331 return (long)res_ptr;
5333 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
5334 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5335 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5336 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5337 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5338 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5339 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5340 return (uint32_t)ret_conv;
5343 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
5344 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5345 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5346 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5347 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5348 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5349 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5350 CVec_u8Z_free(ret_var);
5354 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
5355 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5357 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5358 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5359 uint32_t ret_ref = 0;
5360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5363 ret_ref = (uintptr_t)ret_var.inner;
5364 if (ret_var.is_owned) {
5370 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) {
5371 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5373 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5374 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5375 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5376 return (uint32_t)ret_ret;
5379 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
5380 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5381 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5382 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5383 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5384 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5388 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
5389 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5390 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5391 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5392 LDKu8slice reader_ref;
5393 reader_ref.datalen = reader->arr_len;
5394 reader_ref.data = reader->elems;
5395 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5396 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5398 return (uint32_t)ret_conv;
5401 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) {
5402 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5403 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5404 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5405 LDKu8slice hrp_bytes_ref;
5406 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5407 hrp_bytes_ref.data = hrp_bytes->elems;
5408 LDKCVec_u5Z invoice_data_constr;
5409 invoice_data_constr.datalen = invoice_data->arr_len;
5410 if (invoice_data_constr.datalen > 0)
5411 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5413 invoice_data_constr.data = NULL;
5414 int8_t* invoice_data_vals = (void*) invoice_data->elems;
5415 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5416 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5418 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5421 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5422 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5423 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5425 return (uint32_t)ret_conv;
5428 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
5429 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5430 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5431 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5432 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5433 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5437 typedef struct LDKFeeEstimator_JCalls {
5438 atomic_size_t refcnt;
5439 uint32_t instance_ptr;
5440 } LDKFeeEstimator_JCalls;
5441 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5442 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5443 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5447 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5448 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5449 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5450 return js_invoke_function_u_u(j_calls->instance_ptr, 28, (uint32_t)confirmation_target_conv);
5452 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5453 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5454 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5456 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5457 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5458 atomic_init(&calls->refcnt, 1);
5459 calls->instance_ptr = o;
5461 LDKFeeEstimator ret = {
5462 .this_arg = (void*) calls,
5463 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5464 .free = LDKFeeEstimator_JCalls_free,
5468 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5469 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5470 *res_ptr = LDKFeeEstimator_init(o);
5471 return (long)res_ptr;
5473 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) {
5474 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5475 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5476 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5477 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5478 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5482 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5483 return ThirtyTwoBytes_clone(&owner->a);
5485 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
5486 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5487 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5488 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5492 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5495 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
5496 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5497 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5498 uint32_t ret_ref = 0;
5499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5502 ret_ref = (uintptr_t)ret_var.inner & ~1;
5506 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5507 CHECK(owner->result_ok);
5508 return &*owner->contents.result;
5510 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
5511 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5512 uint32_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
5516 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5517 CHECK(!owner->result_ok);
5518 return DecodeError_clone(&*owner->contents.err);
5520 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
5521 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5522 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5523 uint32_t ret_ref = 0;
5524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5527 ret_ref = (uintptr_t)ret_var.inner;
5528 if (ret_var.is_owned) {
5534 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5535 CHECK(owner->result_ok);
5536 return ChannelConfig_clone(&*owner->contents.result);
5538 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
5539 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5540 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5541 uint32_t ret_ref = 0;
5542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5545 ret_ref = (uintptr_t)ret_var.inner;
5546 if (ret_var.is_owned) {
5552 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5553 CHECK(!owner->result_ok);
5554 return DecodeError_clone(&*owner->contents.err);
5556 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
5557 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5558 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5559 uint32_t ret_ref = 0;
5560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5563 ret_ref = (uintptr_t)ret_var.inner;
5564 if (ret_var.is_owned) {
5570 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5571 CHECK(owner->result_ok);
5572 return OutPoint_clone(&*owner->contents.result);
5574 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
5575 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5576 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5577 uint32_t ret_ref = 0;
5578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5581 ret_ref = (uintptr_t)ret_var.inner;
5582 if (ret_var.is_owned) {
5588 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5589 CHECK(!owner->result_ok);
5590 return DecodeError_clone(&*owner->contents.err);
5592 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
5593 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5594 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5595 uint32_t ret_ref = 0;
5596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5599 ret_ref = (uintptr_t)ret_var.inner;
5600 if (ret_var.is_owned) {
5606 typedef struct LDKType_JCalls {
5607 atomic_size_t refcnt;
5608 uint32_t instance_ptr;
5610 static void LDKType_JCalls_free(void* this_arg) {
5611 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5612 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5616 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5617 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5618 return js_invoke_function_u_(j_calls->instance_ptr, 29);
5620 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5621 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5622 jstring ret = (jstring)js_invoke_function_u_(j_calls->instance_ptr, 30);
5623 LDKStr ret_conv = str_ref_to_owned_c(ret);
5626 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5627 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5628 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 31);
5629 LDKCVec_u8Z ret_ref;
5630 ret_ref.datalen = ret->arr_len;
5631 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5632 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5635 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5636 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5637 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5639 static inline LDKType LDKType_init (JSValue o) {
5640 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5641 atomic_init(&calls->refcnt, 1);
5642 calls->instance_ptr = o;
5645 .this_arg = (void*) calls,
5646 .type_id = type_id_LDKType_jcall,
5647 .debug_str = debug_str_LDKType_jcall,
5648 .write = write_LDKType_jcall,
5649 .cloned = LDKType_JCalls_cloned,
5650 .free = LDKType_JCalls_free,
5654 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5655 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5656 *res_ptr = LDKType_init(o);
5657 return (long)res_ptr;
5659 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
5660 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5661 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5662 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5663 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5667 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
5668 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5669 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5670 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5671 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5672 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5677 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
5678 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5679 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5680 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5681 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5682 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5683 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5684 CVec_u8Z_free(ret_var);
5688 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5689 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5691 case LDKCOption_TypeZ_Some: return 0;
5692 case LDKCOption_TypeZ_None: return 1;
5696 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5697 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5698 assert(obj->tag == LDKCOption_TypeZ_Some);
5699 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5700 *some_ret = Type_clone(&obj->some);
5701 return (uint32_t)some_ret;
5703 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5704 CHECK(owner->result_ok);
5705 return COption_TypeZ_clone(&*owner->contents.result);
5707 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5708 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5709 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5710 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5711 uint32_t ret_ref = (uintptr_t)ret_copy;
5715 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5716 CHECK(!owner->result_ok);
5717 return DecodeError_clone(&*owner->contents.err);
5719 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
5720 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5721 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5722 uint32_t ret_ref = 0;
5723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5726 ret_ref = (uintptr_t)ret_var.inner;
5727 if (ret_var.is_owned) {
5733 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
5734 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5736 case LDKPaymentError_Invoice: return 0;
5737 case LDKPaymentError_Routing: return 1;
5738 case LDKPaymentError_Sending: return 2;
5742 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
5743 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5744 assert(obj->tag == LDKPaymentError_Invoice);
5745 LDKStr invoice_str = obj->invoice;
5746 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5747 return invoice_conv;
5749 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
5750 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5751 assert(obj->tag == LDKPaymentError_Routing);
5752 LDKLightningError routing_var = obj->routing;
5753 uint32_t routing_ref = 0;
5754 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5755 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5756 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5757 routing_ref = (uintptr_t)routing_var.inner & ~1;
5760 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
5761 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5762 assert(obj->tag == LDKPaymentError_Sending);
5763 uint32_t sending_ref = ((uintptr_t)&obj->sending) | 1;
5766 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5767 CHECK(owner->result_ok);
5768 return ThirtyTwoBytes_clone(&*owner->contents.result);
5770 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
5771 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5772 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5773 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5777 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5778 CHECK(!owner->result_ok);
5779 return PaymentError_clone(&*owner->contents.err);
5781 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
5782 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5783 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5784 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5785 uint32_t ret_ref = (uintptr_t)ret_copy;
5789 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint32_t ptr) {
5790 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5792 case LDKParseError_Bech32Error: return 0;
5793 case LDKParseError_ParseAmountError: return 1;
5794 case LDKParseError_MalformedSignature: return 2;
5795 case LDKParseError_BadPrefix: return 3;
5796 case LDKParseError_UnknownCurrency: return 4;
5797 case LDKParseError_UnknownSiPrefix: return 5;
5798 case LDKParseError_MalformedHRP: return 6;
5799 case LDKParseError_TooShortDataPart: return 7;
5800 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5801 case LDKParseError_DescriptionDecodeError: return 9;
5802 case LDKParseError_PaddingError: return 10;
5803 case LDKParseError_IntegerOverflowError: return 11;
5804 case LDKParseError_InvalidSegWitProgramLength: return 12;
5805 case LDKParseError_InvalidPubKeyHashLength: return 13;
5806 case LDKParseError_InvalidScriptHashLength: return 14;
5807 case LDKParseError_InvalidRecoveryId: return 15;
5808 case LDKParseError_InvalidSliceLength: return 16;
5809 case LDKParseError_Skip: return 17;
5813 uint32_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint32_t ptr) {
5814 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5815 assert(obj->tag == LDKParseError_Bech32Error);
5816 uint32_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
5817 return bech32_error_ref;
5819 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint32_t ptr) {
5820 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5821 assert(obj->tag == LDKParseError_ParseAmountError);
5822 /*obj->parse_amount_error*/
5825 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint32_t ptr) {
5826 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5827 assert(obj->tag == LDKParseError_MalformedSignature);
5828 uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5829 return malformed_signature_conv;
5831 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint32_t ptr) {
5832 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5833 assert(obj->tag == LDKParseError_DescriptionDecodeError);
5834 /*obj->description_decode_error*/
5837 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint32_t ptr) {
5838 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5839 assert(obj->tag == LDKParseError_InvalidSliceLength);
5840 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5841 jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5842 return invalid_slice_length_conv;
5844 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5845 CHECK(owner->result_ok);
5846 return SiPrefix_clone(&*owner->contents.result);
5848 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint32_t owner) {
5849 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5850 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5854 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5855 CHECK(!owner->result_ok);
5856 return ParseError_clone(&*owner->contents.err);
5858 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint32_t owner) {
5859 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5860 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5861 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5862 uint32_t ret_ref = (uintptr_t)ret_copy;
5866 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint32_t ptr) {
5867 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5869 case LDKParseOrSemanticError_ParseError: return 0;
5870 case LDKParseOrSemanticError_SemanticError: return 1;
5874 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint32_t ptr) {
5875 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5876 assert(obj->tag == LDKParseOrSemanticError_ParseError);
5877 uint32_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
5878 return parse_error_ref;
5880 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint32_t ptr) {
5881 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5882 assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5883 uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5884 return semantic_error_conv;
5886 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5887 CHECK(owner->result_ok);
5888 return Invoice_clone(&*owner->contents.result);
5890 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint32_t owner) {
5891 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5892 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5893 uint32_t ret_ref = 0;
5894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5897 ret_ref = (uintptr_t)ret_var.inner;
5898 if (ret_var.is_owned) {
5904 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5905 CHECK(!owner->result_ok);
5906 return ParseOrSemanticError_clone(&*owner->contents.err);
5908 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint32_t owner) {
5909 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5910 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5911 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5912 uint32_t ret_ref = (uintptr_t)ret_copy;
5916 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5917 CHECK(owner->result_ok);
5918 return SignedRawInvoice_clone(&*owner->contents.result);
5920 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint32_t owner) {
5921 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5922 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5923 uint32_t ret_ref = 0;
5924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5927 ret_ref = (uintptr_t)ret_var.inner;
5928 if (ret_var.is_owned) {
5934 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5935 CHECK(!owner->result_ok);
5936 return ParseError_clone(&*owner->contents.err);
5938 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint32_t owner) {
5939 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5940 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5941 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5942 uint32_t ret_ref = (uintptr_t)ret_copy;
5946 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5947 return RawInvoice_clone(&owner->a);
5949 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
5950 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5951 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5952 uint32_t ret_ref = 0;
5953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5956 ret_ref = (uintptr_t)ret_var.inner;
5957 if (ret_var.is_owned) {
5963 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5964 return ThirtyTwoBytes_clone(&owner->b);
5966 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
5967 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5968 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5969 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5973 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5974 return InvoiceSignature_clone(&owner->c);
5976 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
5977 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5978 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5979 uint32_t ret_ref = 0;
5980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5983 ret_ref = (uintptr_t)ret_var.inner;
5984 if (ret_var.is_owned) {
5990 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5991 CHECK(owner->result_ok);
5992 return PayeePubKey_clone(&*owner->contents.result);
5994 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
5995 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5996 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5997 uint32_t ret_ref = 0;
5998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6001 ret_ref = (uintptr_t)ret_var.inner;
6002 if (ret_var.is_owned) {
6008 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6009 CHECK(!owner->result_ok);
6010 return *owner->contents.err;
6012 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
6013 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6014 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6018 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6019 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6020 for (size_t i = 0; i < ret.datalen; i++) {
6021 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6025 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6026 CHECK(owner->result_ok);
6027 return PositiveTimestamp_clone(&*owner->contents.result);
6029 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
6030 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6031 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6032 uint32_t ret_ref = 0;
6033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6036 ret_ref = (uintptr_t)ret_var.inner;
6037 if (ret_var.is_owned) {
6043 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6044 CHECK(!owner->result_ok);
6045 return CreationError_clone(&*owner->contents.err);
6047 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
6048 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6049 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6053 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6054 CHECK(owner->result_ok);
6055 return *owner->contents.result;
6057 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
6058 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6059 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6062 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6063 CHECK(!owner->result_ok);
6064 return SemanticError_clone(&*owner->contents.err);
6066 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
6067 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6068 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6072 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6073 CHECK(owner->result_ok);
6074 return Invoice_clone(&*owner->contents.result);
6076 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
6077 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6078 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6079 uint32_t ret_ref = 0;
6080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6083 ret_ref = (uintptr_t)ret_var.inner;
6084 if (ret_var.is_owned) {
6090 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6091 CHECK(!owner->result_ok);
6092 return SemanticError_clone(&*owner->contents.err);
6094 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
6095 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6096 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6100 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6101 CHECK(owner->result_ok);
6102 return Description_clone(&*owner->contents.result);
6104 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
6105 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6106 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6107 uint32_t ret_ref = 0;
6108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6111 ret_ref = (uintptr_t)ret_var.inner;
6112 if (ret_var.is_owned) {
6118 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6119 CHECK(!owner->result_ok);
6120 return CreationError_clone(&*owner->contents.err);
6122 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
6123 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6124 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6128 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6129 CHECK(owner->result_ok);
6130 return PrivateRoute_clone(&*owner->contents.result);
6132 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
6133 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6134 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6135 uint32_t ret_ref = 0;
6136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6139 ret_ref = (uintptr_t)ret_var.inner;
6140 if (ret_var.is_owned) {
6146 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6147 CHECK(!owner->result_ok);
6148 return CreationError_clone(&*owner->contents.err);
6150 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
6151 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6152 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6156 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6157 CHECK(owner->result_ok);
6158 return *owner->contents.result;
6160 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
6161 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6162 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6163 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6167 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6168 CHECK(!owner->result_ok);
6169 return *owner->contents.err;
6171 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
6172 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6173 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6177 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6178 CHECK(owner->result_ok);
6179 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6181 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6182 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6183 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6184 uint32_t ret_ref = 0;
6185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6188 ret_ref = (uintptr_t)ret_var.inner;
6189 if (ret_var.is_owned) {
6195 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6196 CHECK(!owner->result_ok);
6197 return DecodeError_clone(&*owner->contents.err);
6199 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
6200 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6201 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6202 uint32_t ret_ref = 0;
6203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6206 ret_ref = (uintptr_t)ret_var.inner;
6207 if (ret_var.is_owned) {
6213 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
6214 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6216 case LDKCOption_MonitorEventZ_Some: return 0;
6217 case LDKCOption_MonitorEventZ_None: return 1;
6221 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
6222 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6223 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6224 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6227 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6228 CHECK(owner->result_ok);
6229 return COption_MonitorEventZ_clone(&*owner->contents.result);
6231 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
6232 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6233 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6234 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6235 uint32_t ret_ref = (uintptr_t)ret_copy;
6239 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6240 CHECK(!owner->result_ok);
6241 return DecodeError_clone(&*owner->contents.err);
6243 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
6244 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6245 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6246 uint32_t ret_ref = 0;
6247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6250 ret_ref = (uintptr_t)ret_var.inner;
6251 if (ret_var.is_owned) {
6257 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6258 CHECK(owner->result_ok);
6259 return HTLCUpdate_clone(&*owner->contents.result);
6261 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6262 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6263 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6264 uint32_t ret_ref = 0;
6265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6268 ret_ref = (uintptr_t)ret_var.inner;
6269 if (ret_var.is_owned) {
6275 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6276 CHECK(!owner->result_ok);
6277 return DecodeError_clone(&*owner->contents.err);
6279 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
6280 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6281 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6282 uint32_t ret_ref = 0;
6283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6286 ret_ref = (uintptr_t)ret_var.inner;
6287 if (ret_var.is_owned) {
6293 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6294 return OutPoint_clone(&owner->a);
6296 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
6297 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6298 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6299 uint32_t ret_ref = 0;
6300 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6301 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6303 ret_ref = (uintptr_t)ret_var.inner;
6304 if (ret_var.is_owned) {
6310 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6311 return CVec_u8Z_clone(&owner->b);
6313 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
6314 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6315 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6316 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6317 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6318 CVec_u8Z_free(ret_var);
6322 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6325 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
6326 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6327 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6331 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6332 return CVec_u8Z_clone(&owner->b);
6334 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
6335 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6336 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6337 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6338 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6339 CVec_u8Z_free(ret_var);
6343 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6344 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6345 for (size_t i = 0; i < ret.datalen; i++) {
6346 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6350 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6351 return ThirtyTwoBytes_clone(&owner->a);
6353 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
6354 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6355 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6356 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6360 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6361 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6363 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
6364 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6365 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6366 uint32_tArray ret_arr = NULL;
6367 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6368 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6369 for (size_t v = 0; v < ret_var.datalen; v++) {
6370 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6371 *ret_conv_21_conv = ret_var.data[v];
6372 ret_arr_ptr[v] = ((uint32_t)ret_conv_21_conv);
6379 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6380 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 };
6381 for (size_t i = 0; i < ret.datalen; i++) {
6382 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6386 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6387 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6388 for (size_t i = 0; i < ret.datalen; i++) {
6389 ret.data[i] = Event_clone(&orig->data[i]);
6393 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6396 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
6397 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6398 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6402 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6403 return TxOut_clone(&owner->b);
6405 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
6406 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6407 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6408 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6409 return (uint32_t)ret_ref;
6412 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6413 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6414 for (size_t i = 0; i < ret.datalen; i++) {
6415 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6419 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6420 return ThirtyTwoBytes_clone(&owner->a);
6422 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
6423 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6424 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6425 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6429 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6430 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6432 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
6433 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6434 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6435 uint32_tArray ret_arr = NULL;
6436 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6437 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6438 for (size_t u = 0; u < ret_var.datalen; u++) {
6439 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6440 *ret_conv_20_conv = ret_var.data[u];
6441 ret_arr_ptr[u] = ((uint32_t)ret_conv_20_conv);
6448 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6449 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 };
6450 for (size_t i = 0; i < ret.datalen; i++) {
6451 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6455 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
6456 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6458 case LDKBalance_ClaimableOnChannelClose: return 0;
6459 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6460 case LDKBalance_ContentiousClaimable: return 2;
6461 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6465 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
6466 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6467 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6468 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6469 return claimable_amount_satoshis_conv;
6471 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
6472 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6473 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6474 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6475 return claimable_amount_satoshis_conv;
6477 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
6478 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6479 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6480 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6481 return confirmation_height_conv;
6483 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
6484 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6485 assert(obj->tag == LDKBalance_ContentiousClaimable);
6486 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6487 return claimable_amount_satoshis_conv;
6489 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
6490 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6491 assert(obj->tag == LDKBalance_ContentiousClaimable);
6492 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6493 return timeout_height_conv;
6495 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
6496 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6497 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6498 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6499 return claimable_amount_satoshis_conv;
6501 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
6502 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6503 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6504 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6505 return claimable_height_conv;
6507 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6508 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6509 for (size_t i = 0; i < ret.datalen; i++) {
6510 ret.data[i] = Balance_clone(&orig->data[i]);
6514 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6515 return ThirtyTwoBytes_clone(&owner->a);
6517 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
6518 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6519 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6520 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6524 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6525 return ChannelMonitor_clone(&owner->b);
6527 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
6528 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6529 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6530 uint32_t ret_ref = 0;
6531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6534 ret_ref = (uintptr_t)ret_var.inner;
6535 if (ret_var.is_owned) {
6541 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6542 CHECK(owner->result_ok);
6543 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6545 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
6546 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6547 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6548 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6549 return ((uint32_t)ret_conv);
6552 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6553 CHECK(!owner->result_ok);
6554 return DecodeError_clone(&*owner->contents.err);
6556 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
6557 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6558 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6559 uint32_t ret_ref = 0;
6560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6563 ret_ref = (uintptr_t)ret_var.inner;
6564 if (ret_var.is_owned) {
6570 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6573 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
6574 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6575 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6576 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6580 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6581 return Type_clone(&owner->b);
6583 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
6584 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6585 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6586 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6587 return (uint32_t)ret_ret;
6590 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6591 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6592 for (size_t i = 0; i < ret.datalen; i++) {
6593 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6597 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint32_t ptr) {
6598 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6600 case LDKCOption_NetAddressZ_Some: return 0;
6601 case LDKCOption_NetAddressZ_None: return 1;
6605 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint32_t ptr) {
6606 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6607 assert(obj->tag == LDKCOption_NetAddressZ_Some);
6608 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6611 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6612 CHECK(owner->result_ok);
6613 return CVec_u8Z_clone(&*owner->contents.result);
6615 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
6616 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6617 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6618 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6619 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6620 CVec_u8Z_free(ret_var);
6624 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6625 CHECK(!owner->result_ok);
6626 return PeerHandleError_clone(&*owner->contents.err);
6628 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
6629 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6630 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6631 uint32_t ret_ref = 0;
6632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6635 ret_ref = (uintptr_t)ret_var.inner;
6636 if (ret_var.is_owned) {
6642 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6643 CHECK(owner->result_ok);
6644 return *owner->contents.result;
6646 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
6647 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6648 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6651 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6652 CHECK(!owner->result_ok);
6653 return PeerHandleError_clone(&*owner->contents.err);
6655 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
6656 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6657 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6658 uint32_t ret_ref = 0;
6659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6662 ret_ref = (uintptr_t)ret_var.inner;
6663 if (ret_var.is_owned) {
6669 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6670 CHECK(owner->result_ok);
6671 return *owner->contents.result;
6673 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6674 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6675 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6679 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6680 CHECK(!owner->result_ok);
6681 return PeerHandleError_clone(&*owner->contents.err);
6683 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6684 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6685 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6686 uint32_t ret_ref = 0;
6687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6690 ret_ref = (uintptr_t)ret_var.inner;
6691 if (ret_var.is_owned) {
6697 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6698 CHECK(owner->result_ok);
6699 return *owner->contents.result;
6701 void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint32_t owner) {
6702 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6703 CResult_NoneErrorZ_get_ok(owner_conv);
6706 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6707 CHECK(!owner->result_ok);
6708 return *owner->contents.err;
6710 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint32_t owner) {
6711 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6712 uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6716 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6717 CHECK(owner->result_ok);
6718 return NetAddress_clone(&*owner->contents.result);
6720 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
6721 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6722 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6723 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6724 uint32_t ret_ref = (uintptr_t)ret_copy;
6728 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6729 CHECK(!owner->result_ok);
6730 return DecodeError_clone(&*owner->contents.err);
6732 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
6733 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6734 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6735 uint32_t ret_ref = 0;
6736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6739 ret_ref = (uintptr_t)ret_var.inner;
6740 if (ret_var.is_owned) {
6746 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6747 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6748 for (size_t i = 0; i < ret.datalen; i++) {
6749 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6753 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6754 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6755 for (size_t i = 0; i < ret.datalen; i++) {
6756 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6760 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6761 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6762 for (size_t i = 0; i < ret.datalen; i++) {
6763 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6767 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6768 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6769 for (size_t i = 0; i < ret.datalen; i++) {
6770 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6774 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6775 CHECK(owner->result_ok);
6776 return AcceptChannel_clone(&*owner->contents.result);
6778 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
6779 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6780 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6781 uint32_t ret_ref = 0;
6782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6785 ret_ref = (uintptr_t)ret_var.inner;
6786 if (ret_var.is_owned) {
6792 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6793 CHECK(!owner->result_ok);
6794 return DecodeError_clone(&*owner->contents.err);
6796 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
6797 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6798 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6799 uint32_t ret_ref = 0;
6800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6803 ret_ref = (uintptr_t)ret_var.inner;
6804 if (ret_var.is_owned) {
6810 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6811 CHECK(owner->result_ok);
6812 return AnnouncementSignatures_clone(&*owner->contents.result);
6814 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
6815 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6816 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6817 uint32_t ret_ref = 0;
6818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6821 ret_ref = (uintptr_t)ret_var.inner;
6822 if (ret_var.is_owned) {
6828 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6829 CHECK(!owner->result_ok);
6830 return DecodeError_clone(&*owner->contents.err);
6832 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
6833 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6834 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6835 uint32_t ret_ref = 0;
6836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6839 ret_ref = (uintptr_t)ret_var.inner;
6840 if (ret_var.is_owned) {
6846 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6847 CHECK(owner->result_ok);
6848 return ChannelReestablish_clone(&*owner->contents.result);
6850 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
6851 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6852 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6853 uint32_t ret_ref = 0;
6854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6857 ret_ref = (uintptr_t)ret_var.inner;
6858 if (ret_var.is_owned) {
6864 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6865 CHECK(!owner->result_ok);
6866 return DecodeError_clone(&*owner->contents.err);
6868 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
6869 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6870 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6871 uint32_t ret_ref = 0;
6872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6875 ret_ref = (uintptr_t)ret_var.inner;
6876 if (ret_var.is_owned) {
6882 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6883 CHECK(owner->result_ok);
6884 return ClosingSigned_clone(&*owner->contents.result);
6886 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6887 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6888 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6889 uint32_t ret_ref = 0;
6890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6893 ret_ref = (uintptr_t)ret_var.inner;
6894 if (ret_var.is_owned) {
6900 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6901 CHECK(!owner->result_ok);
6902 return DecodeError_clone(&*owner->contents.err);
6904 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
6905 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6906 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6907 uint32_t ret_ref = 0;
6908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6911 ret_ref = (uintptr_t)ret_var.inner;
6912 if (ret_var.is_owned) {
6918 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6919 CHECK(owner->result_ok);
6920 return ClosingSignedFeeRange_clone(&*owner->contents.result);
6922 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
6923 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6924 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6925 uint32_t ret_ref = 0;
6926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6929 ret_ref = (uintptr_t)ret_var.inner;
6930 if (ret_var.is_owned) {
6936 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6937 CHECK(!owner->result_ok);
6938 return DecodeError_clone(&*owner->contents.err);
6940 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
6941 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6942 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6943 uint32_t ret_ref = 0;
6944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6947 ret_ref = (uintptr_t)ret_var.inner;
6948 if (ret_var.is_owned) {
6954 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6955 CHECK(owner->result_ok);
6956 return CommitmentSigned_clone(&*owner->contents.result);
6958 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
6959 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6960 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6961 uint32_t ret_ref = 0;
6962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6965 ret_ref = (uintptr_t)ret_var.inner;
6966 if (ret_var.is_owned) {
6972 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6973 CHECK(!owner->result_ok);
6974 return DecodeError_clone(&*owner->contents.err);
6976 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
6977 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6978 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6979 uint32_t ret_ref = 0;
6980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6983 ret_ref = (uintptr_t)ret_var.inner;
6984 if (ret_var.is_owned) {
6990 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6991 CHECK(owner->result_ok);
6992 return FundingCreated_clone(&*owner->contents.result);
6994 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
6995 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6996 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6997 uint32_t ret_ref = 0;
6998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7001 ret_ref = (uintptr_t)ret_var.inner;
7002 if (ret_var.is_owned) {
7008 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7009 CHECK(!owner->result_ok);
7010 return DecodeError_clone(&*owner->contents.err);
7012 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
7013 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7014 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7015 uint32_t ret_ref = 0;
7016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7019 ret_ref = (uintptr_t)ret_var.inner;
7020 if (ret_var.is_owned) {
7026 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7027 CHECK(owner->result_ok);
7028 return FundingSigned_clone(&*owner->contents.result);
7030 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
7031 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7032 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7033 uint32_t ret_ref = 0;
7034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7037 ret_ref = (uintptr_t)ret_var.inner;
7038 if (ret_var.is_owned) {
7044 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7045 CHECK(!owner->result_ok);
7046 return DecodeError_clone(&*owner->contents.err);
7048 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
7049 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7050 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7051 uint32_t ret_ref = 0;
7052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7055 ret_ref = (uintptr_t)ret_var.inner;
7056 if (ret_var.is_owned) {
7062 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7063 CHECK(owner->result_ok);
7064 return ChannelReady_clone(&*owner->contents.result);
7066 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint32_t owner) {
7067 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7068 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7069 uint32_t ret_ref = 0;
7070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7073 ret_ref = (uintptr_t)ret_var.inner;
7074 if (ret_var.is_owned) {
7080 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7081 CHECK(!owner->result_ok);
7082 return DecodeError_clone(&*owner->contents.err);
7084 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint32_t owner) {
7085 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7086 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7087 uint32_t ret_ref = 0;
7088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7091 ret_ref = (uintptr_t)ret_var.inner;
7092 if (ret_var.is_owned) {
7098 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7099 CHECK(owner->result_ok);
7100 return Init_clone(&*owner->contents.result);
7102 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
7103 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7104 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7105 uint32_t ret_ref = 0;
7106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7109 ret_ref = (uintptr_t)ret_var.inner;
7110 if (ret_var.is_owned) {
7116 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7117 CHECK(!owner->result_ok);
7118 return DecodeError_clone(&*owner->contents.err);
7120 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
7121 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7122 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7123 uint32_t ret_ref = 0;
7124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7127 ret_ref = (uintptr_t)ret_var.inner;
7128 if (ret_var.is_owned) {
7134 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7135 CHECK(owner->result_ok);
7136 return OpenChannel_clone(&*owner->contents.result);
7138 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
7139 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7140 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7141 uint32_t ret_ref = 0;
7142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7145 ret_ref = (uintptr_t)ret_var.inner;
7146 if (ret_var.is_owned) {
7152 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7153 CHECK(!owner->result_ok);
7154 return DecodeError_clone(&*owner->contents.err);
7156 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
7157 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7158 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7159 uint32_t ret_ref = 0;
7160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7163 ret_ref = (uintptr_t)ret_var.inner;
7164 if (ret_var.is_owned) {
7170 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7171 CHECK(owner->result_ok);
7172 return RevokeAndACK_clone(&*owner->contents.result);
7174 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
7175 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7176 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7177 uint32_t ret_ref = 0;
7178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7181 ret_ref = (uintptr_t)ret_var.inner;
7182 if (ret_var.is_owned) {
7188 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7189 CHECK(!owner->result_ok);
7190 return DecodeError_clone(&*owner->contents.err);
7192 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
7193 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7194 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7195 uint32_t ret_ref = 0;
7196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7199 ret_ref = (uintptr_t)ret_var.inner;
7200 if (ret_var.is_owned) {
7206 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7207 CHECK(owner->result_ok);
7208 return Shutdown_clone(&*owner->contents.result);
7210 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
7211 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7212 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7213 uint32_t ret_ref = 0;
7214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7217 ret_ref = (uintptr_t)ret_var.inner;
7218 if (ret_var.is_owned) {
7224 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7225 CHECK(!owner->result_ok);
7226 return DecodeError_clone(&*owner->contents.err);
7228 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
7229 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7230 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7231 uint32_t ret_ref = 0;
7232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7235 ret_ref = (uintptr_t)ret_var.inner;
7236 if (ret_var.is_owned) {
7242 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7243 CHECK(owner->result_ok);
7244 return UpdateFailHTLC_clone(&*owner->contents.result);
7246 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7247 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7248 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7249 uint32_t ret_ref = 0;
7250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7253 ret_ref = (uintptr_t)ret_var.inner;
7254 if (ret_var.is_owned) {
7260 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7261 CHECK(!owner->result_ok);
7262 return DecodeError_clone(&*owner->contents.err);
7264 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
7265 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7266 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7267 uint32_t ret_ref = 0;
7268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7271 ret_ref = (uintptr_t)ret_var.inner;
7272 if (ret_var.is_owned) {
7278 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7279 CHECK(owner->result_ok);
7280 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
7282 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7283 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7284 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7285 uint32_t ret_ref = 0;
7286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7289 ret_ref = (uintptr_t)ret_var.inner;
7290 if (ret_var.is_owned) {
7296 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7297 CHECK(!owner->result_ok);
7298 return DecodeError_clone(&*owner->contents.err);
7300 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
7301 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7302 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7303 uint32_t ret_ref = 0;
7304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7307 ret_ref = (uintptr_t)ret_var.inner;
7308 if (ret_var.is_owned) {
7314 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7315 CHECK(owner->result_ok);
7316 return UpdateFee_clone(&*owner->contents.result);
7318 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7319 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7320 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7321 uint32_t ret_ref = 0;
7322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7325 ret_ref = (uintptr_t)ret_var.inner;
7326 if (ret_var.is_owned) {
7332 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7333 CHECK(!owner->result_ok);
7334 return DecodeError_clone(&*owner->contents.err);
7336 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7337 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7338 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7339 uint32_t ret_ref = 0;
7340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7343 ret_ref = (uintptr_t)ret_var.inner;
7344 if (ret_var.is_owned) {
7350 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7351 CHECK(owner->result_ok);
7352 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7354 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7355 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7356 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7357 uint32_t ret_ref = 0;
7358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7361 ret_ref = (uintptr_t)ret_var.inner;
7362 if (ret_var.is_owned) {
7368 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7369 CHECK(!owner->result_ok);
7370 return DecodeError_clone(&*owner->contents.err);
7372 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7373 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7374 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7375 uint32_t ret_ref = 0;
7376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7379 ret_ref = (uintptr_t)ret_var.inner;
7380 if (ret_var.is_owned) {
7386 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7387 CHECK(owner->result_ok);
7388 return UpdateAddHTLC_clone(&*owner->contents.result);
7390 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7391 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7392 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7393 uint32_t ret_ref = 0;
7394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7397 ret_ref = (uintptr_t)ret_var.inner;
7398 if (ret_var.is_owned) {
7404 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7405 CHECK(!owner->result_ok);
7406 return DecodeError_clone(&*owner->contents.err);
7408 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7409 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7410 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7411 uint32_t ret_ref = 0;
7412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7415 ret_ref = (uintptr_t)ret_var.inner;
7416 if (ret_var.is_owned) {
7422 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7423 CHECK(owner->result_ok);
7424 return Ping_clone(&*owner->contents.result);
7426 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7427 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7428 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7429 uint32_t ret_ref = 0;
7430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7433 ret_ref = (uintptr_t)ret_var.inner;
7434 if (ret_var.is_owned) {
7440 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7441 CHECK(!owner->result_ok);
7442 return DecodeError_clone(&*owner->contents.err);
7444 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7445 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7446 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7447 uint32_t ret_ref = 0;
7448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7451 ret_ref = (uintptr_t)ret_var.inner;
7452 if (ret_var.is_owned) {
7458 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7459 CHECK(owner->result_ok);
7460 return Pong_clone(&*owner->contents.result);
7462 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7463 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7464 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7465 uint32_t ret_ref = 0;
7466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7469 ret_ref = (uintptr_t)ret_var.inner;
7470 if (ret_var.is_owned) {
7476 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7477 CHECK(!owner->result_ok);
7478 return DecodeError_clone(&*owner->contents.err);
7480 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7481 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7482 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7483 uint32_t ret_ref = 0;
7484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7487 ret_ref = (uintptr_t)ret_var.inner;
7488 if (ret_var.is_owned) {
7494 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7495 CHECK(owner->result_ok);
7496 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7498 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7499 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7500 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7501 uint32_t ret_ref = 0;
7502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7505 ret_ref = (uintptr_t)ret_var.inner;
7506 if (ret_var.is_owned) {
7512 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7513 CHECK(!owner->result_ok);
7514 return DecodeError_clone(&*owner->contents.err);
7516 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7517 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7518 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7519 uint32_t ret_ref = 0;
7520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7523 ret_ref = (uintptr_t)ret_var.inner;
7524 if (ret_var.is_owned) {
7530 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7531 CHECK(owner->result_ok);
7532 return ChannelAnnouncement_clone(&*owner->contents.result);
7534 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7535 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7536 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7537 uint32_t ret_ref = 0;
7538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7541 ret_ref = (uintptr_t)ret_var.inner;
7542 if (ret_var.is_owned) {
7548 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7549 CHECK(!owner->result_ok);
7550 return DecodeError_clone(&*owner->contents.err);
7552 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7553 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7554 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7555 uint32_t ret_ref = 0;
7556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7559 ret_ref = (uintptr_t)ret_var.inner;
7560 if (ret_var.is_owned) {
7566 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7567 CHECK(owner->result_ok);
7568 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7570 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7571 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7572 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7573 uint32_t ret_ref = 0;
7574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7577 ret_ref = (uintptr_t)ret_var.inner;
7578 if (ret_var.is_owned) {
7584 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7585 CHECK(!owner->result_ok);
7586 return DecodeError_clone(&*owner->contents.err);
7588 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7589 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7590 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7591 uint32_t ret_ref = 0;
7592 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7593 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7595 ret_ref = (uintptr_t)ret_var.inner;
7596 if (ret_var.is_owned) {
7602 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7603 CHECK(owner->result_ok);
7604 return ChannelUpdate_clone(&*owner->contents.result);
7606 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7607 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7608 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7609 uint32_t ret_ref = 0;
7610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7613 ret_ref = (uintptr_t)ret_var.inner;
7614 if (ret_var.is_owned) {
7620 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7621 CHECK(!owner->result_ok);
7622 return DecodeError_clone(&*owner->contents.err);
7624 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7625 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7626 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7627 uint32_t ret_ref = 0;
7628 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7629 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7630 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7631 ret_ref = (uintptr_t)ret_var.inner;
7632 if (ret_var.is_owned) {
7638 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7639 CHECK(owner->result_ok);
7640 return ErrorMessage_clone(&*owner->contents.result);
7642 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7643 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7644 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7645 uint32_t ret_ref = 0;
7646 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7647 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7649 ret_ref = (uintptr_t)ret_var.inner;
7650 if (ret_var.is_owned) {
7656 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7657 CHECK(!owner->result_ok);
7658 return DecodeError_clone(&*owner->contents.err);
7660 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7661 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7662 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7663 uint32_t ret_ref = 0;
7664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7667 ret_ref = (uintptr_t)ret_var.inner;
7668 if (ret_var.is_owned) {
7674 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7675 CHECK(owner->result_ok);
7676 return WarningMessage_clone(&*owner->contents.result);
7678 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7679 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7680 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7681 uint32_t ret_ref = 0;
7682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7685 ret_ref = (uintptr_t)ret_var.inner;
7686 if (ret_var.is_owned) {
7692 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7693 CHECK(!owner->result_ok);
7694 return DecodeError_clone(&*owner->contents.err);
7696 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7697 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7698 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7699 uint32_t ret_ref = 0;
7700 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7701 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7703 ret_ref = (uintptr_t)ret_var.inner;
7704 if (ret_var.is_owned) {
7710 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7711 CHECK(owner->result_ok);
7712 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7714 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7715 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7716 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7717 uint32_t ret_ref = 0;
7718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7721 ret_ref = (uintptr_t)ret_var.inner;
7722 if (ret_var.is_owned) {
7728 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7729 CHECK(!owner->result_ok);
7730 return DecodeError_clone(&*owner->contents.err);
7732 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7733 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7734 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7735 uint32_t ret_ref = 0;
7736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7739 ret_ref = (uintptr_t)ret_var.inner;
7740 if (ret_var.is_owned) {
7746 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7747 CHECK(owner->result_ok);
7748 return NodeAnnouncement_clone(&*owner->contents.result);
7750 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7751 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7752 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7753 uint32_t ret_ref = 0;
7754 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7755 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7757 ret_ref = (uintptr_t)ret_var.inner;
7758 if (ret_var.is_owned) {
7764 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7765 CHECK(!owner->result_ok);
7766 return DecodeError_clone(&*owner->contents.err);
7768 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7769 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7770 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7771 uint32_t ret_ref = 0;
7772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7775 ret_ref = (uintptr_t)ret_var.inner;
7776 if (ret_var.is_owned) {
7782 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7783 CHECK(owner->result_ok);
7784 return QueryShortChannelIds_clone(&*owner->contents.result);
7786 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
7787 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7788 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7789 uint32_t ret_ref = 0;
7790 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7791 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7793 ret_ref = (uintptr_t)ret_var.inner;
7794 if (ret_var.is_owned) {
7800 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7801 CHECK(!owner->result_ok);
7802 return DecodeError_clone(&*owner->contents.err);
7804 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
7805 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7806 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7807 uint32_t ret_ref = 0;
7808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7811 ret_ref = (uintptr_t)ret_var.inner;
7812 if (ret_var.is_owned) {
7818 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7819 CHECK(owner->result_ok);
7820 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7822 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
7823 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7824 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7825 uint32_t ret_ref = 0;
7826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7829 ret_ref = (uintptr_t)ret_var.inner;
7830 if (ret_var.is_owned) {
7836 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7837 CHECK(!owner->result_ok);
7838 return DecodeError_clone(&*owner->contents.err);
7840 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
7841 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7842 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7843 uint32_t ret_ref = 0;
7844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7847 ret_ref = (uintptr_t)ret_var.inner;
7848 if (ret_var.is_owned) {
7854 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7855 CHECK(owner->result_ok);
7856 return QueryChannelRange_clone(&*owner->contents.result);
7858 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7859 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7860 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7861 uint32_t ret_ref = 0;
7862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7865 ret_ref = (uintptr_t)ret_var.inner;
7866 if (ret_var.is_owned) {
7872 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7873 CHECK(!owner->result_ok);
7874 return DecodeError_clone(&*owner->contents.err);
7876 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7877 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7878 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7879 uint32_t ret_ref = 0;
7880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7883 ret_ref = (uintptr_t)ret_var.inner;
7884 if (ret_var.is_owned) {
7890 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7891 CHECK(owner->result_ok);
7892 return ReplyChannelRange_clone(&*owner->contents.result);
7894 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7895 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7896 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7897 uint32_t ret_ref = 0;
7898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7901 ret_ref = (uintptr_t)ret_var.inner;
7902 if (ret_var.is_owned) {
7908 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7909 CHECK(!owner->result_ok);
7910 return DecodeError_clone(&*owner->contents.err);
7912 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7913 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7914 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7915 uint32_t ret_ref = 0;
7916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7919 ret_ref = (uintptr_t)ret_var.inner;
7920 if (ret_var.is_owned) {
7926 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7927 CHECK(owner->result_ok);
7928 return GossipTimestampFilter_clone(&*owner->contents.result);
7930 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
7931 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7932 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7933 uint32_t ret_ref = 0;
7934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7937 ret_ref = (uintptr_t)ret_var.inner;
7938 if (ret_var.is_owned) {
7944 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7945 CHECK(!owner->result_ok);
7946 return DecodeError_clone(&*owner->contents.err);
7948 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
7949 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7950 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7951 uint32_t ret_ref = 0;
7952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7955 ret_ref = (uintptr_t)ret_var.inner;
7956 if (ret_var.is_owned) {
7962 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
7963 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7965 case LDKSignOrCreationError_SignError: return 0;
7966 case LDKSignOrCreationError_CreationError: return 1;
7970 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
7971 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7972 assert(obj->tag == LDKSignOrCreationError_CreationError);
7973 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7974 return creation_error_conv;
7976 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7977 CHECK(owner->result_ok);
7978 return Invoice_clone(&*owner->contents.result);
7980 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
7981 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7982 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7983 uint32_t ret_ref = 0;
7984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7987 ret_ref = (uintptr_t)ret_var.inner;
7988 if (ret_var.is_owned) {
7994 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7995 CHECK(!owner->result_ok);
7996 return SignOrCreationError_clone(&*owner->contents.err);
7998 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
7999 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
8000 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8001 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8002 uint32_t ret_ref = (uintptr_t)ret_copy;
8006 typedef struct LDKFilter_JCalls {
8007 atomic_size_t refcnt;
8008 uint32_t instance_ptr;
8010 static void LDKFilter_JCalls_free(void* this_arg) {
8011 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8012 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8016 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8017 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8018 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8019 memcpy(txid_arr->elems, *txid, 32);
8020 LDKu8slice script_pubkey_var = script_pubkey;
8021 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8022 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8023 js_invoke_function_u_uu(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
8025 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8026 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8027 LDKWatchedOutput output_var = output;
8028 uint32_t output_ref = 0;
8029 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8030 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8031 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8032 output_ref = (uintptr_t)output_var.inner;
8033 if (output_var.is_owned) {
8036 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 33, (uint32_t)output_ref);
8037 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8038 CHECK_ACCESS(ret_ptr);
8039 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
8043 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8044 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8045 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8047 static inline LDKFilter LDKFilter_init (JSValue o) {
8048 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8049 atomic_init(&calls->refcnt, 1);
8050 calls->instance_ptr = o;
8053 .this_arg = (void*) calls,
8054 .register_tx = register_tx_LDKFilter_jcall,
8055 .register_output = register_output_LDKFilter_jcall,
8056 .free = LDKFilter_JCalls_free,
8060 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8061 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8062 *res_ptr = LDKFilter_init(o);
8063 return (long)res_ptr;
8065 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8066 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8067 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8068 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8069 unsigned char txid_arr[32];
8070 CHECK(txid->arr_len == 32);
8071 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8072 unsigned char (*txid_ref)[32] = &txid_arr;
8073 LDKu8slice script_pubkey_ref;
8074 script_pubkey_ref.datalen = script_pubkey->arr_len;
8075 script_pubkey_ref.data = script_pubkey->elems;
8076 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8077 FREE(script_pubkey);
8080 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
8081 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8082 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8083 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8084 LDKWatchedOutput output_conv;
8085 output_conv.inner = (void*)(output & (~1));
8086 output_conv.is_owned = (output & 1) || (output == 0);
8087 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8088 output_conv = WatchedOutput_clone(&output_conv);
8089 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8090 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8091 uint32_t ret_ref = (uintptr_t)ret_copy;
8095 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
8096 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8098 case LDKCOption_FilterZ_Some: return 0;
8099 case LDKCOption_FilterZ_None: return 1;
8103 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
8104 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8105 assert(obj->tag == LDKCOption_FilterZ_Some);
8106 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8107 *some_ret = obj->some;
8108 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8109 if ((*some_ret).free == LDKFilter_JCalls_free) {
8110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8111 LDKFilter_JCalls_cloned(&(*some_ret));
8113 return (uint32_t)some_ret;
8115 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8116 CHECK(owner->result_ok);
8117 return &*owner->contents.result;
8119 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
8120 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8121 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8122 uint32_t ret_ref = 0;
8123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8126 ret_ref = (uintptr_t)ret_var.inner & ~1;
8130 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8131 CHECK(!owner->result_ok);
8132 return *owner->contents.err;
8134 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
8135 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8136 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8139 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8140 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8141 for (size_t i = 0; i < ret.datalen; i++) {
8142 ret.data[i] = OutPoint_clone(&orig->data[i]);
8146 typedef struct LDKMessageSendEventsProvider_JCalls {
8147 atomic_size_t refcnt;
8148 uint32_t instance_ptr;
8149 } LDKMessageSendEventsProvider_JCalls;
8150 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8151 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8152 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8156 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8157 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8158 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 34);
8159 LDKCVec_MessageSendEventZ ret_constr;
8160 ret_constr.datalen = ret->arr_len;
8161 if (ret_constr.datalen > 0)
8162 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8164 ret_constr.data = NULL;
8165 uint32_t* ret_vals = ret->elems;
8166 for (size_t s = 0; s < ret_constr.datalen; s++) {
8167 uint32_t ret_conv_18 = ret_vals[s];
8168 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
8169 CHECK_ACCESS(ret_conv_18_ptr);
8170 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8171 FREE((void*)ret_conv_18);
8172 ret_constr.data[s] = ret_conv_18_conv;
8177 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8178 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8179 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8181 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8182 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8183 atomic_init(&calls->refcnt, 1);
8184 calls->instance_ptr = o;
8186 LDKMessageSendEventsProvider ret = {
8187 .this_arg = (void*) calls,
8188 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8189 .free = LDKMessageSendEventsProvider_JCalls_free,
8193 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8194 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8195 *res_ptr = LDKMessageSendEventsProvider_init(o);
8196 return (long)res_ptr;
8198 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) {
8199 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8200 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8201 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8202 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8203 uint32_tArray ret_arr = NULL;
8204 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
8205 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8206 for (size_t s = 0; s < ret_var.datalen; s++) {
8207 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8208 *ret_conv_18_copy = ret_var.data[s];
8209 uint32_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
8210 ret_arr_ptr[s] = ret_conv_18_ref;
8217 typedef struct LDKEventHandler_JCalls {
8218 atomic_size_t refcnt;
8219 uint32_t instance_ptr;
8220 } LDKEventHandler_JCalls;
8221 static void LDKEventHandler_JCalls_free(void* this_arg) {
8222 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8223 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8227 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8228 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8229 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8230 *ret_event = Event_clone(event);
8231 js_invoke_function_u_u(j_calls->instance_ptr, 35, (uint32_t)(uint32_t)ret_event);
8233 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8234 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8235 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8237 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8238 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8239 atomic_init(&calls->refcnt, 1);
8240 calls->instance_ptr = o;
8242 LDKEventHandler ret = {
8243 .this_arg = (void*) calls,
8244 .handle_event = handle_event_LDKEventHandler_jcall,
8245 .free = LDKEventHandler_JCalls_free,
8249 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8250 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8251 *res_ptr = LDKEventHandler_init(o);
8252 return (long)res_ptr;
8254 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
8255 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8256 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8257 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8258 LDKEvent* event_conv = (LDKEvent*)event;
8259 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8262 typedef struct LDKEventsProvider_JCalls {
8263 atomic_size_t refcnt;
8264 uint32_t instance_ptr;
8265 } LDKEventsProvider_JCalls;
8266 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8267 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8268 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8272 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8273 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8274 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8275 *handler_ret = handler;
8276 js_invoke_function_u_u(j_calls->instance_ptr, 36, (uint32_t)(uint32_t)handler_ret);
8278 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8279 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8280 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8282 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8283 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8284 atomic_init(&calls->refcnt, 1);
8285 calls->instance_ptr = o;
8287 LDKEventsProvider ret = {
8288 .this_arg = (void*) calls,
8289 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8290 .free = LDKEventsProvider_JCalls_free,
8294 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8295 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8296 *res_ptr = LDKEventsProvider_init(o);
8297 return (long)res_ptr;
8299 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
8300 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8301 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8302 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8303 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
8304 CHECK_ACCESS(handler_ptr);
8305 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8306 if (handler_conv.free == LDKEventHandler_JCalls_free) {
8307 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8308 LDKEventHandler_JCalls_cloned(&handler_conv);
8310 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8313 typedef struct LDKScore_JCalls {
8314 atomic_size_t refcnt;
8315 uint32_t instance_ptr;
8317 static void LDKScore_JCalls_free(void* this_arg) {
8318 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8319 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8323 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8324 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8325 int64_t short_channel_id_conv = short_channel_id;
8326 LDKNodeId source_var = *source;
8327 uint32_t source_ref = 0;
8328 source_var = NodeId_clone(&source_var);
8329 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8330 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8331 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8332 source_ref = (uintptr_t)source_var.inner;
8333 if (source_var.is_owned) {
8336 LDKNodeId target_var = *target;
8337 uint32_t target_ref = 0;
8338 target_var = NodeId_clone(&target_var);
8339 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8340 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8341 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8342 target_ref = (uintptr_t)target_var.inner;
8343 if (target_var.is_owned) {
8346 LDKChannelUsage usage_var = usage;
8347 uint32_t usage_ref = 0;
8348 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8349 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8350 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8351 usage_ref = (uintptr_t)usage_var.inner;
8352 if (usage_var.is_owned) {
8355 return js_invoke_function_b_uuuu(j_calls->instance_ptr, 37, (uint32_t)short_channel_id_conv, (uint32_t)source_ref, (uint32_t)target_ref, (uint32_t)usage_ref);
8357 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8358 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8359 LDKCVec_RouteHopZ path_var = path;
8360 uint32_tArray path_arr = NULL;
8361 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8362 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8363 for (size_t k = 0; k < path_var.datalen; k++) {
8364 LDKRouteHop path_conv_10_var = path_var.data[k];
8365 uint32_t path_conv_10_ref = 0;
8366 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8367 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8368 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8369 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8370 if (path_conv_10_var.is_owned) {
8371 path_conv_10_ref |= 1;
8373 path_arr_ptr[k] = path_conv_10_ref;
8376 FREE(path_var.data);
8377 int64_t short_channel_id_conv = short_channel_id;
8378 js_invoke_function_u_bb(j_calls->instance_ptr, 38, (uint32_t)path_arr, (uint32_t)short_channel_id_conv);
8380 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8381 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8382 LDKCVec_RouteHopZ path_var = path;
8383 uint32_tArray path_arr = NULL;
8384 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8385 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8386 for (size_t k = 0; k < path_var.datalen; k++) {
8387 LDKRouteHop path_conv_10_var = path_var.data[k];
8388 uint32_t path_conv_10_ref = 0;
8389 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8390 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8391 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8392 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8393 if (path_conv_10_var.is_owned) {
8394 path_conv_10_ref |= 1;
8396 path_arr_ptr[k] = path_conv_10_ref;
8399 FREE(path_var.data);
8400 js_invoke_function_u_u(j_calls->instance_ptr, 39, (uint32_t)path_arr);
8402 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8403 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8404 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 40);
8405 LDKCVec_u8Z ret_ref;
8406 ret_ref.datalen = ret->arr_len;
8407 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8408 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8411 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8412 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8413 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8415 static inline LDKScore LDKScore_init (JSValue o) {
8416 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8417 atomic_init(&calls->refcnt, 1);
8418 calls->instance_ptr = o;
8421 .this_arg = (void*) calls,
8422 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8423 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8424 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8425 .write = write_LDKScore_jcall,
8426 .free = LDKScore_JCalls_free,
8430 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8431 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8432 *res_ptr = LDKScore_init(o);
8433 return (long)res_ptr;
8435 int64_t __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, uint32_t source, uint32_t target, uint32_t usage) {
8436 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8437 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8438 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8439 LDKNodeId source_conv;
8440 source_conv.inner = (void*)(source & (~1));
8441 source_conv.is_owned = false;
8442 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8443 LDKNodeId target_conv;
8444 target_conv.inner = (void*)(target & (~1));
8445 target_conv.is_owned = false;
8446 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8447 LDKChannelUsage usage_conv;
8448 usage_conv.inner = (void*)(usage & (~1));
8449 usage_conv.is_owned = (usage & 1) || (usage == 0);
8450 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8451 usage_conv = ChannelUsage_clone(&usage_conv);
8452 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8456 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) {
8457 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8459 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8460 LDKCVec_RouteHopZ path_constr;
8461 path_constr.datalen = path->arr_len;
8462 if (path_constr.datalen > 0)
8463 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8465 path_constr.data = NULL;
8466 uint32_t* path_vals = path->elems;
8467 for (size_t k = 0; k < path_constr.datalen; k++) {
8468 uint32_t path_conv_10 = path_vals[k];
8469 LDKRouteHop path_conv_10_conv;
8470 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8471 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8472 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8473 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8474 path_constr.data[k] = path_conv_10_conv;
8477 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8480 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8481 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8482 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8483 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8484 LDKCVec_RouteHopZ path_constr;
8485 path_constr.datalen = path->arr_len;
8486 if (path_constr.datalen > 0)
8487 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8489 path_constr.data = NULL;
8490 uint32_t* path_vals = path->elems;
8491 for (size_t k = 0; k < path_constr.datalen; k++) {
8492 uint32_t path_conv_10 = path_vals[k];
8493 LDKRouteHop path_conv_10_conv;
8494 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8495 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8496 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8497 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8498 path_constr.data[k] = path_conv_10_conv;
8501 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8504 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8505 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8506 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8507 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8508 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8509 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8510 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8511 CVec_u8Z_free(ret_var);
8515 typedef struct LDKPersister_JCalls {
8516 atomic_size_t refcnt;
8517 uint32_t instance_ptr;
8518 } LDKPersister_JCalls;
8519 static void LDKPersister_JCalls_free(void* this_arg) {
8520 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8521 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8525 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8526 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8527 LDKChannelManager channel_manager_var = *channel_manager;
8528 uint32_t channel_manager_ref = 0;
8529 // WARNING: we may need a move here but no clone is available for LDKChannelManager
8530 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8531 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8532 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8533 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
8534 if (channel_manager_var.is_owned) {
8535 channel_manager_ref |= 1;
8537 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 41, (uint32_t)channel_manager_ref);
8538 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8539 CHECK_ACCESS(ret_ptr);
8540 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8544 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8545 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8546 LDKNetworkGraph network_graph_var = *network_graph;
8547 uint32_t network_graph_ref = 0;
8548 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8549 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8550 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8551 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8552 network_graph_ref = (uintptr_t)network_graph_var.inner;
8553 if (network_graph_var.is_owned) {
8554 network_graph_ref |= 1;
8556 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 42, (uint32_t)network_graph_ref);
8557 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8558 CHECK_ACCESS(ret_ptr);
8559 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8563 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
8564 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8565 LDKMultiThreadedLockableScore scorer_var = *scorer;
8566 uint32_t scorer_ref = 0;
8567 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
8568 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8569 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8570 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
8571 scorer_ref = (uintptr_t)scorer_var.inner;
8572 if (scorer_var.is_owned) {
8575 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 43, (uint32_t)scorer_ref);
8576 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8577 CHECK_ACCESS(ret_ptr);
8578 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8582 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8583 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8584 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8586 static inline LDKPersister LDKPersister_init (JSValue o) {
8587 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8588 atomic_init(&calls->refcnt, 1);
8589 calls->instance_ptr = o;
8591 LDKPersister ret = {
8592 .this_arg = (void*) calls,
8593 .persist_manager = persist_manager_LDKPersister_jcall,
8594 .persist_graph = persist_graph_LDKPersister_jcall,
8595 .persist_scorer = persist_scorer_LDKPersister_jcall,
8596 .free = LDKPersister_JCalls_free,
8600 long __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8601 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8602 *res_ptr = LDKPersister_init(o);
8603 return (long)res_ptr;
8605 uint32_t __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
8606 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8607 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8608 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8609 LDKChannelManager channel_manager_conv;
8610 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8611 channel_manager_conv.is_owned = false;
8612 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8613 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8614 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8615 return (uint32_t)ret_conv;
8618 uint32_t __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint32_t this_arg, uint32_t network_graph) {
8619 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8620 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8621 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8622 LDKNetworkGraph network_graph_conv;
8623 network_graph_conv.inner = (void*)(network_graph & (~1));
8624 network_graph_conv.is_owned = false;
8625 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8626 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8627 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8628 return (uint32_t)ret_conv;
8631 uint32_t __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint32_t this_arg, uint32_t scorer) {
8632 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8633 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8634 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8635 LDKMultiThreadedLockableScore scorer_conv;
8636 scorer_conv.inner = (void*)(scorer & (~1));
8637 scorer_conv.is_owned = false;
8638 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
8639 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8640 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
8641 return (uint32_t)ret_conv;
8644 typedef struct LDKListen_JCalls {
8645 atomic_size_t refcnt;
8646 uint32_t instance_ptr;
8648 static void LDKListen_JCalls_free(void* this_arg) {
8649 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8650 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8654 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8655 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8656 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8657 memcpy(header_arr->elems, *header, 80);
8658 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8659 uint32_tArray txdata_arr = NULL;
8660 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8661 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8662 for (size_t c = 0; c < txdata_var.datalen; c++) {
8663 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8664 *txdata_conv_28_conv = txdata_var.data[c];
8665 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8668 FREE(txdata_var.data);
8669 int32_t height_conv = height;
8670 js_invoke_function_u_uuu(j_calls->instance_ptr, 44, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8672 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8673 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8674 LDKu8slice block_var = block;
8675 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8676 memcpy(block_arr->elems, block_var.data, block_var.datalen);
8677 int32_t height_conv = height;
8678 js_invoke_function_u_uu(j_calls->instance_ptr, 45, (uint32_t)block_arr, (uint32_t)height_conv);
8680 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8681 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8682 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8683 memcpy(header_arr->elems, *header, 80);
8684 int32_t height_conv = height;
8685 js_invoke_function_u_uu(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)height_conv);
8687 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8688 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8689 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8691 static inline LDKListen LDKListen_init (JSValue o) {
8692 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8693 atomic_init(&calls->refcnt, 1);
8694 calls->instance_ptr = o;
8697 .this_arg = (void*) calls,
8698 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8699 .block_connected = block_connected_LDKListen_jcall,
8700 .block_disconnected = block_disconnected_LDKListen_jcall,
8701 .free = LDKListen_JCalls_free,
8705 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8706 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8707 *res_ptr = LDKListen_init(o);
8708 return (long)res_ptr;
8710 void __attribute__((export_name("TS_Listen_filtered_block_connected"))) TS_Listen_filtered_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
8711 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8712 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8713 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8714 unsigned char header_arr[80];
8715 CHECK(header->arr_len == 80);
8716 memcpy(header_arr, header->elems, 80); FREE(header);
8717 unsigned char (*header_ref)[80] = &header_arr;
8718 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8719 txdata_constr.datalen = txdata->arr_len;
8720 if (txdata_constr.datalen > 0)
8721 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8723 txdata_constr.data = NULL;
8724 uint32_t* txdata_vals = txdata->elems;
8725 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8726 uint32_t txdata_conv_28 = txdata_vals[c];
8727 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8728 CHECK_ACCESS(txdata_conv_28_ptr);
8729 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8730 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8731 txdata_constr.data[c] = txdata_conv_28_conv;
8734 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8737 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
8738 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8739 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8740 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8741 LDKu8slice block_ref;
8742 block_ref.datalen = block->arr_len;
8743 block_ref.data = block->elems;
8744 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8748 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
8749 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8750 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8751 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8752 unsigned char header_arr[80];
8753 CHECK(header->arr_len == 80);
8754 memcpy(header_arr, header->elems, 80); FREE(header);
8755 unsigned char (*header_ref)[80] = &header_arr;
8756 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8759 typedef struct LDKConfirm_JCalls {
8760 atomic_size_t refcnt;
8761 uint32_t instance_ptr;
8762 } LDKConfirm_JCalls;
8763 static void LDKConfirm_JCalls_free(void* this_arg) {
8764 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8765 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8769 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8770 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8771 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8772 memcpy(header_arr->elems, *header, 80);
8773 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8774 uint32_tArray txdata_arr = NULL;
8775 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8776 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8777 for (size_t c = 0; c < txdata_var.datalen; c++) {
8778 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8779 *txdata_conv_28_conv = txdata_var.data[c];
8780 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8783 FREE(txdata_var.data);
8784 int32_t height_conv = height;
8785 js_invoke_function_u_uuu(j_calls->instance_ptr, 47, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8787 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8788 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8789 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8790 memcpy(txid_arr->elems, *txid, 32);
8791 js_invoke_function_u_u(j_calls->instance_ptr, 48, (uint32_t)txid_arr);
8793 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8794 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8795 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8796 memcpy(header_arr->elems, *header, 80);
8797 int32_t height_conv = height;
8798 js_invoke_function_u_uu(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)height_conv);
8800 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8801 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8802 ptrArray ret = (ptrArray)js_invoke_function_u_(j_calls->instance_ptr, 50);
8803 LDKCVec_TxidZ ret_constr;
8804 ret_constr.datalen = ret->arr_len;
8805 if (ret_constr.datalen > 0)
8806 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8808 ret_constr.data = NULL;
8809 int8_tArray* ret_vals = (void*) ret->elems;
8810 for (size_t m = 0; m < ret_constr.datalen; m++) {
8811 int8_tArray ret_conv_12 = ret_vals[m];
8812 LDKThirtyTwoBytes ret_conv_12_ref;
8813 CHECK(ret_conv_12->arr_len == 32);
8814 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8815 ret_constr.data[m] = ret_conv_12_ref;
8820 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8821 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8822 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8824 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8825 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8826 atomic_init(&calls->refcnt, 1);
8827 calls->instance_ptr = o;
8830 .this_arg = (void*) calls,
8831 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8832 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8833 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8834 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8835 .free = LDKConfirm_JCalls_free,
8839 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8840 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8841 *res_ptr = LDKConfirm_init(o);
8842 return (long)res_ptr;
8844 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) {
8845 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8846 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8847 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8848 unsigned char header_arr[80];
8849 CHECK(header->arr_len == 80);
8850 memcpy(header_arr, header->elems, 80); FREE(header);
8851 unsigned char (*header_ref)[80] = &header_arr;
8852 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8853 txdata_constr.datalen = txdata->arr_len;
8854 if (txdata_constr.datalen > 0)
8855 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8857 txdata_constr.data = NULL;
8858 uint32_t* txdata_vals = txdata->elems;
8859 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8860 uint32_t txdata_conv_28 = txdata_vals[c];
8861 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8862 CHECK_ACCESS(txdata_conv_28_ptr);
8863 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8864 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8865 txdata_constr.data[c] = txdata_conv_28_conv;
8868 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8871 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
8872 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8873 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8874 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8875 unsigned char txid_arr[32];
8876 CHECK(txid->arr_len == 32);
8877 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8878 unsigned char (*txid_ref)[32] = &txid_arr;
8879 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8882 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
8883 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8884 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8885 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8886 unsigned char header_arr[80];
8887 CHECK(header->arr_len == 80);
8888 memcpy(header_arr, header->elems, 80); FREE(header);
8889 unsigned char (*header_ref)[80] = &header_arr;
8890 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8893 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
8894 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8895 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8896 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8897 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8898 ptrArray ret_arr = NULL;
8899 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8900 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
8901 for (size_t m = 0; m < ret_var.datalen; m++) {
8902 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8903 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8904 ret_arr_ptr[m] = ret_conv_12_arr;
8911 typedef struct LDKPersist_JCalls {
8912 atomic_size_t refcnt;
8913 uint32_t instance_ptr;
8914 } LDKPersist_JCalls;
8915 static void LDKPersist_JCalls_free(void* this_arg) {
8916 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8917 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8921 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8922 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8923 LDKOutPoint channel_id_var = channel_id;
8924 uint32_t channel_id_ref = 0;
8925 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8926 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8927 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8928 channel_id_ref = (uintptr_t)channel_id_var.inner;
8929 if (channel_id_var.is_owned) {
8930 channel_id_ref |= 1;
8932 LDKChannelMonitor data_var = *data;
8933 uint32_t data_ref = 0;
8934 data_var = ChannelMonitor_clone(&data_var);
8935 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8936 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8937 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8938 data_ref = (uintptr_t)data_var.inner;
8939 if (data_var.is_owned) {
8942 LDKMonitorUpdateId update_id_var = update_id;
8943 uint32_t update_id_ref = 0;
8944 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8945 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8946 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8947 update_id_ref = (uintptr_t)update_id_var.inner;
8948 if (update_id_var.is_owned) {
8951 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 51, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8952 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8953 CHECK_ACCESS(ret_ptr);
8954 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8958 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8959 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8960 LDKOutPoint channel_id_var = channel_id;
8961 uint32_t channel_id_ref = 0;
8962 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8963 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8964 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8965 channel_id_ref = (uintptr_t)channel_id_var.inner;
8966 if (channel_id_var.is_owned) {
8967 channel_id_ref |= 1;
8969 LDKChannelMonitorUpdate update_var = *update;
8970 uint32_t update_ref = 0;
8971 if ((uintptr_t)update_var.inner > 4096) {
8972 update_var = ChannelMonitorUpdate_clone(&update_var);
8973 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8974 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8975 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8976 update_ref = (uintptr_t)update_var.inner;
8977 if (update_var.is_owned) {
8981 LDKChannelMonitor data_var = *data;
8982 uint32_t data_ref = 0;
8983 data_var = ChannelMonitor_clone(&data_var);
8984 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8985 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8986 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8987 data_ref = (uintptr_t)data_var.inner;
8988 if (data_var.is_owned) {
8991 LDKMonitorUpdateId update_id_var = update_id;
8992 uint32_t update_id_ref = 0;
8993 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8994 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8995 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8996 update_id_ref = (uintptr_t)update_id_var.inner;
8997 if (update_id_var.is_owned) {
9000 uint32_t ret = js_invoke_function_u_uuuu(j_calls->instance_ptr, 52, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
9001 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9002 CHECK_ACCESS(ret_ptr);
9003 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9007 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9008 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9009 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9011 static inline LDKPersist LDKPersist_init (JSValue o) {
9012 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9013 atomic_init(&calls->refcnt, 1);
9014 calls->instance_ptr = o;
9017 .this_arg = (void*) calls,
9018 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9019 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9020 .free = LDKPersist_JCalls_free,
9024 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9025 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9026 *res_ptr = LDKPersist_init(o);
9027 return (long)res_ptr;
9029 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) {
9030 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9032 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9033 LDKOutPoint channel_id_conv;
9034 channel_id_conv.inner = (void*)(channel_id & (~1));
9035 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9036 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9037 channel_id_conv = OutPoint_clone(&channel_id_conv);
9038 LDKChannelMonitor data_conv;
9039 data_conv.inner = (void*)(data & (~1));
9040 data_conv.is_owned = false;
9041 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9042 LDKMonitorUpdateId update_id_conv;
9043 update_id_conv.inner = (void*)(update_id & (~1));
9044 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9045 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9046 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9047 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9048 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9049 return (uint32_t)ret_conv;
9052 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) {
9053 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9054 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9055 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9056 LDKOutPoint channel_id_conv;
9057 channel_id_conv.inner = (void*)(channel_id & (~1));
9058 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9059 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9060 channel_id_conv = OutPoint_clone(&channel_id_conv);
9061 LDKChannelMonitorUpdate update_conv;
9062 update_conv.inner = (void*)(update & (~1));
9063 update_conv.is_owned = false;
9064 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9065 LDKChannelMonitor data_conv;
9066 data_conv.inner = (void*)(data & (~1));
9067 data_conv.is_owned = false;
9068 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9069 LDKMonitorUpdateId update_id_conv;
9070 update_id_conv.inner = (void*)(update_id & (~1));
9071 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9072 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9073 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9074 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9075 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9076 return (uint32_t)ret_conv;
9079 typedef struct LDKChannelMessageHandler_JCalls {
9080 atomic_size_t refcnt;
9081 uint32_t instance_ptr;
9082 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9083 } LDKChannelMessageHandler_JCalls;
9084 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9086 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9090 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9091 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9092 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9093 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9094 LDKInitFeatures their_features_var = their_features;
9095 uint32_t their_features_ref = 0;
9096 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9097 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9098 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9099 their_features_ref = (uintptr_t)their_features_var.inner;
9100 if (their_features_var.is_owned) {
9101 their_features_ref |= 1;
9103 LDKOpenChannel msg_var = *msg;
9104 uint32_t msg_ref = 0;
9105 msg_var = OpenChannel_clone(&msg_var);
9106 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9107 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9109 msg_ref = (uintptr_t)msg_var.inner;
9110 if (msg_var.is_owned) {
9113 js_invoke_function_u_uuu(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9115 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9116 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9117 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9118 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9119 LDKInitFeatures their_features_var = their_features;
9120 uint32_t their_features_ref = 0;
9121 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9122 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9123 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9124 their_features_ref = (uintptr_t)their_features_var.inner;
9125 if (their_features_var.is_owned) {
9126 their_features_ref |= 1;
9128 LDKAcceptChannel msg_var = *msg;
9129 uint32_t msg_ref = 0;
9130 msg_var = AcceptChannel_clone(&msg_var);
9131 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9132 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9134 msg_ref = (uintptr_t)msg_var.inner;
9135 if (msg_var.is_owned) {
9138 js_invoke_function_u_uuu(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9140 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9141 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9142 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9143 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9144 LDKFundingCreated msg_var = *msg;
9145 uint32_t msg_ref = 0;
9146 msg_var = FundingCreated_clone(&msg_var);
9147 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9148 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9149 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9150 msg_ref = (uintptr_t)msg_var.inner;
9151 if (msg_var.is_owned) {
9154 js_invoke_function_u_uu(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9156 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9157 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9158 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9159 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9160 LDKFundingSigned msg_var = *msg;
9161 uint32_t msg_ref = 0;
9162 msg_var = FundingSigned_clone(&msg_var);
9163 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9164 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9165 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9166 msg_ref = (uintptr_t)msg_var.inner;
9167 if (msg_var.is_owned) {
9170 js_invoke_function_u_uu(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9172 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9173 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9174 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9175 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9176 LDKChannelReady msg_var = *msg;
9177 uint32_t msg_ref = 0;
9178 msg_var = ChannelReady_clone(&msg_var);
9179 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9180 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9181 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9182 msg_ref = (uintptr_t)msg_var.inner;
9183 if (msg_var.is_owned) {
9186 js_invoke_function_u_uu(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9188 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9189 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9190 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9191 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9192 LDKInitFeatures their_features_var = *their_features;
9193 uint32_t their_features_ref = 0;
9194 their_features_var = InitFeatures_clone(&their_features_var);
9195 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9196 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9197 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9198 their_features_ref = (uintptr_t)their_features_var.inner;
9199 if (their_features_var.is_owned) {
9200 their_features_ref |= 1;
9202 LDKShutdown msg_var = *msg;
9203 uint32_t msg_ref = 0;
9204 msg_var = Shutdown_clone(&msg_var);
9205 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9206 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9207 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9208 msg_ref = (uintptr_t)msg_var.inner;
9209 if (msg_var.is_owned) {
9212 js_invoke_function_u_uuu(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9214 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9215 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9216 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9217 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9218 LDKClosingSigned msg_var = *msg;
9219 uint32_t msg_ref = 0;
9220 msg_var = ClosingSigned_clone(&msg_var);
9221 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9222 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9223 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9224 msg_ref = (uintptr_t)msg_var.inner;
9225 if (msg_var.is_owned) {
9228 js_invoke_function_u_uu(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9230 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9231 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9232 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9233 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9234 LDKUpdateAddHTLC msg_var = *msg;
9235 uint32_t msg_ref = 0;
9236 msg_var = UpdateAddHTLC_clone(&msg_var);
9237 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9238 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9239 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9240 msg_ref = (uintptr_t)msg_var.inner;
9241 if (msg_var.is_owned) {
9244 js_invoke_function_u_uu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9246 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9247 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9248 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9249 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9250 LDKUpdateFulfillHTLC msg_var = *msg;
9251 uint32_t msg_ref = 0;
9252 msg_var = UpdateFulfillHTLC_clone(&msg_var);
9253 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9254 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9255 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9256 msg_ref = (uintptr_t)msg_var.inner;
9257 if (msg_var.is_owned) {
9260 js_invoke_function_u_uu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9262 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9263 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9264 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9265 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9266 LDKUpdateFailHTLC msg_var = *msg;
9267 uint32_t msg_ref = 0;
9268 msg_var = UpdateFailHTLC_clone(&msg_var);
9269 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9270 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9271 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9272 msg_ref = (uintptr_t)msg_var.inner;
9273 if (msg_var.is_owned) {
9276 js_invoke_function_u_uu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9278 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9279 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9280 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9281 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9282 LDKUpdateFailMalformedHTLC msg_var = *msg;
9283 uint32_t msg_ref = 0;
9284 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9285 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9286 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9287 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9288 msg_ref = (uintptr_t)msg_var.inner;
9289 if (msg_var.is_owned) {
9292 js_invoke_function_u_uu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9294 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9295 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9296 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9297 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9298 LDKCommitmentSigned msg_var = *msg;
9299 uint32_t msg_ref = 0;
9300 msg_var = CommitmentSigned_clone(&msg_var);
9301 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9302 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9303 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9304 msg_ref = (uintptr_t)msg_var.inner;
9305 if (msg_var.is_owned) {
9308 js_invoke_function_u_uu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9310 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9311 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9312 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9313 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9314 LDKRevokeAndACK msg_var = *msg;
9315 uint32_t msg_ref = 0;
9316 msg_var = RevokeAndACK_clone(&msg_var);
9317 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9318 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9319 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9320 msg_ref = (uintptr_t)msg_var.inner;
9321 if (msg_var.is_owned) {
9324 js_invoke_function_u_uu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9326 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9327 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9328 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9329 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9330 LDKUpdateFee msg_var = *msg;
9331 uint32_t msg_ref = 0;
9332 msg_var = UpdateFee_clone(&msg_var);
9333 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9334 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9335 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9336 msg_ref = (uintptr_t)msg_var.inner;
9337 if (msg_var.is_owned) {
9340 js_invoke_function_u_uu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9342 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9343 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9344 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9345 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9346 LDKAnnouncementSignatures msg_var = *msg;
9347 uint32_t msg_ref = 0;
9348 msg_var = AnnouncementSignatures_clone(&msg_var);
9349 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9350 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9352 msg_ref = (uintptr_t)msg_var.inner;
9353 if (msg_var.is_owned) {
9356 js_invoke_function_u_uu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9358 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9359 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9360 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9361 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9362 jboolean no_connection_possible_conv = no_connection_possible;
9363 js_invoke_function_u_uu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible_conv);
9365 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9366 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9367 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9368 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9369 LDKInit msg_var = *msg;
9370 uint32_t msg_ref = 0;
9371 msg_var = Init_clone(&msg_var);
9372 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9373 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9374 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9375 msg_ref = (uintptr_t)msg_var.inner;
9376 if (msg_var.is_owned) {
9379 js_invoke_function_u_uu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9381 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9382 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9383 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9384 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9385 LDKChannelReestablish msg_var = *msg;
9386 uint32_t msg_ref = 0;
9387 msg_var = ChannelReestablish_clone(&msg_var);
9388 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9389 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9390 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9391 msg_ref = (uintptr_t)msg_var.inner;
9392 if (msg_var.is_owned) {
9395 js_invoke_function_u_uu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9397 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9398 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9399 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9400 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9401 LDKChannelUpdate msg_var = *msg;
9402 uint32_t msg_ref = 0;
9403 msg_var = ChannelUpdate_clone(&msg_var);
9404 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9405 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9406 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9407 msg_ref = (uintptr_t)msg_var.inner;
9408 if (msg_var.is_owned) {
9411 js_invoke_function_u_uu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9413 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9414 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9415 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9416 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9417 LDKErrorMessage msg_var = *msg;
9418 uint32_t msg_ref = 0;
9419 msg_var = ErrorMessage_clone(&msg_var);
9420 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9421 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9422 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9423 msg_ref = (uintptr_t)msg_var.inner;
9424 if (msg_var.is_owned) {
9427 js_invoke_function_u_uu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9429 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9430 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9431 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9432 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9434 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9435 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9436 atomic_init(&calls->refcnt, 1);
9437 calls->instance_ptr = o;
9439 LDKChannelMessageHandler ret = {
9440 .this_arg = (void*) calls,
9441 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9442 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9443 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9444 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9445 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9446 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9447 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9448 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9449 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9450 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9451 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9452 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9453 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9454 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9455 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9456 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9457 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9458 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9459 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9460 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9461 .free = LDKChannelMessageHandler_JCalls_free,
9462 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9464 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9467 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9468 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9469 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9470 return (long)res_ptr;
9472 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) {
9473 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9474 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9475 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9476 LDKPublicKey their_node_id_ref;
9477 CHECK(their_node_id->arr_len == 33);
9478 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9479 LDKInitFeatures their_features_conv;
9480 their_features_conv.inner = (void*)(their_features & (~1));
9481 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9482 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9483 their_features_conv = InitFeatures_clone(&their_features_conv);
9484 LDKOpenChannel msg_conv;
9485 msg_conv.inner = (void*)(msg & (~1));
9486 msg_conv.is_owned = false;
9487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9488 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9491 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) {
9492 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9494 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9495 LDKPublicKey their_node_id_ref;
9496 CHECK(their_node_id->arr_len == 33);
9497 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9498 LDKInitFeatures their_features_conv;
9499 their_features_conv.inner = (void*)(their_features & (~1));
9500 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9501 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9502 their_features_conv = InitFeatures_clone(&their_features_conv);
9503 LDKAcceptChannel msg_conv;
9504 msg_conv.inner = (void*)(msg & (~1));
9505 msg_conv.is_owned = false;
9506 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9507 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9510 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) {
9511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9513 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9514 LDKPublicKey their_node_id_ref;
9515 CHECK(their_node_id->arr_len == 33);
9516 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9517 LDKFundingCreated msg_conv;
9518 msg_conv.inner = (void*)(msg & (~1));
9519 msg_conv.is_owned = false;
9520 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9521 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9524 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) {
9525 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9526 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9528 LDKPublicKey their_node_id_ref;
9529 CHECK(their_node_id->arr_len == 33);
9530 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9531 LDKFundingSigned msg_conv;
9532 msg_conv.inner = (void*)(msg & (~1));
9533 msg_conv.is_owned = false;
9534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9535 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9538 void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_ready"))) TS_ChannelMessageHandler_handle_channel_ready(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9539 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9542 LDKPublicKey their_node_id_ref;
9543 CHECK(their_node_id->arr_len == 33);
9544 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9545 LDKChannelReady msg_conv;
9546 msg_conv.inner = (void*)(msg & (~1));
9547 msg_conv.is_owned = false;
9548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9549 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9552 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) {
9553 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9554 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9555 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9556 LDKPublicKey their_node_id_ref;
9557 CHECK(their_node_id->arr_len == 33);
9558 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9559 LDKInitFeatures their_features_conv;
9560 their_features_conv.inner = (void*)(their_features & (~1));
9561 their_features_conv.is_owned = false;
9562 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9563 LDKShutdown msg_conv;
9564 msg_conv.inner = (void*)(msg & (~1));
9565 msg_conv.is_owned = false;
9566 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9567 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9570 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) {
9571 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9572 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9573 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9574 LDKPublicKey their_node_id_ref;
9575 CHECK(their_node_id->arr_len == 33);
9576 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9577 LDKClosingSigned msg_conv;
9578 msg_conv.inner = (void*)(msg & (~1));
9579 msg_conv.is_owned = false;
9580 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9581 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9584 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) {
9585 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9586 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9587 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9588 LDKPublicKey their_node_id_ref;
9589 CHECK(their_node_id->arr_len == 33);
9590 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9591 LDKUpdateAddHTLC msg_conv;
9592 msg_conv.inner = (void*)(msg & (~1));
9593 msg_conv.is_owned = false;
9594 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9595 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9598 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) {
9599 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9600 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9602 LDKPublicKey their_node_id_ref;
9603 CHECK(their_node_id->arr_len == 33);
9604 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9605 LDKUpdateFulfillHTLC msg_conv;
9606 msg_conv.inner = (void*)(msg & (~1));
9607 msg_conv.is_owned = false;
9608 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9609 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9612 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) {
9613 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9615 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9616 LDKPublicKey their_node_id_ref;
9617 CHECK(their_node_id->arr_len == 33);
9618 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9619 LDKUpdateFailHTLC msg_conv;
9620 msg_conv.inner = (void*)(msg & (~1));
9621 msg_conv.is_owned = false;
9622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9623 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9626 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) {
9627 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9628 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9630 LDKPublicKey their_node_id_ref;
9631 CHECK(their_node_id->arr_len == 33);
9632 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9633 LDKUpdateFailMalformedHTLC msg_conv;
9634 msg_conv.inner = (void*)(msg & (~1));
9635 msg_conv.is_owned = false;
9636 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9637 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9640 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) {
9641 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9642 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9643 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9644 LDKPublicKey their_node_id_ref;
9645 CHECK(their_node_id->arr_len == 33);
9646 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9647 LDKCommitmentSigned msg_conv;
9648 msg_conv.inner = (void*)(msg & (~1));
9649 msg_conv.is_owned = false;
9650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9651 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9654 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) {
9655 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9656 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9657 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9658 LDKPublicKey their_node_id_ref;
9659 CHECK(their_node_id->arr_len == 33);
9660 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9661 LDKRevokeAndACK msg_conv;
9662 msg_conv.inner = (void*)(msg & (~1));
9663 msg_conv.is_owned = false;
9664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9665 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9668 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) {
9669 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9670 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9671 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9672 LDKPublicKey their_node_id_ref;
9673 CHECK(their_node_id->arr_len == 33);
9674 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9675 LDKUpdateFee msg_conv;
9676 msg_conv.inner = (void*)(msg & (~1));
9677 msg_conv.is_owned = false;
9678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9679 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9682 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) {
9683 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9684 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9685 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9686 LDKPublicKey their_node_id_ref;
9687 CHECK(their_node_id->arr_len == 33);
9688 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9689 LDKAnnouncementSignatures msg_conv;
9690 msg_conv.inner = (void*)(msg & (~1));
9691 msg_conv.is_owned = false;
9692 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9693 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9696 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) {
9697 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9698 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9699 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9700 LDKPublicKey their_node_id_ref;
9701 CHECK(their_node_id->arr_len == 33);
9702 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9703 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9706 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9707 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9708 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9709 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9710 LDKPublicKey their_node_id_ref;
9711 CHECK(their_node_id->arr_len == 33);
9712 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9714 msg_conv.inner = (void*)(msg & (~1));
9715 msg_conv.is_owned = false;
9716 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9717 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9720 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) {
9721 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9722 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9723 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9724 LDKPublicKey their_node_id_ref;
9725 CHECK(their_node_id->arr_len == 33);
9726 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9727 LDKChannelReestablish msg_conv;
9728 msg_conv.inner = (void*)(msg & (~1));
9729 msg_conv.is_owned = false;
9730 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9731 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9734 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) {
9735 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9736 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9737 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9738 LDKPublicKey their_node_id_ref;
9739 CHECK(their_node_id->arr_len == 33);
9740 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9741 LDKChannelUpdate msg_conv;
9742 msg_conv.inner = (void*)(msg & (~1));
9743 msg_conv.is_owned = false;
9744 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9745 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9748 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9749 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9750 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9751 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9752 LDKPublicKey their_node_id_ref;
9753 CHECK(their_node_id->arr_len == 33);
9754 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9755 LDKErrorMessage msg_conv;
9756 msg_conv.inner = (void*)(msg & (~1));
9757 msg_conv.is_owned = false;
9758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9759 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9762 typedef struct LDKRoutingMessageHandler_JCalls {
9763 atomic_size_t refcnt;
9764 uint32_t instance_ptr;
9765 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9766 } LDKRoutingMessageHandler_JCalls;
9767 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9768 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9773 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9774 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9775 LDKNodeAnnouncement msg_var = *msg;
9776 uint32_t msg_ref = 0;
9777 msg_var = NodeAnnouncement_clone(&msg_var);
9778 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9779 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9780 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9781 msg_ref = (uintptr_t)msg_var.inner;
9782 if (msg_var.is_owned) {
9785 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 73, (uint32_t)msg_ref);
9786 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9787 CHECK_ACCESS(ret_ptr);
9788 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9792 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9793 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9794 LDKChannelAnnouncement msg_var = *msg;
9795 uint32_t msg_ref = 0;
9796 msg_var = ChannelAnnouncement_clone(&msg_var);
9797 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9798 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9799 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9800 msg_ref = (uintptr_t)msg_var.inner;
9801 if (msg_var.is_owned) {
9804 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 74, (uint32_t)msg_ref);
9805 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9806 CHECK_ACCESS(ret_ptr);
9807 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9811 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9812 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9813 LDKChannelUpdate msg_var = *msg;
9814 uint32_t msg_ref = 0;
9815 msg_var = ChannelUpdate_clone(&msg_var);
9816 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9817 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9818 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9819 msg_ref = (uintptr_t)msg_var.inner;
9820 if (msg_var.is_owned) {
9823 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 75, (uint32_t)msg_ref);
9824 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9825 CHECK_ACCESS(ret_ptr);
9826 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9830 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9831 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9832 int64_t starting_point_conv = starting_point;
9833 int8_t batch_amount_conv = batch_amount;
9834 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 76, (uint32_t)starting_point_conv, (uint32_t)batch_amount_conv);
9835 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9836 ret_constr.datalen = ret->arr_len;
9837 if (ret_constr.datalen > 0)
9838 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9840 ret_constr.data = NULL;
9841 uint32_t* ret_vals = ret->elems;
9842 for (size_t h = 0; h < ret_constr.datalen; h++) {
9843 uint32_t ret_conv_59 = ret_vals[h];
9844 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
9845 CHECK_ACCESS(ret_conv_59_ptr);
9846 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9847 FREE((void*)ret_conv_59);
9848 ret_constr.data[h] = ret_conv_59_conv;
9853 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9854 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9855 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9856 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9857 int8_t batch_amount_conv = batch_amount;
9858 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 77, (uint32_t)starting_point_arr, (uint32_t)batch_amount_conv);
9859 LDKCVec_NodeAnnouncementZ ret_constr;
9860 ret_constr.datalen = ret->arr_len;
9861 if (ret_constr.datalen > 0)
9862 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9864 ret_constr.data = NULL;
9865 uint32_t* ret_vals = ret->elems;
9866 for (size_t s = 0; s < ret_constr.datalen; s++) {
9867 uint32_t ret_conv_18 = ret_vals[s];
9868 LDKNodeAnnouncement ret_conv_18_conv;
9869 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9870 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9872 ret_constr.data[s] = ret_conv_18_conv;
9877 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9878 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9879 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9880 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9881 LDKInit init_var = *init;
9882 uint32_t init_ref = 0;
9883 init_var = Init_clone(&init_var);
9884 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9885 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9886 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9887 init_ref = (uintptr_t)init_var.inner;
9888 if (init_var.is_owned) {
9891 js_invoke_function_u_uu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
9893 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9894 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9895 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9896 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9897 LDKReplyChannelRange msg_var = msg;
9898 uint32_t msg_ref = 0;
9899 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9900 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9901 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9902 msg_ref = (uintptr_t)msg_var.inner;
9903 if (msg_var.is_owned) {
9906 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9907 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9908 CHECK_ACCESS(ret_ptr);
9909 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9913 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9914 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9915 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9916 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9917 LDKReplyShortChannelIdsEnd msg_var = msg;
9918 uint32_t msg_ref = 0;
9919 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9920 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9922 msg_ref = (uintptr_t)msg_var.inner;
9923 if (msg_var.is_owned) {
9926 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9927 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9928 CHECK_ACCESS(ret_ptr);
9929 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9933 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9934 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9935 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9936 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9937 LDKQueryChannelRange msg_var = msg;
9938 uint32_t msg_ref = 0;
9939 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9940 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9941 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9942 msg_ref = (uintptr_t)msg_var.inner;
9943 if (msg_var.is_owned) {
9946 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9947 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9948 CHECK_ACCESS(ret_ptr);
9949 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9953 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9954 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9955 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9956 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9957 LDKQueryShortChannelIds msg_var = msg;
9958 uint32_t msg_ref = 0;
9959 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9960 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9961 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9962 msg_ref = (uintptr_t)msg_var.inner;
9963 if (msg_var.is_owned) {
9966 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9967 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9968 CHECK_ACCESS(ret_ptr);
9969 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9973 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9974 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9975 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9976 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9978 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9979 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9980 atomic_init(&calls->refcnt, 1);
9981 calls->instance_ptr = o;
9983 LDKRoutingMessageHandler ret = {
9984 .this_arg = (void*) calls,
9985 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9986 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9987 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9988 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9989 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9990 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9991 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9992 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9993 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9994 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9995 .free = LDKRoutingMessageHandler_JCalls_free,
9996 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9998 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10001 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10002 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10003 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10004 return (long)res_ptr;
10006 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
10007 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10008 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10009 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10010 LDKNodeAnnouncement msg_conv;
10011 msg_conv.inner = (void*)(msg & (~1));
10012 msg_conv.is_owned = false;
10013 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10014 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10015 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10016 return (uint32_t)ret_conv;
10019 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
10020 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10021 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10022 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10023 LDKChannelAnnouncement msg_conv;
10024 msg_conv.inner = (void*)(msg & (~1));
10025 msg_conv.is_owned = false;
10026 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10027 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10028 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10029 return (uint32_t)ret_conv;
10032 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
10033 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10034 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10035 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10036 LDKChannelUpdate msg_conv;
10037 msg_conv.inner = (void*)(msg & (~1));
10038 msg_conv.is_owned = false;
10039 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10040 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10041 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10042 return (uint32_t)ret_conv;
10045 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) {
10046 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10047 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10048 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10049 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
10050 uint32_tArray ret_arr = NULL;
10051 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10052 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10053 for (size_t h = 0; h < ret_var.datalen; h++) {
10054 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10055 *ret_conv_59_conv = ret_var.data[h];
10056 ret_arr_ptr[h] = ((uint32_t)ret_conv_59_conv);
10059 FREE(ret_var.data);
10063 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) {
10064 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10065 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10066 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10067 LDKPublicKey starting_point_ref;
10068 CHECK(starting_point->arr_len == 33);
10069 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10070 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
10071 uint32_tArray ret_arr = NULL;
10072 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10073 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10074 for (size_t s = 0; s < ret_var.datalen; s++) {
10075 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
10076 uint32_t ret_conv_18_ref = 0;
10077 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10078 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
10080 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
10081 if (ret_conv_18_var.is_owned) {
10082 ret_conv_18_ref |= 1;
10084 ret_arr_ptr[s] = ret_conv_18_ref;
10087 FREE(ret_var.data);
10091 void __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
10092 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10093 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10094 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10095 LDKPublicKey their_node_id_ref;
10096 CHECK(their_node_id->arr_len == 33);
10097 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10099 init_conv.inner = (void*)(init & (~1));
10100 init_conv.is_owned = false;
10101 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10102 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10105 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) {
10106 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10107 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10108 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10109 LDKPublicKey their_node_id_ref;
10110 CHECK(their_node_id->arr_len == 33);
10111 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10112 LDKReplyChannelRange msg_conv;
10113 msg_conv.inner = (void*)(msg & (~1));
10114 msg_conv.is_owned = (msg & 1) || (msg == 0);
10115 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10116 msg_conv = ReplyChannelRange_clone(&msg_conv);
10117 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10118 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10119 return (uint32_t)ret_conv;
10122 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) {
10123 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10124 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10125 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10126 LDKPublicKey their_node_id_ref;
10127 CHECK(their_node_id->arr_len == 33);
10128 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10129 LDKReplyShortChannelIdsEnd msg_conv;
10130 msg_conv.inner = (void*)(msg & (~1));
10131 msg_conv.is_owned = (msg & 1) || (msg == 0);
10132 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10133 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10134 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10135 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10136 return (uint32_t)ret_conv;
10139 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) {
10140 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10141 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10142 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10143 LDKPublicKey their_node_id_ref;
10144 CHECK(their_node_id->arr_len == 33);
10145 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10146 LDKQueryChannelRange msg_conv;
10147 msg_conv.inner = (void*)(msg & (~1));
10148 msg_conv.is_owned = (msg & 1) || (msg == 0);
10149 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10150 msg_conv = QueryChannelRange_clone(&msg_conv);
10151 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10152 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10153 return (uint32_t)ret_conv;
10156 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) {
10157 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10159 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10160 LDKPublicKey their_node_id_ref;
10161 CHECK(their_node_id->arr_len == 33);
10162 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10163 LDKQueryShortChannelIds msg_conv;
10164 msg_conv.inner = (void*)(msg & (~1));
10165 msg_conv.is_owned = (msg & 1) || (msg == 0);
10166 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10167 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10168 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10169 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10170 return (uint32_t)ret_conv;
10173 typedef struct LDKCustomMessageReader_JCalls {
10174 atomic_size_t refcnt;
10175 uint32_t instance_ptr;
10176 } LDKCustomMessageReader_JCalls;
10177 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10178 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10179 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10183 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10184 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10185 int16_t message_type_conv = message_type;
10186 LDKu8slice buffer_var = buffer;
10187 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10188 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10189 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 83, (uint32_t)message_type_conv, (uint32_t)buffer_arr);
10190 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10191 CHECK_ACCESS(ret_ptr);
10192 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10196 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10197 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10198 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10200 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10201 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10202 atomic_init(&calls->refcnt, 1);
10203 calls->instance_ptr = o;
10205 LDKCustomMessageReader ret = {
10206 .this_arg = (void*) calls,
10207 .read = read_LDKCustomMessageReader_jcall,
10208 .free = LDKCustomMessageReader_JCalls_free,
10212 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10213 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10214 *res_ptr = LDKCustomMessageReader_init(o);
10215 return (long)res_ptr;
10217 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
10218 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10219 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10220 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10221 LDKu8slice buffer_ref;
10222 buffer_ref.datalen = buffer->arr_len;
10223 buffer_ref.data = buffer->elems;
10224 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10225 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10227 return (uint32_t)ret_conv;
10230 typedef struct LDKCustomMessageHandler_JCalls {
10231 atomic_size_t refcnt;
10232 uint32_t instance_ptr;
10233 LDKCustomMessageReader_JCalls* CustomMessageReader;
10234 } LDKCustomMessageHandler_JCalls;
10235 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10236 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10237 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10241 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10242 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10243 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10245 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10246 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10247 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 84, (uint32_t)(uint32_t)msg_ret, (uint32_t)sender_node_id_arr);
10248 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10249 CHECK_ACCESS(ret_ptr);
10250 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10254 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10255 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10256 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 85);
10257 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10258 ret_constr.datalen = ret->arr_len;
10259 if (ret_constr.datalen > 0)
10260 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10262 ret_constr.data = NULL;
10263 uint32_t* ret_vals = ret->elems;
10264 for (size_t z = 0; z < ret_constr.datalen; z++) {
10265 uint32_t ret_conv_25 = ret_vals[z];
10266 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
10267 CHECK_ACCESS(ret_conv_25_ptr);
10268 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10269 FREE((void*)ret_conv_25);
10270 ret_constr.data[z] = ret_conv_25_conv;
10275 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10276 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10277 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10278 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10280 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10281 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10282 atomic_init(&calls->refcnt, 1);
10283 calls->instance_ptr = o;
10285 LDKCustomMessageHandler ret = {
10286 .this_arg = (void*) calls,
10287 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10288 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10289 .free = LDKCustomMessageHandler_JCalls_free,
10290 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10292 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10295 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10296 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10297 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10298 return (long)res_ptr;
10300 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) {
10301 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10302 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10303 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10304 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
10305 CHECK_ACCESS(msg_ptr);
10306 LDKType msg_conv = *(LDKType*)(msg_ptr);
10307 if (msg_conv.free == LDKType_JCalls_free) {
10308 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10309 LDKType_JCalls_cloned(&msg_conv);
10311 LDKPublicKey sender_node_id_ref;
10312 CHECK(sender_node_id->arr_len == 33);
10313 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10314 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10315 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10316 return (uint32_t)ret_conv;
10319 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
10320 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10321 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10322 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10323 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10324 uint32_tArray ret_arr = NULL;
10325 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10326 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10327 for (size_t z = 0; z < ret_var.datalen; z++) {
10328 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10329 *ret_conv_25_conv = ret_var.data[z];
10330 ret_arr_ptr[z] = ((uint32_t)ret_conv_25_conv);
10333 FREE(ret_var.data);
10337 typedef struct LDKSocketDescriptor_JCalls {
10338 atomic_size_t refcnt;
10339 uint32_t instance_ptr;
10340 } LDKSocketDescriptor_JCalls;
10341 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10342 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10343 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10347 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10348 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10349 LDKu8slice data_var = data;
10350 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10351 memcpy(data_arr->elems, data_var.data, data_var.datalen);
10352 jboolean resume_read_conv = resume_read;
10353 return js_invoke_function_u_uu(j_calls->instance_ptr, 86, (uint32_t)data_arr, (uint32_t)resume_read_conv);
10355 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10356 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10357 js_invoke_function_u_(j_calls->instance_ptr, 87);
10359 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10360 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10361 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10362 *other_arg_clone = SocketDescriptor_clone(other_arg);
10363 return js_invoke_function_u_u(j_calls->instance_ptr, 88, (uint32_t)(uint32_t)other_arg_clone);
10365 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10366 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10367 return js_invoke_function_b_(j_calls->instance_ptr, 89);
10369 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10370 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10371 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10373 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10374 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10375 atomic_init(&calls->refcnt, 1);
10376 calls->instance_ptr = o;
10378 LDKSocketDescriptor ret = {
10379 .this_arg = (void*) calls,
10380 .send_data = send_data_LDKSocketDescriptor_jcall,
10381 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10382 .eq = eq_LDKSocketDescriptor_jcall,
10383 .hash = hash_LDKSocketDescriptor_jcall,
10384 .cloned = LDKSocketDescriptor_JCalls_cloned,
10385 .free = LDKSocketDescriptor_JCalls_free,
10389 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10390 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10391 *res_ptr = LDKSocketDescriptor_init(o);
10392 return (long)res_ptr;
10394 uint32_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
10395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10397 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10398 LDKu8slice data_ref;
10399 data_ref.datalen = data->arr_len;
10400 data_ref.data = data->elems;
10401 uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10406 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
10407 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10408 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10409 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10410 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10413 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
10414 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10415 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10416 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10417 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10421 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
10422 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10424 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10425 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10426 case LDKEffectiveCapacity_Total: return 2;
10427 case LDKEffectiveCapacity_Infinite: return 3;
10428 case LDKEffectiveCapacity_Unknown: return 4;
10432 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
10433 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10434 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10435 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10436 return liquidity_msat_conv;
10438 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
10439 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10440 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10441 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10442 return amount_msat_conv;
10444 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
10445 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10446 assert(obj->tag == LDKEffectiveCapacity_Total);
10447 int64_t capacity_msat_conv = obj->total.capacity_msat;
10448 return capacity_msat_conv;
10450 typedef struct LDKLockableScore_JCalls {
10451 atomic_size_t refcnt;
10452 uint32_t instance_ptr;
10453 } LDKLockableScore_JCalls;
10454 static void LDKLockableScore_JCalls_free(void* this_arg) {
10455 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10456 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10460 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10461 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10462 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 90);
10463 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10464 CHECK_ACCESS(ret_ptr);
10465 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10466 if (ret_conv.free == LDKScore_JCalls_free) {
10467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10468 LDKScore_JCalls_cloned(&ret_conv);
10469 }// WARNING: we may need a move here but no clone is available for LDKScore
10473 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10474 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10475 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10477 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10478 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10479 atomic_init(&calls->refcnt, 1);
10480 calls->instance_ptr = o;
10482 LDKLockableScore ret = {
10483 .this_arg = (void*) calls,
10484 .lock = lock_LDKLockableScore_jcall,
10485 .free = LDKLockableScore_JCalls_free,
10489 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10490 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10491 *res_ptr = LDKLockableScore_init(o);
10492 return (long)res_ptr;
10494 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
10495 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10496 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10497 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10498 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10499 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10500 return (uint32_t)ret_ret;
10503 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
10504 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10506 case LDKFallback_SegWitProgram: return 0;
10507 case LDKFallback_PubKeyHash: return 1;
10508 case LDKFallback_ScriptHash: return 2;
10512 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
10513 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10514 assert(obj->tag == LDKFallback_SegWitProgram);
10515 uint8_t version_val = obj->seg_wit_program.version._0;
10516 return version_val;
10518 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
10519 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10520 assert(obj->tag == LDKFallback_SegWitProgram);
10521 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10522 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10523 memcpy(program_arr->elems, program_var.data, program_var.datalen);
10524 return program_arr;
10526 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
10527 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10528 assert(obj->tag == LDKFallback_PubKeyHash);
10529 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10530 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10531 return pub_key_hash_arr;
10533 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
10534 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10535 assert(obj->tag == LDKFallback_ScriptHash);
10536 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10537 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10538 return script_hash_arr;
10540 typedef struct LDKPayer_JCalls {
10541 atomic_size_t refcnt;
10542 uint32_t instance_ptr;
10544 static void LDKPayer_JCalls_free(void* this_arg) {
10545 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10546 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10550 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10551 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10552 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 91);
10553 LDKPublicKey ret_ref;
10554 CHECK(ret->arr_len == 33);
10555 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10558 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10559 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10560 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 92);
10561 LDKCVec_ChannelDetailsZ ret_constr;
10562 ret_constr.datalen = ret->arr_len;
10563 if (ret_constr.datalen > 0)
10564 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10566 ret_constr.data = NULL;
10567 uint32_t* ret_vals = ret->elems;
10568 for (size_t q = 0; q < ret_constr.datalen; q++) {
10569 uint32_t ret_conv_16 = ret_vals[q];
10570 LDKChannelDetails ret_conv_16_conv;
10571 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10572 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10574 ret_constr.data[q] = ret_conv_16_conv;
10579 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10580 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10581 LDKRoute route_var = *route;
10582 uint32_t route_ref = 0;
10583 route_var = Route_clone(&route_var);
10584 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10585 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10586 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10587 route_ref = (uintptr_t)route_var.inner;
10588 if (route_var.is_owned) {
10591 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10592 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10593 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10594 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10595 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 93, (uint32_t)route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr);
10596 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10597 CHECK_ACCESS(ret_ptr);
10598 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10602 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10603 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10604 LDKRoute route_var = *route;
10605 uint32_t route_ref = 0;
10606 route_var = Route_clone(&route_var);
10607 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10608 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10609 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10610 route_ref = (uintptr_t)route_var.inner;
10611 if (route_var.is_owned) {
10614 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10615 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10616 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 94, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10617 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10618 CHECK_ACCESS(ret_ptr);
10619 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10623 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10624 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10625 LDKRoute route_var = *route;
10626 uint32_t route_ref = 0;
10627 route_var = Route_clone(&route_var);
10628 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10629 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10630 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10631 route_ref = (uintptr_t)route_var.inner;
10632 if (route_var.is_owned) {
10635 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10636 memcpy(payment_id_arr->elems, payment_id.data, 32);
10637 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 95, (uint32_t)route_ref, (uint32_t)payment_id_arr);
10638 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10639 CHECK_ACCESS(ret_ptr);
10640 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10644 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10645 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10646 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10647 memcpy(payment_id_arr->elems, payment_id.data, 32);
10648 js_invoke_function_u_u(j_calls->instance_ptr, 96, (uint32_t)payment_id_arr);
10650 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10651 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10652 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10654 static inline LDKPayer LDKPayer_init (JSValue o) {
10655 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10656 atomic_init(&calls->refcnt, 1);
10657 calls->instance_ptr = o;
10660 .this_arg = (void*) calls,
10661 .node_id = node_id_LDKPayer_jcall,
10662 .first_hops = first_hops_LDKPayer_jcall,
10663 .send_payment = send_payment_LDKPayer_jcall,
10664 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10665 .retry_payment = retry_payment_LDKPayer_jcall,
10666 .abandon_payment = abandon_payment_LDKPayer_jcall,
10667 .free = LDKPayer_JCalls_free,
10671 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10672 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10673 *res_ptr = LDKPayer_init(o);
10674 return (long)res_ptr;
10676 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
10677 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10678 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10679 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10680 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10681 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10685 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
10686 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10687 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10688 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10689 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10690 uint32_tArray ret_arr = NULL;
10691 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10692 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10693 for (size_t q = 0; q < ret_var.datalen; q++) {
10694 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10695 uint32_t ret_conv_16_ref = 0;
10696 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10697 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10699 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
10700 if (ret_conv_16_var.is_owned) {
10701 ret_conv_16_ref |= 1;
10703 ret_arr_ptr[q] = ret_conv_16_ref;
10706 FREE(ret_var.data);
10710 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) {
10711 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10712 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10713 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10714 LDKRoute route_conv;
10715 route_conv.inner = (void*)(route & (~1));
10716 route_conv.is_owned = false;
10717 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10718 LDKThirtyTwoBytes payment_hash_ref;
10719 CHECK(payment_hash->arr_len == 32);
10720 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10721 LDKThirtyTwoBytes payment_secret_ref;
10722 CHECK(payment_secret->arr_len == 32);
10723 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10724 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10725 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10726 return (uint32_t)ret_conv;
10729 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) {
10730 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10731 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10732 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10733 LDKRoute route_conv;
10734 route_conv.inner = (void*)(route & (~1));
10735 route_conv.is_owned = false;
10736 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10737 LDKThirtyTwoBytes payment_preimage_ref;
10738 CHECK(payment_preimage->arr_len == 32);
10739 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10740 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10741 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10742 return (uint32_t)ret_conv;
10745 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
10746 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10747 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10748 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10749 LDKRoute route_conv;
10750 route_conv.inner = (void*)(route & (~1));
10751 route_conv.is_owned = false;
10752 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10753 LDKThirtyTwoBytes payment_id_ref;
10754 CHECK(payment_id->arr_len == 32);
10755 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10756 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10757 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10758 return (uint32_t)ret_conv;
10761 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
10762 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10764 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10765 LDKThirtyTwoBytes payment_id_ref;
10766 CHECK(payment_id->arr_len == 32);
10767 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10768 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10771 typedef struct LDKRouter_JCalls {
10772 atomic_size_t refcnt;
10773 uint32_t instance_ptr;
10774 } LDKRouter_JCalls;
10775 static void LDKRouter_JCalls_free(void* this_arg) {
10776 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10777 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10781 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) {
10782 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10783 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10784 memcpy(payer_arr->elems, payer.compressed_form, 33);
10785 LDKRouteParameters route_params_var = *route_params;
10786 uint32_t route_params_ref = 0;
10787 route_params_var = RouteParameters_clone(&route_params_var);
10788 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10789 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10790 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10791 route_params_ref = (uintptr_t)route_params_var.inner;
10792 if (route_params_var.is_owned) {
10793 route_params_ref |= 1;
10795 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10796 memcpy(payment_hash_arr->elems, *payment_hash, 32);
10797 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10798 uint32_tArray first_hops_arr = NULL;
10799 if (first_hops != NULL) {
10800 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10801 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
10802 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
10803 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10804 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10805 uint32_t first_hops_conv_16_ref = 0;
10806 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10807 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10808 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10809 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
10810 if (first_hops_conv_16_var.is_owned) {
10811 first_hops_conv_16_ref |= 1;
10813 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10817 // WARNING: This object doesn't live past this scope, needs clone!
10818 uint32_t ret_scorer = ((uintptr_t)scorer) | 1;
10819 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 97, (uint32_t)payer_arr, (uint32_t)route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, (uint32_t)ret_scorer);
10820 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10821 CHECK_ACCESS(ret_ptr);
10822 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10826 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10827 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10828 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10830 static inline LDKRouter LDKRouter_init (JSValue o) {
10831 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10832 atomic_init(&calls->refcnt, 1);
10833 calls->instance_ptr = o;
10836 .this_arg = (void*) calls,
10837 .find_route = find_route_LDKRouter_jcall,
10838 .free = LDKRouter_JCalls_free,
10842 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10843 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10844 *res_ptr = LDKRouter_init(o);
10845 return (long)res_ptr;
10847 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) {
10848 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10849 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10850 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10851 LDKPublicKey payer_ref;
10852 CHECK(payer->arr_len == 33);
10853 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10854 LDKRouteParameters route_params_conv;
10855 route_params_conv.inner = (void*)(route_params & (~1));
10856 route_params_conv.is_owned = false;
10857 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10858 unsigned char payment_hash_arr[32];
10859 CHECK(payment_hash->arr_len == 32);
10860 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10861 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10862 LDKCVec_ChannelDetailsZ first_hops_constr;
10863 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10864 if (first_hops != 0) {
10865 first_hops_constr.datalen = first_hops->arr_len;
10866 if (first_hops_constr.datalen > 0)
10867 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10869 first_hops_constr.data = NULL;
10870 uint32_t* first_hops_vals = first_hops->elems;
10871 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10872 uint32_t first_hops_conv_16 = first_hops_vals[q];
10873 LDKChannelDetails first_hops_conv_16_conv;
10874 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
10875 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
10876 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10877 first_hops_constr.data[q] = first_hops_conv_16_conv;
10880 first_hops_ptr = &first_hops_constr;
10882 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
10883 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
10884 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10885 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10886 *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);
10887 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10888 return (uint32_t)ret_conv;
10891 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint32_t ptr) {
10892 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10894 case LDKRetry_Attempts: return 0;
10898 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint32_t ptr) {
10899 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10900 assert(obj->tag == LDKRetry_Attempts);
10901 uint32_t attempts_conv = obj->attempts;
10902 return attempts_conv;
10904 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10905 LDKStr ret_str = _ldk_get_compiled_version();
10906 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10911 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10912 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10913 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10918 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
10919 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10920 *ret_copy = Bech32Error_clone(arg);
10921 uint32_t ret_ref = (uintptr_t)ret_copy;
10924 uint32_t __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint32_t arg) {
10925 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
10926 uint32_t ret_conv = Bech32Error_clone_ptr(arg_conv);
10930 uint32_t __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint32_t orig) {
10931 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
10932 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10933 *ret_copy = Bech32Error_clone(orig_conv);
10934 uint32_t ret_ref = (uintptr_t)ret_copy;
10938 void __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint32_t o) {
10939 if ((o & 1) != 0) return;
10940 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
10941 CHECK_ACCESS(o_ptr);
10942 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
10944 Bech32Error_free(o_conv);
10947 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10948 LDKTransaction _res_ref;
10949 _res_ref.datalen = _res->arr_len;
10950 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10951 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10952 _res_ref.data_is_owned = true;
10953 Transaction_free(_res_ref);
10956 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10957 LDKCVec_u8Z script_pubkey_ref;
10958 script_pubkey_ref.datalen = script_pubkey->arr_len;
10959 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10960 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10961 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10962 *ret_ref = TxOut_new(script_pubkey_ref, value);
10963 return (uint32_t)ret_ref;
10966 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
10967 if ((_res & 1) != 0) return;
10968 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10969 CHECK_ACCESS(_res_ptr);
10970 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10972 TxOut_free(_res_conv);
10975 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10976 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10977 *ret_ref = TxOut_clone(arg);
10978 return (uint32_t)ret_ref;
10980 uint32_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
10981 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
10982 uint32_t ret_conv = TxOut_clone_ptr(arg_conv);
10986 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
10987 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10988 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10989 *ret_ref = TxOut_clone(orig_conv);
10990 return (uint32_t)ret_ref;
10993 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10994 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10998 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10999 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11000 *ret_conv = CResult_NoneNoneZ_ok();
11001 return (uint32_t)ret_conv;
11004 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11005 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11006 *ret_conv = CResult_NoneNoneZ_err();
11007 return (uint32_t)ret_conv;
11010 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
11011 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
11012 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11016 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
11017 if ((_res & 1) != 0) return;
11018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11019 CHECK_ACCESS(_res_ptr);
11020 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11022 CResult_NoneNoneZ_free(_res_conv);
11025 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11026 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11027 *ret_conv = CResult_NoneNoneZ_clone(arg);
11028 return (uint32_t)ret_conv;
11030 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
11031 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
11032 uint32_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11036 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
11037 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11038 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11039 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11040 return (uint32_t)ret_conv;
11043 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
11044 LDKCounterpartyCommitmentSecrets o_conv;
11045 o_conv.inner = (void*)(o & (~1));
11046 o_conv.is_owned = (o & 1) || (o == 0);
11047 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11048 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11049 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11050 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11051 return (uint32_t)ret_conv;
11054 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
11055 LDKDecodeError e_conv;
11056 e_conv.inner = (void*)(e & (~1));
11057 e_conv.is_owned = (e & 1) || (e == 0);
11058 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11059 e_conv = DecodeError_clone(&e_conv);
11060 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11061 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11062 return (uint32_t)ret_conv;
11065 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
11066 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
11067 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11071 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
11072 if ((_res & 1) != 0) return;
11073 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11074 CHECK_ACCESS(_res_ptr);
11075 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11077 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11080 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11081 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11082 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11083 return (uint32_t)ret_conv;
11085 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
11086 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
11087 uint32_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11091 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
11092 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
11093 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11094 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11095 return (uint32_t)ret_conv;
11098 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11099 LDKSecretKey o_ref;
11100 CHECK(o->arr_len == 32);
11101 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11102 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11103 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11104 return (uint32_t)ret_conv;
11107 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11108 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11109 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11110 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11111 return (uint32_t)ret_conv;
11114 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
11115 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
11116 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11120 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
11121 if ((_res & 1) != 0) return;
11122 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11123 CHECK_ACCESS(_res_ptr);
11124 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11126 CResult_SecretKeyErrorZ_free(_res_conv);
11129 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11130 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11131 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11132 return (uint32_t)ret_conv;
11134 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
11135 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
11136 uint32_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11140 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
11141 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
11142 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11143 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11144 return (uint32_t)ret_conv;
11147 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11148 LDKPublicKey o_ref;
11149 CHECK(o->arr_len == 33);
11150 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11151 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11152 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11153 return (uint32_t)ret_conv;
11156 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11157 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11158 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11159 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11160 return (uint32_t)ret_conv;
11163 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
11164 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
11165 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11169 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
11170 if ((_res & 1) != 0) return;
11171 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11172 CHECK_ACCESS(_res_ptr);
11173 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11175 CResult_PublicKeyErrorZ_free(_res_conv);
11178 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11179 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11180 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11181 return (uint32_t)ret_conv;
11183 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
11184 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
11185 uint32_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11189 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
11190 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11191 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11192 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11193 return (uint32_t)ret_conv;
11196 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
11197 LDKTxCreationKeys o_conv;
11198 o_conv.inner = (void*)(o & (~1));
11199 o_conv.is_owned = (o & 1) || (o == 0);
11200 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11201 o_conv = TxCreationKeys_clone(&o_conv);
11202 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11203 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11204 return (uint32_t)ret_conv;
11207 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
11208 LDKDecodeError e_conv;
11209 e_conv.inner = (void*)(e & (~1));
11210 e_conv.is_owned = (e & 1) || (e == 0);
11211 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11212 e_conv = DecodeError_clone(&e_conv);
11213 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11214 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11215 return (uint32_t)ret_conv;
11218 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
11219 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
11220 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11224 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
11225 if ((_res & 1) != 0) return;
11226 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11227 CHECK_ACCESS(_res_ptr);
11228 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11230 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11233 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11234 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11235 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11236 return (uint32_t)ret_conv;
11238 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11239 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
11240 uint32_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11244 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
11245 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11246 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11247 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11248 return (uint32_t)ret_conv;
11251 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
11252 LDKChannelPublicKeys o_conv;
11253 o_conv.inner = (void*)(o & (~1));
11254 o_conv.is_owned = (o & 1) || (o == 0);
11255 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11256 o_conv = ChannelPublicKeys_clone(&o_conv);
11257 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11258 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11259 return (uint32_t)ret_conv;
11262 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
11263 LDKDecodeError e_conv;
11264 e_conv.inner = (void*)(e & (~1));
11265 e_conv.is_owned = (e & 1) || (e == 0);
11266 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11267 e_conv = DecodeError_clone(&e_conv);
11268 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11269 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11270 return (uint32_t)ret_conv;
11273 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
11274 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
11275 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11279 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
11280 if ((_res & 1) != 0) return;
11281 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11282 CHECK_ACCESS(_res_ptr);
11283 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11285 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11288 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11289 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11290 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11291 return (uint32_t)ret_conv;
11293 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11294 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
11295 uint32_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11299 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
11300 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11301 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11302 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11303 return (uint32_t)ret_conv;
11306 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
11307 LDKTxCreationKeys o_conv;
11308 o_conv.inner = (void*)(o & (~1));
11309 o_conv.is_owned = (o & 1) || (o == 0);
11310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11311 o_conv = TxCreationKeys_clone(&o_conv);
11312 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11313 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11314 return (uint32_t)ret_conv;
11317 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11318 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11319 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11320 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11321 return (uint32_t)ret_conv;
11324 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
11325 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
11326 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11330 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
11331 if ((_res & 1) != 0) return;
11332 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11333 CHECK_ACCESS(_res_ptr);
11334 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11336 CResult_TxCreationKeysErrorZ_free(_res_conv);
11339 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11340 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11341 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11342 return (uint32_t)ret_conv;
11344 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
11345 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
11346 uint32_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11350 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
11351 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11352 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11353 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11354 return (uint32_t)ret_conv;
11357 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11358 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11359 *ret_copy = COption_u32Z_some(o);
11360 uint32_t ret_ref = (uintptr_t)ret_copy;
11364 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11365 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11366 *ret_copy = COption_u32Z_none();
11367 uint32_t ret_ref = (uintptr_t)ret_copy;
11371 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
11372 if ((_res & 1) != 0) return;
11373 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11374 CHECK_ACCESS(_res_ptr);
11375 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11377 COption_u32Z_free(_res_conv);
11380 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11381 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11382 *ret_copy = COption_u32Z_clone(arg);
11383 uint32_t ret_ref = (uintptr_t)ret_copy;
11386 uint32_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
11387 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
11388 uint32_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11392 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
11393 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11394 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11395 *ret_copy = COption_u32Z_clone(orig_conv);
11396 uint32_t ret_ref = (uintptr_t)ret_copy;
11400 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
11401 LDKHTLCOutputInCommitment o_conv;
11402 o_conv.inner = (void*)(o & (~1));
11403 o_conv.is_owned = (o & 1) || (o == 0);
11404 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11405 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11406 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11407 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11408 return (uint32_t)ret_conv;
11411 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
11412 LDKDecodeError e_conv;
11413 e_conv.inner = (void*)(e & (~1));
11414 e_conv.is_owned = (e & 1) || (e == 0);
11415 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11416 e_conv = DecodeError_clone(&e_conv);
11417 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11418 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11419 return (uint32_t)ret_conv;
11422 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
11423 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
11424 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11428 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
11429 if ((_res & 1) != 0) return;
11430 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11431 CHECK_ACCESS(_res_ptr);
11432 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11434 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11437 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11438 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11439 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11440 return (uint32_t)ret_conv;
11442 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
11443 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
11444 uint32_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11448 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
11449 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11450 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11451 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11452 return (uint32_t)ret_conv;
11455 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11456 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11460 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11461 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11465 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11466 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11467 COption_NoneZ_free(_res_conv);
11470 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11471 LDKCounterpartyChannelTransactionParameters o_conv;
11472 o_conv.inner = (void*)(o & (~1));
11473 o_conv.is_owned = (o & 1) || (o == 0);
11474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11475 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11476 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11477 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11478 return (uint32_t)ret_conv;
11481 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11482 LDKDecodeError e_conv;
11483 e_conv.inner = (void*)(e & (~1));
11484 e_conv.is_owned = (e & 1) || (e == 0);
11485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11486 e_conv = DecodeError_clone(&e_conv);
11487 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11488 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11489 return (uint32_t)ret_conv;
11492 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11493 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11494 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11498 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11499 if ((_res & 1) != 0) return;
11500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11501 CHECK_ACCESS(_res_ptr);
11502 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11504 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11507 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11508 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11509 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11510 return (uint32_t)ret_conv;
11512 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11513 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11514 uint32_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11518 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11519 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11520 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11521 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11522 return (uint32_t)ret_conv;
11525 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11526 LDKChannelTransactionParameters o_conv;
11527 o_conv.inner = (void*)(o & (~1));
11528 o_conv.is_owned = (o & 1) || (o == 0);
11529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11530 o_conv = ChannelTransactionParameters_clone(&o_conv);
11531 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11532 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11533 return (uint32_t)ret_conv;
11536 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11537 LDKDecodeError e_conv;
11538 e_conv.inner = (void*)(e & (~1));
11539 e_conv.is_owned = (e & 1) || (e == 0);
11540 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11541 e_conv = DecodeError_clone(&e_conv);
11542 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11543 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11544 return (uint32_t)ret_conv;
11547 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11548 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11549 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11553 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11554 if ((_res & 1) != 0) return;
11555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11556 CHECK_ACCESS(_res_ptr);
11557 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11559 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11562 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11563 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11564 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11565 return (uint32_t)ret_conv;
11567 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11568 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11569 uint32_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11573 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11574 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11575 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11576 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11577 return (uint32_t)ret_conv;
11580 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11581 LDKCVec_SignatureZ _res_constr;
11582 _res_constr.datalen = _res->arr_len;
11583 if (_res_constr.datalen > 0)
11584 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11586 _res_constr.data = NULL;
11587 int8_tArray* _res_vals = (void*) _res->elems;
11588 for (size_t m = 0; m < _res_constr.datalen; m++) {
11589 int8_tArray _res_conv_12 = _res_vals[m];
11590 LDKSignature _res_conv_12_ref;
11591 CHECK(_res_conv_12->arr_len == 64);
11592 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11593 _res_constr.data[m] = _res_conv_12_ref;
11596 CVec_SignatureZ_free(_res_constr);
11599 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11600 LDKHolderCommitmentTransaction o_conv;
11601 o_conv.inner = (void*)(o & (~1));
11602 o_conv.is_owned = (o & 1) || (o == 0);
11603 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11604 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11605 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11606 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11607 return (uint32_t)ret_conv;
11610 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11611 LDKDecodeError e_conv;
11612 e_conv.inner = (void*)(e & (~1));
11613 e_conv.is_owned = (e & 1) || (e == 0);
11614 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11615 e_conv = DecodeError_clone(&e_conv);
11616 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11617 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11618 return (uint32_t)ret_conv;
11621 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11622 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
11623 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11627 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11628 if ((_res & 1) != 0) return;
11629 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11630 CHECK_ACCESS(_res_ptr);
11631 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11633 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11636 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11637 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11638 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11639 return (uint32_t)ret_conv;
11641 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11642 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11643 uint32_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11647 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11648 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11649 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11650 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11651 return (uint32_t)ret_conv;
11654 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11655 LDKBuiltCommitmentTransaction o_conv;
11656 o_conv.inner = (void*)(o & (~1));
11657 o_conv.is_owned = (o & 1) || (o == 0);
11658 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11659 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11660 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11661 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11662 return (uint32_t)ret_conv;
11665 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11666 LDKDecodeError e_conv;
11667 e_conv.inner = (void*)(e & (~1));
11668 e_conv.is_owned = (e & 1) || (e == 0);
11669 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11670 e_conv = DecodeError_clone(&e_conv);
11671 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11672 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11673 return (uint32_t)ret_conv;
11676 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11677 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
11678 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11682 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11683 if ((_res & 1) != 0) return;
11684 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11685 CHECK_ACCESS(_res_ptr);
11686 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11688 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11691 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11692 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11693 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
11694 return (uint32_t)ret_conv;
11696 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11697 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11698 uint32_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11702 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11703 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11704 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11705 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11706 return (uint32_t)ret_conv;
11709 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
11710 LDKTrustedClosingTransaction o_conv;
11711 o_conv.inner = (void*)(o & (~1));
11712 o_conv.is_owned = (o & 1) || (o == 0);
11713 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11714 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11715 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11716 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11717 return (uint32_t)ret_conv;
11720 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11721 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11722 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11723 return (uint32_t)ret_conv;
11726 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
11727 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
11728 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11732 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
11733 if ((_res & 1) != 0) return;
11734 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11735 CHECK_ACCESS(_res_ptr);
11736 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11738 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11741 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11742 LDKCommitmentTransaction o_conv;
11743 o_conv.inner = (void*)(o & (~1));
11744 o_conv.is_owned = (o & 1) || (o == 0);
11745 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11746 o_conv = CommitmentTransaction_clone(&o_conv);
11747 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11748 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11749 return (uint32_t)ret_conv;
11752 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11753 LDKDecodeError e_conv;
11754 e_conv.inner = (void*)(e & (~1));
11755 e_conv.is_owned = (e & 1) || (e == 0);
11756 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11757 e_conv = DecodeError_clone(&e_conv);
11758 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11759 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11760 return (uint32_t)ret_conv;
11763 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11764 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
11765 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11769 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11770 if ((_res & 1) != 0) return;
11771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11772 CHECK_ACCESS(_res_ptr);
11773 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11775 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11778 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11779 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11780 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11781 return (uint32_t)ret_conv;
11783 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11784 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
11785 uint32_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11789 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11790 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11791 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11792 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11793 return (uint32_t)ret_conv;
11796 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
11797 LDKTrustedCommitmentTransaction o_conv;
11798 o_conv.inner = (void*)(o & (~1));
11799 o_conv.is_owned = (o & 1) || (o == 0);
11800 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11801 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11802 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11803 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11804 return (uint32_t)ret_conv;
11807 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11808 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11809 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11810 return (uint32_t)ret_conv;
11813 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
11814 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
11815 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11819 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
11820 if ((_res & 1) != 0) return;
11821 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11822 CHECK_ACCESS(_res_ptr);
11823 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11825 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11828 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11829 LDKCVec_SignatureZ o_constr;
11830 o_constr.datalen = o->arr_len;
11831 if (o_constr.datalen > 0)
11832 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11834 o_constr.data = NULL;
11835 int8_tArray* o_vals = (void*) o->elems;
11836 for (size_t m = 0; m < o_constr.datalen; m++) {
11837 int8_tArray o_conv_12 = o_vals[m];
11838 LDKSignature o_conv_12_ref;
11839 CHECK(o_conv_12->arr_len == 64);
11840 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11841 o_constr.data[m] = o_conv_12_ref;
11844 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11845 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11846 return (uint32_t)ret_conv;
11849 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11850 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11851 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11852 return (uint32_t)ret_conv;
11855 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
11856 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
11857 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11861 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
11862 if ((_res & 1) != 0) return;
11863 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11864 CHECK_ACCESS(_res_ptr);
11865 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11867 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11870 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11871 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11872 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11873 return (uint32_t)ret_conv;
11875 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
11876 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
11877 uint32_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11881 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
11882 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11883 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11884 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11885 return (uint32_t)ret_conv;
11888 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
11889 LDKShutdownScript o_conv;
11890 o_conv.inner = (void*)(o & (~1));
11891 o_conv.is_owned = (o & 1) || (o == 0);
11892 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11893 o_conv = ShutdownScript_clone(&o_conv);
11894 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11895 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11896 return (uint32_t)ret_conv;
11899 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
11900 LDKDecodeError e_conv;
11901 e_conv.inner = (void*)(e & (~1));
11902 e_conv.is_owned = (e & 1) || (e == 0);
11903 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11904 e_conv = DecodeError_clone(&e_conv);
11905 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11906 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11907 return (uint32_t)ret_conv;
11910 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
11911 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
11912 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11916 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
11917 if ((_res & 1) != 0) return;
11918 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11919 CHECK_ACCESS(_res_ptr);
11920 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11922 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11925 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11926 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11927 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11928 return (uint32_t)ret_conv;
11930 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
11931 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
11932 uint32_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11936 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
11937 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11938 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11939 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11940 return (uint32_t)ret_conv;
11943 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
11944 LDKShutdownScript o_conv;
11945 o_conv.inner = (void*)(o & (~1));
11946 o_conv.is_owned = (o & 1) || (o == 0);
11947 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11948 o_conv = ShutdownScript_clone(&o_conv);
11949 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11950 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11951 return (uint32_t)ret_conv;
11954 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
11955 LDKInvalidShutdownScript e_conv;
11956 e_conv.inner = (void*)(e & (~1));
11957 e_conv.is_owned = (e & 1) || (e == 0);
11958 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11959 e_conv = InvalidShutdownScript_clone(&e_conv);
11960 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11961 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11962 return (uint32_t)ret_conv;
11965 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
11966 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
11967 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11971 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
11972 if ((_res & 1) != 0) return;
11973 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11974 CHECK_ACCESS(_res_ptr);
11975 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11977 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11980 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11981 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11982 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11983 return (uint32_t)ret_conv;
11985 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
11986 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
11987 uint32_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11991 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
11992 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11993 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11994 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11995 return (uint32_t)ret_conv;
11998 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
11999 LDKRouteHop o_conv;
12000 o_conv.inner = (void*)(o & (~1));
12001 o_conv.is_owned = (o & 1) || (o == 0);
12002 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12003 o_conv = RouteHop_clone(&o_conv);
12004 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12005 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12006 return (uint32_t)ret_conv;
12009 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
12010 LDKDecodeError e_conv;
12011 e_conv.inner = (void*)(e & (~1));
12012 e_conv.is_owned = (e & 1) || (e == 0);
12013 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12014 e_conv = DecodeError_clone(&e_conv);
12015 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12016 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12017 return (uint32_t)ret_conv;
12020 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
12021 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
12022 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12026 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
12027 if ((_res & 1) != 0) return;
12028 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12029 CHECK_ACCESS(_res_ptr);
12030 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12032 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12035 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12036 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12037 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12038 return (uint32_t)ret_conv;
12040 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12041 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
12042 uint32_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12046 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
12047 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12048 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12049 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12050 return (uint32_t)ret_conv;
12053 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
12054 LDKCVec_RouteHopZ _res_constr;
12055 _res_constr.datalen = _res->arr_len;
12056 if (_res_constr.datalen > 0)
12057 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12059 _res_constr.data = NULL;
12060 uint32_t* _res_vals = _res->elems;
12061 for (size_t k = 0; k < _res_constr.datalen; k++) {
12062 uint32_t _res_conv_10 = _res_vals[k];
12063 LDKRouteHop _res_conv_10_conv;
12064 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12065 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12066 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12067 _res_constr.data[k] = _res_conv_10_conv;
12070 CVec_RouteHopZ_free(_res_constr);
12073 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12074 LDKCVec_CVec_RouteHopZZ _res_constr;
12075 _res_constr.datalen = _res->arr_len;
12076 if (_res_constr.datalen > 0)
12077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12079 _res_constr.data = NULL;
12080 uint32_tArray* _res_vals = (void*) _res->elems;
12081 for (size_t m = 0; m < _res_constr.datalen; m++) {
12082 uint32_tArray _res_conv_12 = _res_vals[m];
12083 LDKCVec_RouteHopZ _res_conv_12_constr;
12084 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12085 if (_res_conv_12_constr.datalen > 0)
12086 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12088 _res_conv_12_constr.data = NULL;
12089 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
12090 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12091 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12092 LDKRouteHop _res_conv_12_conv_10_conv;
12093 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12094 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12095 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12096 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12098 FREE(_res_conv_12);
12099 _res_constr.data[m] = _res_conv_12_constr;
12102 CVec_CVec_RouteHopZZ_free(_res_constr);
12105 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
12107 o_conv.inner = (void*)(o & (~1));
12108 o_conv.is_owned = (o & 1) || (o == 0);
12109 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12110 o_conv = Route_clone(&o_conv);
12111 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12112 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12113 return (uint32_t)ret_conv;
12116 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
12117 LDKDecodeError e_conv;
12118 e_conv.inner = (void*)(e & (~1));
12119 e_conv.is_owned = (e & 1) || (e == 0);
12120 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12121 e_conv = DecodeError_clone(&e_conv);
12122 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12123 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12124 return (uint32_t)ret_conv;
12127 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
12128 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
12129 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12133 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
12134 if ((_res & 1) != 0) return;
12135 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12136 CHECK_ACCESS(_res_ptr);
12137 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12139 CResult_RouteDecodeErrorZ_free(_res_conv);
12142 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12143 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12144 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12145 return (uint32_t)ret_conv;
12147 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
12148 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
12149 uint32_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12153 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
12154 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12155 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12156 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12157 return (uint32_t)ret_conv;
12160 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
12161 LDKRouteParameters o_conv;
12162 o_conv.inner = (void*)(o & (~1));
12163 o_conv.is_owned = (o & 1) || (o == 0);
12164 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12165 o_conv = RouteParameters_clone(&o_conv);
12166 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12167 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12168 return (uint32_t)ret_conv;
12171 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
12172 LDKDecodeError e_conv;
12173 e_conv.inner = (void*)(e & (~1));
12174 e_conv.is_owned = (e & 1) || (e == 0);
12175 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12176 e_conv = DecodeError_clone(&e_conv);
12177 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12178 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12179 return (uint32_t)ret_conv;
12182 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
12183 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
12184 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12188 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
12189 if ((_res & 1) != 0) return;
12190 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12191 CHECK_ACCESS(_res_ptr);
12192 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12194 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12197 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12198 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12199 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12200 return (uint32_t)ret_conv;
12202 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12203 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
12204 uint32_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12208 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
12209 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12210 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12211 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12212 return (uint32_t)ret_conv;
12215 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
12216 LDKCVec_RouteHintZ _res_constr;
12217 _res_constr.datalen = _res->arr_len;
12218 if (_res_constr.datalen > 0)
12219 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12221 _res_constr.data = NULL;
12222 uint32_t* _res_vals = _res->elems;
12223 for (size_t l = 0; l < _res_constr.datalen; l++) {
12224 uint32_t _res_conv_11 = _res_vals[l];
12225 LDKRouteHint _res_conv_11_conv;
12226 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12227 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12228 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12229 _res_constr.data[l] = _res_conv_11_conv;
12232 CVec_RouteHintZ_free(_res_constr);
12235 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12236 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12237 *ret_copy = COption_u64Z_some(o);
12238 uint32_t ret_ref = (uintptr_t)ret_copy;
12242 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12243 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12244 *ret_copy = COption_u64Z_none();
12245 uint32_t ret_ref = (uintptr_t)ret_copy;
12249 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
12250 if ((_res & 1) != 0) return;
12251 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12252 CHECK_ACCESS(_res_ptr);
12253 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12255 COption_u64Z_free(_res_conv);
12258 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12259 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12260 *ret_copy = COption_u64Z_clone(arg);
12261 uint32_t ret_ref = (uintptr_t)ret_copy;
12264 uint32_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
12265 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
12266 uint32_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12270 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
12271 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12272 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12273 *ret_copy = COption_u64Z_clone(orig_conv);
12274 uint32_t ret_ref = (uintptr_t)ret_copy;
12278 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
12279 LDKPaymentParameters o_conv;
12280 o_conv.inner = (void*)(o & (~1));
12281 o_conv.is_owned = (o & 1) || (o == 0);
12282 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12283 o_conv = PaymentParameters_clone(&o_conv);
12284 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12285 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12286 return (uint32_t)ret_conv;
12289 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
12290 LDKDecodeError e_conv;
12291 e_conv.inner = (void*)(e & (~1));
12292 e_conv.is_owned = (e & 1) || (e == 0);
12293 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12294 e_conv = DecodeError_clone(&e_conv);
12295 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12296 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12297 return (uint32_t)ret_conv;
12300 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
12301 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
12302 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12306 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
12307 if ((_res & 1) != 0) return;
12308 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12309 CHECK_ACCESS(_res_ptr);
12310 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12312 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12315 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12316 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12317 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12318 return (uint32_t)ret_conv;
12320 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12321 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
12322 uint32_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12326 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
12327 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
12328 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12329 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12330 return (uint32_t)ret_conv;
12333 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
12334 LDKCVec_RouteHintHopZ _res_constr;
12335 _res_constr.datalen = _res->arr_len;
12336 if (_res_constr.datalen > 0)
12337 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12339 _res_constr.data = NULL;
12340 uint32_t* _res_vals = _res->elems;
12341 for (size_t o = 0; o < _res_constr.datalen; o++) {
12342 uint32_t _res_conv_14 = _res_vals[o];
12343 LDKRouteHintHop _res_conv_14_conv;
12344 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12345 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12346 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12347 _res_constr.data[o] = _res_conv_14_conv;
12350 CVec_RouteHintHopZ_free(_res_constr);
12353 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
12354 LDKRouteHint o_conv;
12355 o_conv.inner = (void*)(o & (~1));
12356 o_conv.is_owned = (o & 1) || (o == 0);
12357 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12358 o_conv = RouteHint_clone(&o_conv);
12359 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12360 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12361 return (uint32_t)ret_conv;
12364 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
12365 LDKDecodeError e_conv;
12366 e_conv.inner = (void*)(e & (~1));
12367 e_conv.is_owned = (e & 1) || (e == 0);
12368 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12369 e_conv = DecodeError_clone(&e_conv);
12370 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12371 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12372 return (uint32_t)ret_conv;
12375 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
12376 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
12377 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12381 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
12382 if ((_res & 1) != 0) return;
12383 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12384 CHECK_ACCESS(_res_ptr);
12385 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12387 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12390 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12391 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12392 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12393 return (uint32_t)ret_conv;
12395 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
12396 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
12397 uint32_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12401 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
12402 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12403 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12404 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12405 return (uint32_t)ret_conv;
12408 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
12409 LDKRouteHintHop o_conv;
12410 o_conv.inner = (void*)(o & (~1));
12411 o_conv.is_owned = (o & 1) || (o == 0);
12412 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12413 o_conv = RouteHintHop_clone(&o_conv);
12414 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12415 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12416 return (uint32_t)ret_conv;
12419 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
12420 LDKDecodeError e_conv;
12421 e_conv.inner = (void*)(e & (~1));
12422 e_conv.is_owned = (e & 1) || (e == 0);
12423 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12424 e_conv = DecodeError_clone(&e_conv);
12425 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12426 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12427 return (uint32_t)ret_conv;
12430 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
12431 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
12432 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12436 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
12437 if ((_res & 1) != 0) return;
12438 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12439 CHECK_ACCESS(_res_ptr);
12440 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12442 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12445 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12446 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12447 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12448 return (uint32_t)ret_conv;
12450 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12451 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
12452 uint32_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12456 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
12457 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12458 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12459 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12460 return (uint32_t)ret_conv;
12463 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
12464 LDKCVec_ChannelDetailsZ _res_constr;
12465 _res_constr.datalen = _res->arr_len;
12466 if (_res_constr.datalen > 0)
12467 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12469 _res_constr.data = NULL;
12470 uint32_t* _res_vals = _res->elems;
12471 for (size_t q = 0; q < _res_constr.datalen; q++) {
12472 uint32_t _res_conv_16 = _res_vals[q];
12473 LDKChannelDetails _res_conv_16_conv;
12474 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12475 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12476 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12477 _res_constr.data[q] = _res_conv_16_conv;
12480 CVec_ChannelDetailsZ_free(_res_constr);
12483 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
12485 o_conv.inner = (void*)(o & (~1));
12486 o_conv.is_owned = (o & 1) || (o == 0);
12487 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12488 o_conv = Route_clone(&o_conv);
12489 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12490 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12491 return (uint32_t)ret_conv;
12494 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
12495 LDKLightningError e_conv;
12496 e_conv.inner = (void*)(e & (~1));
12497 e_conv.is_owned = (e & 1) || (e == 0);
12498 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12499 e_conv = LightningError_clone(&e_conv);
12500 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12501 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12502 return (uint32_t)ret_conv;
12505 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
12506 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
12507 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12511 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
12512 if ((_res & 1) != 0) return;
12513 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12514 CHECK_ACCESS(_res_ptr);
12515 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12517 CResult_RouteLightningErrorZ_free(_res_conv);
12520 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12521 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12522 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12523 return (uint32_t)ret_conv;
12525 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
12526 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
12527 uint32_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12531 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
12532 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12533 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12534 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12535 return (uint32_t)ret_conv;
12538 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12539 LDKCVec_PublicKeyZ _res_constr;
12540 _res_constr.datalen = _res->arr_len;
12541 if (_res_constr.datalen > 0)
12542 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12544 _res_constr.data = NULL;
12545 int8_tArray* _res_vals = (void*) _res->elems;
12546 for (size_t m = 0; m < _res_constr.datalen; m++) {
12547 int8_tArray _res_conv_12 = _res_vals[m];
12548 LDKPublicKey _res_conv_12_ref;
12549 CHECK(_res_conv_12->arr_len == 33);
12550 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12551 _res_constr.data[m] = _res_conv_12_ref;
12554 CVec_PublicKeyZ_free(_res_constr);
12557 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint32_t o) {
12558 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12559 CHECK_ACCESS(o_ptr);
12560 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12561 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
12562 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12563 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12564 return (uint32_t)ret_conv;
12567 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint32_t e) {
12568 LDKDecodeError e_conv;
12569 e_conv.inner = (void*)(e & (~1));
12570 e_conv.is_owned = (e & 1) || (e == 0);
12571 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12572 e_conv = DecodeError_clone(&e_conv);
12573 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12574 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12575 return (uint32_t)ret_conv;
12578 jboolean __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint32_t o) {
12579 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
12580 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12584 void __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint32_t _res) {
12585 if ((_res & 1) != 0) return;
12586 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12587 CHECK_ACCESS(_res_ptr);
12588 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12590 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12593 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12594 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12595 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12596 return (uint32_t)ret_conv;
12598 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint32_t arg) {
12599 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
12600 uint32_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12604 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint32_t orig) {
12605 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
12606 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12607 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12608 return (uint32_t)ret_conv;
12611 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
12612 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12613 CHECK_ACCESS(o_ptr);
12614 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12615 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
12616 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12617 *ret_copy = COption_ClosureReasonZ_some(o_conv);
12618 uint32_t ret_ref = (uintptr_t)ret_copy;
12622 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12623 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12624 *ret_copy = COption_ClosureReasonZ_none();
12625 uint32_t ret_ref = (uintptr_t)ret_copy;
12629 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
12630 if ((_res & 1) != 0) return;
12631 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12632 CHECK_ACCESS(_res_ptr);
12633 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12635 COption_ClosureReasonZ_free(_res_conv);
12638 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12639 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12640 *ret_copy = COption_ClosureReasonZ_clone(arg);
12641 uint32_t ret_ref = (uintptr_t)ret_copy;
12644 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
12645 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
12646 uint32_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
12650 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12651 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12652 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12653 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12654 uint32_t ret_ref = (uintptr_t)ret_copy;
12658 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12659 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12660 CHECK_ACCESS(o_ptr);
12661 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12662 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
12663 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12664 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12665 return (uint32_t)ret_conv;
12668 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12669 LDKDecodeError e_conv;
12670 e_conv.inner = (void*)(e & (~1));
12671 e_conv.is_owned = (e & 1) || (e == 0);
12672 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12673 e_conv = DecodeError_clone(&e_conv);
12674 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12675 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12676 return (uint32_t)ret_conv;
12679 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12680 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12681 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12685 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12686 if ((_res & 1) != 0) return;
12687 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12688 CHECK_ACCESS(_res_ptr);
12689 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12691 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12694 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12695 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12696 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12697 return (uint32_t)ret_conv;
12699 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12700 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12701 uint32_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12705 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12706 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12707 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12708 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12709 return (uint32_t)ret_conv;
12712 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12713 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12714 CHECK_ACCESS(o_ptr);
12715 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12716 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
12717 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12718 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12719 uint32_t ret_ref = (uintptr_t)ret_copy;
12723 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12724 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12725 *ret_copy = COption_NetworkUpdateZ_none();
12726 uint32_t ret_ref = (uintptr_t)ret_copy;
12730 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12731 if ((_res & 1) != 0) return;
12732 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12733 CHECK_ACCESS(_res_ptr);
12734 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12736 COption_NetworkUpdateZ_free(_res_conv);
12739 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12740 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12741 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12742 uint32_t ret_ref = (uintptr_t)ret_copy;
12745 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12746 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12747 uint32_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12751 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12752 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12753 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12754 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12755 uint32_t ret_ref = (uintptr_t)ret_copy;
12759 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12760 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12761 _res_constr.datalen = _res->arr_len;
12762 if (_res_constr.datalen > 0)
12763 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12765 _res_constr.data = NULL;
12766 uint32_t* _res_vals = _res->elems;
12767 for (size_t b = 0; b < _res_constr.datalen; b++) {
12768 uint32_t _res_conv_27 = _res_vals[b];
12769 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
12770 CHECK_ACCESS(_res_conv_27_ptr);
12771 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12772 FREE((void*)_res_conv_27);
12773 _res_constr.data[b] = _res_conv_27_conv;
12776 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12779 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12780 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12781 CHECK_ACCESS(o_ptr);
12782 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12783 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
12784 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12785 *ret_copy = COption_EventZ_some(o_conv);
12786 uint32_t ret_ref = (uintptr_t)ret_copy;
12790 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12791 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12792 *ret_copy = COption_EventZ_none();
12793 uint32_t ret_ref = (uintptr_t)ret_copy;
12797 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12798 if ((_res & 1) != 0) return;
12799 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12800 CHECK_ACCESS(_res_ptr);
12801 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12803 COption_EventZ_free(_res_conv);
12806 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12807 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12808 *ret_copy = COption_EventZ_clone(arg);
12809 uint32_t ret_ref = (uintptr_t)ret_copy;
12812 uint32_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12813 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12814 uint32_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
12818 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12819 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12820 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12821 *ret_copy = COption_EventZ_clone(orig_conv);
12822 uint32_t ret_ref = (uintptr_t)ret_copy;
12826 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12827 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12828 CHECK_ACCESS(o_ptr);
12829 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12830 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
12831 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12832 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12833 return (uint32_t)ret_conv;
12836 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12837 LDKDecodeError e_conv;
12838 e_conv.inner = (void*)(e & (~1));
12839 e_conv.is_owned = (e & 1) || (e == 0);
12840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12841 e_conv = DecodeError_clone(&e_conv);
12842 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12843 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12844 return (uint32_t)ret_conv;
12847 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12848 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12849 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12853 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12854 if ((_res & 1) != 0) return;
12855 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12856 CHECK_ACCESS(_res_ptr);
12857 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12859 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12862 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12863 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12864 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12865 return (uint32_t)ret_conv;
12867 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12868 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12869 uint32_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12873 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12874 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12875 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12876 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12877 return (uint32_t)ret_conv;
12880 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
12881 LDKCVec_MessageSendEventZ _res_constr;
12882 _res_constr.datalen = _res->arr_len;
12883 if (_res_constr.datalen > 0)
12884 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12886 _res_constr.data = NULL;
12887 uint32_t* _res_vals = _res->elems;
12888 for (size_t s = 0; s < _res_constr.datalen; s++) {
12889 uint32_t _res_conv_18 = _res_vals[s];
12890 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
12891 CHECK_ACCESS(_res_conv_18_ptr);
12892 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12893 FREE((void*)_res_conv_18);
12894 _res_constr.data[s] = _res_conv_18_conv;
12897 CVec_MessageSendEventZ_free(_res_constr);
12900 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
12901 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12902 CHECK_ACCESS(o_ptr);
12903 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12904 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
12905 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12906 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12907 return (uint32_t)ret_conv;
12910 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12911 LDKAccessError e_conv = LDKAccessError_from_js(e);
12912 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12913 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12914 return (uint32_t)ret_conv;
12917 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
12918 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
12919 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12923 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
12924 if ((_res & 1) != 0) return;
12925 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12926 CHECK_ACCESS(_res_ptr);
12927 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12929 CResult_TxOutAccessErrorZ_free(_res_conv);
12932 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12933 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12934 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12935 return (uint32_t)ret_conv;
12937 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
12938 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
12939 uint32_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12943 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
12944 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
12945 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12946 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12947 return (uint32_t)ret_conv;
12950 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12951 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12952 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12953 return ((uint32_t)ret_conv);
12955 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
12956 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
12957 uint32_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12961 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
12962 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12963 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12964 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12965 return ((uint32_t)ret_conv);
12968 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12969 LDKTransaction b_ref;
12970 b_ref.datalen = b->arr_len;
12971 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12972 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12973 b_ref.data_is_owned = true;
12974 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12975 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12976 return ((uint32_t)ret_conv);
12979 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
12980 if ((_res & 1) != 0) return;
12981 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12982 CHECK_ACCESS(_res_ptr);
12983 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12985 C2Tuple_usizeTransactionZ_free(_res_conv);
12988 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
12989 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12990 _res_constr.datalen = _res->arr_len;
12991 if (_res_constr.datalen > 0)
12992 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12994 _res_constr.data = NULL;
12995 uint32_t* _res_vals = _res->elems;
12996 for (size_t c = 0; c < _res_constr.datalen; c++) {
12997 uint32_t _res_conv_28 = _res_vals[c];
12998 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
12999 CHECK_ACCESS(_res_conv_28_ptr);
13000 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13001 FREE((void*)_res_conv_28);
13002 _res_constr.data[c] = _res_conv_28_conv;
13005 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13008 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13009 LDKCVec_TxidZ _res_constr;
13010 _res_constr.datalen = _res->arr_len;
13011 if (_res_constr.datalen > 0)
13012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13014 _res_constr.data = NULL;
13015 int8_tArray* _res_vals = (void*) _res->elems;
13016 for (size_t m = 0; m < _res_constr.datalen; m++) {
13017 int8_tArray _res_conv_12 = _res_vals[m];
13018 LDKThirtyTwoBytes _res_conv_12_ref;
13019 CHECK(_res_conv_12->arr_len == 32);
13020 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13021 _res_constr.data[m] = _res_conv_12_ref;
13024 CVec_TxidZ_free(_res_constr);
13027 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
13028 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13029 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13030 return (uint32_t)ret_conv;
13033 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13034 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13035 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13036 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13037 return (uint32_t)ret_conv;
13040 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
13041 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
13042 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13046 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
13047 if ((_res & 1) != 0) return;
13048 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13049 CHECK_ACCESS(_res_ptr);
13050 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13052 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13055 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13056 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13057 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13058 return (uint32_t)ret_conv;
13060 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
13061 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
13062 uint32_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13066 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
13067 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
13068 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13069 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13070 return (uint32_t)ret_conv;
13073 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
13074 LDKCVec_MonitorEventZ _res_constr;
13075 _res_constr.datalen = _res->arr_len;
13076 if (_res_constr.datalen > 0)
13077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13079 _res_constr.data = NULL;
13080 uint32_t* _res_vals = _res->elems;
13081 for (size_t o = 0; o < _res_constr.datalen; o++) {
13082 uint32_t _res_conv_14 = _res_vals[o];
13083 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
13084 CHECK_ACCESS(_res_conv_14_ptr);
13085 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13086 FREE((void*)_res_conv_14);
13087 _res_constr.data[o] = _res_conv_14_conv;
13090 CVec_MonitorEventZ_free(_res_constr);
13093 static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) {
13094 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13095 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg);
13096 return ((uint32_t)ret_conv);
13098 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(uint32_t arg) {
13099 LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1);
13100 uint32_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv);
13104 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone(uint32_t orig) {
13105 LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1);
13106 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13107 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv);
13108 return ((uint32_t)ret_conv);
13111 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_new(uint32_t a, uint32_tArray b) {
13112 LDKOutPoint a_conv;
13113 a_conv.inner = (void*)(a & (~1));
13114 a_conv.is_owned = (a & 1) || (a == 0);
13115 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13116 a_conv = OutPoint_clone(&a_conv);
13117 LDKCVec_MonitorEventZ b_constr;
13118 b_constr.datalen = b->arr_len;
13119 if (b_constr.datalen > 0)
13120 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13122 b_constr.data = NULL;
13123 uint32_t* b_vals = b->elems;
13124 for (size_t o = 0; o < b_constr.datalen; o++) {
13125 uint32_t b_conv_14 = b_vals[o];
13126 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
13127 CHECK_ACCESS(b_conv_14_ptr);
13128 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13129 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
13130 b_constr.data[o] = b_conv_14_conv;
13133 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13134 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr);
13135 return ((uint32_t)ret_conv);
13138 void __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_free(uint32_t _res) {
13139 if ((_res & 1) != 0) return;
13140 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13141 CHECK_ACCESS(_res_ptr);
13142 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr);
13144 C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv);
13147 void __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(uint32_tArray _res) {
13148 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr;
13149 _res_constr.datalen = _res->arr_len;
13150 if (_res_constr.datalen > 0)
13151 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
13153 _res_constr.data = NULL;
13154 uint32_t* _res_vals = _res->elems;
13155 for (size_t m = 0; m < _res_constr.datalen; m++) {
13156 uint32_t _res_conv_38 = _res_vals[m];
13157 void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1);
13158 CHECK_ACCESS(_res_conv_38_ptr);
13159 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr);
13160 FREE((void*)_res_conv_38);
13161 _res_constr.data[m] = _res_conv_38_conv;
13164 CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr);
13167 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
13168 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13169 CHECK_ACCESS(o_ptr);
13170 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
13171 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
13172 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13173 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
13174 uint32_t ret_ref = (uintptr_t)ret_copy;
13178 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
13179 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13180 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
13181 uint32_t ret_ref = (uintptr_t)ret_copy;
13185 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
13186 if ((_res & 1) != 0) return;
13187 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13188 CHECK_ACCESS(_res_ptr);
13189 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
13191 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
13194 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
13195 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13196 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
13197 uint32_t ret_ref = (uintptr_t)ret_copy;
13200 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
13201 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
13202 uint32_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
13206 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
13207 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
13208 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13209 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
13210 uint32_t ret_ref = (uintptr_t)ret_copy;
13214 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
13215 LDKFixedPenaltyScorer o_conv;
13216 o_conv.inner = (void*)(o & (~1));
13217 o_conv.is_owned = (o & 1) || (o == 0);
13218 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13219 o_conv = FixedPenaltyScorer_clone(&o_conv);
13220 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13221 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13222 return (uint32_t)ret_conv;
13225 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
13226 LDKDecodeError e_conv;
13227 e_conv.inner = (void*)(e & (~1));
13228 e_conv.is_owned = (e & 1) || (e == 0);
13229 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13230 e_conv = DecodeError_clone(&e_conv);
13231 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13232 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13233 return (uint32_t)ret_conv;
13236 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
13237 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
13238 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13242 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_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_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13248 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13251 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13252 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13253 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13254 return (uint32_t)ret_conv;
13256 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
13257 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
13258 uint32_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13262 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
13263 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
13264 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13265 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13266 return (uint32_t)ret_conv;
13269 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint32_t o) {
13270 LDKProbabilisticScorer o_conv;
13271 o_conv.inner = (void*)(o & (~1));
13272 o_conv.is_owned = (o & 1) || (o == 0);
13273 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13274 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13275 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13276 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13277 return (uint32_t)ret_conv;
13280 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint32_t e) {
13281 LDKDecodeError e_conv;
13282 e_conv.inner = (void*)(e & (~1));
13283 e_conv.is_owned = (e & 1) || (e == 0);
13284 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13285 e_conv = DecodeError_clone(&e_conv);
13286 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13287 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13288 return (uint32_t)ret_conv;
13291 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint32_t o) {
13292 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
13293 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13297 void __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint32_t _res) {
13298 if ((_res & 1) != 0) return;
13299 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13300 CHECK_ACCESS(_res_ptr);
13301 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13303 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13306 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
13307 LDKInitFeatures o_conv;
13308 o_conv.inner = (void*)(o & (~1));
13309 o_conv.is_owned = (o & 1) || (o == 0);
13310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13311 o_conv = InitFeatures_clone(&o_conv);
13312 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13313 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13314 return (uint32_t)ret_conv;
13317 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
13318 LDKDecodeError e_conv;
13319 e_conv.inner = (void*)(e & (~1));
13320 e_conv.is_owned = (e & 1) || (e == 0);
13321 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13322 e_conv = DecodeError_clone(&e_conv);
13323 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13324 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13325 return (uint32_t)ret_conv;
13328 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13329 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
13330 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13334 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
13335 if ((_res & 1) != 0) return;
13336 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13337 CHECK_ACCESS(_res_ptr);
13338 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13340 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13343 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13344 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13345 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13346 return (uint32_t)ret_conv;
13348 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13349 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
13350 uint32_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13354 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint32_t orig) {
13355 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
13356 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13357 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13358 return (uint32_t)ret_conv;
13361 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
13362 LDKChannelFeatures o_conv;
13363 o_conv.inner = (void*)(o & (~1));
13364 o_conv.is_owned = (o & 1) || (o == 0);
13365 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13366 o_conv = ChannelFeatures_clone(&o_conv);
13367 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13368 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13369 return (uint32_t)ret_conv;
13372 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
13373 LDKDecodeError e_conv;
13374 e_conv.inner = (void*)(e & (~1));
13375 e_conv.is_owned = (e & 1) || (e == 0);
13376 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13377 e_conv = DecodeError_clone(&e_conv);
13378 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13379 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13380 return (uint32_t)ret_conv;
13383 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13384 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
13385 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13389 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
13390 if ((_res & 1) != 0) return;
13391 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13392 CHECK_ACCESS(_res_ptr);
13393 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13395 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13398 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13399 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13400 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13401 return (uint32_t)ret_conv;
13403 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13404 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
13405 uint32_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13409 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint32_t orig) {
13410 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
13411 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13412 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13413 return (uint32_t)ret_conv;
13416 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
13417 LDKNodeFeatures o_conv;
13418 o_conv.inner = (void*)(o & (~1));
13419 o_conv.is_owned = (o & 1) || (o == 0);
13420 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13421 o_conv = NodeFeatures_clone(&o_conv);
13422 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13423 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13424 return (uint32_t)ret_conv;
13427 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
13428 LDKDecodeError e_conv;
13429 e_conv.inner = (void*)(e & (~1));
13430 e_conv.is_owned = (e & 1) || (e == 0);
13431 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13432 e_conv = DecodeError_clone(&e_conv);
13433 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13434 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13435 return (uint32_t)ret_conv;
13438 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13439 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
13440 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13444 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
13445 if ((_res & 1) != 0) return;
13446 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13447 CHECK_ACCESS(_res_ptr);
13448 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13450 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13453 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13454 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13455 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13456 return (uint32_t)ret_conv;
13458 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13459 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
13460 uint32_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13464 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13465 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
13466 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13467 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13468 return (uint32_t)ret_conv;
13471 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
13472 LDKInvoiceFeatures o_conv;
13473 o_conv.inner = (void*)(o & (~1));
13474 o_conv.is_owned = (o & 1) || (o == 0);
13475 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13476 o_conv = InvoiceFeatures_clone(&o_conv);
13477 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13478 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13479 return (uint32_t)ret_conv;
13482 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
13483 LDKDecodeError e_conv;
13484 e_conv.inner = (void*)(e & (~1));
13485 e_conv.is_owned = (e & 1) || (e == 0);
13486 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13487 e_conv = DecodeError_clone(&e_conv);
13488 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13489 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13490 return (uint32_t)ret_conv;
13493 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13494 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
13495 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13499 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
13500 if ((_res & 1) != 0) return;
13501 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13502 CHECK_ACCESS(_res_ptr);
13503 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13505 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13508 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13509 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13510 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13511 return (uint32_t)ret_conv;
13513 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13514 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
13515 uint32_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13519 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint32_t orig) {
13520 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
13521 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13522 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13523 return (uint32_t)ret_conv;
13526 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
13527 LDKChannelTypeFeatures o_conv;
13528 o_conv.inner = (void*)(o & (~1));
13529 o_conv.is_owned = (o & 1) || (o == 0);
13530 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13531 o_conv = ChannelTypeFeatures_clone(&o_conv);
13532 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13533 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
13534 return (uint32_t)ret_conv;
13537 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
13538 LDKDecodeError e_conv;
13539 e_conv.inner = (void*)(e & (~1));
13540 e_conv.is_owned = (e & 1) || (e == 0);
13541 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13542 e_conv = DecodeError_clone(&e_conv);
13543 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13544 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
13545 return (uint32_t)ret_conv;
13548 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13549 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
13550 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13554 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
13555 if ((_res & 1) != 0) return;
13556 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13557 CHECK_ACCESS(_res_ptr);
13558 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13560 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13563 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13564 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13565 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
13566 return (uint32_t)ret_conv;
13568 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13569 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
13570 uint32_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13574 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13575 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
13576 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13577 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
13578 return (uint32_t)ret_conv;
13581 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13583 o_conv.inner = (void*)(o & (~1));
13584 o_conv.is_owned = (o & 1) || (o == 0);
13585 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13586 o_conv = NodeId_clone(&o_conv);
13587 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13588 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13589 return (uint32_t)ret_conv;
13592 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13593 LDKDecodeError e_conv;
13594 e_conv.inner = (void*)(e & (~1));
13595 e_conv.is_owned = (e & 1) || (e == 0);
13596 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13597 e_conv = DecodeError_clone(&e_conv);
13598 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13599 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13600 return (uint32_t)ret_conv;
13603 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13604 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13605 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13609 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13610 if ((_res & 1) != 0) return;
13611 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13612 CHECK_ACCESS(_res_ptr);
13613 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13615 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13618 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13619 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13620 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13621 return (uint32_t)ret_conv;
13623 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13624 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13625 uint32_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13629 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13630 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13631 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13632 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13633 return (uint32_t)ret_conv;
13636 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13637 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13638 CHECK_ACCESS(o_ptr);
13639 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13640 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
13641 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13642 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13643 return (uint32_t)ret_conv;
13646 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13647 LDKDecodeError e_conv;
13648 e_conv.inner = (void*)(e & (~1));
13649 e_conv.is_owned = (e & 1) || (e == 0);
13650 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13651 e_conv = DecodeError_clone(&e_conv);
13652 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13653 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13654 return (uint32_t)ret_conv;
13657 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13658 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13659 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13663 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13664 if ((_res & 1) != 0) return;
13665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13666 CHECK_ACCESS(_res_ptr);
13667 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13669 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13672 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13673 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13674 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13675 return (uint32_t)ret_conv;
13677 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
13678 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
13679 uint32_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13683 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
13684 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
13685 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13686 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13687 return (uint32_t)ret_conv;
13690 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
13691 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13692 CHECK_ACCESS(o_ptr);
13693 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13694 if (o_conv.free == LDKAccess_JCalls_free) {
13695 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13696 LDKAccess_JCalls_cloned(&o_conv);
13698 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13699 *ret_copy = COption_AccessZ_some(o_conv);
13700 uint32_t ret_ref = (uintptr_t)ret_copy;
13704 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
13705 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13706 *ret_copy = COption_AccessZ_none();
13707 uint32_t ret_ref = (uintptr_t)ret_copy;
13711 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
13712 if ((_res & 1) != 0) return;
13713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13714 CHECK_ACCESS(_res_ptr);
13715 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13717 COption_AccessZ_free(_res_conv);
13720 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13721 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13722 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13723 return (uint32_t)ret_conv;
13726 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13727 LDKLightningError e_conv;
13728 e_conv.inner = (void*)(e & (~1));
13729 e_conv.is_owned = (e & 1) || (e == 0);
13730 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13731 e_conv = LightningError_clone(&e_conv);
13732 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13733 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13734 return (uint32_t)ret_conv;
13737 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13738 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13739 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
13743 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
13744 if ((_res & 1) != 0) return;
13745 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13746 CHECK_ACCESS(_res_ptr);
13747 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13749 CResult_boolLightningErrorZ_free(_res_conv);
13752 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13753 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13754 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13755 return (uint32_t)ret_conv;
13757 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13758 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13759 uint32_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13763 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13764 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13765 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13766 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13767 return (uint32_t)ret_conv;
13770 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13771 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13772 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13773 return ((uint32_t)ret_conv);
13775 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13776 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13777 uint32_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13781 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13782 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13783 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13784 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13785 return ((uint32_t)ret_conv);
13788 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13789 LDKChannelAnnouncement a_conv;
13790 a_conv.inner = (void*)(a & (~1));
13791 a_conv.is_owned = (a & 1) || (a == 0);
13792 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13793 a_conv = ChannelAnnouncement_clone(&a_conv);
13794 LDKChannelUpdate b_conv;
13795 b_conv.inner = (void*)(b & (~1));
13796 b_conv.is_owned = (b & 1) || (b == 0);
13797 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13798 b_conv = ChannelUpdate_clone(&b_conv);
13799 LDKChannelUpdate c_conv;
13800 c_conv.inner = (void*)(c & (~1));
13801 c_conv.is_owned = (c & 1) || (c == 0);
13802 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13803 c_conv = ChannelUpdate_clone(&c_conv);
13804 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13805 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13806 return ((uint32_t)ret_conv);
13809 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13810 if ((_res & 1) != 0) return;
13811 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13812 CHECK_ACCESS(_res_ptr);
13813 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13815 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13818 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13819 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13820 _res_constr.datalen = _res->arr_len;
13821 if (_res_constr.datalen > 0)
13822 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13824 _res_constr.data = NULL;
13825 uint32_t* _res_vals = _res->elems;
13826 for (size_t h = 0; h < _res_constr.datalen; h++) {
13827 uint32_t _res_conv_59 = _res_vals[h];
13828 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
13829 CHECK_ACCESS(_res_conv_59_ptr);
13830 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13831 FREE((void*)_res_conv_59);
13832 _res_constr.data[h] = _res_conv_59_conv;
13835 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13838 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13839 LDKCVec_NodeAnnouncementZ _res_constr;
13840 _res_constr.datalen = _res->arr_len;
13841 if (_res_constr.datalen > 0)
13842 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13844 _res_constr.data = NULL;
13845 uint32_t* _res_vals = _res->elems;
13846 for (size_t s = 0; s < _res_constr.datalen; s++) {
13847 uint32_t _res_conv_18 = _res_vals[s];
13848 LDKNodeAnnouncement _res_conv_18_conv;
13849 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13850 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13851 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13852 _res_constr.data[s] = _res_conv_18_conv;
13855 CVec_NodeAnnouncementZ_free(_res_constr);
13858 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
13859 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13860 *ret_conv = CResult_NoneLightningErrorZ_ok();
13861 return (uint32_t)ret_conv;
13864 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
13865 LDKLightningError e_conv;
13866 e_conv.inner = (void*)(e & (~1));
13867 e_conv.is_owned = (e & 1) || (e == 0);
13868 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13869 e_conv = LightningError_clone(&e_conv);
13870 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13871 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13872 return (uint32_t)ret_conv;
13875 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13876 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13877 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
13881 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13882 if ((_res & 1) != 0) return;
13883 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13884 CHECK_ACCESS(_res_ptr);
13885 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13887 CResult_NoneLightningErrorZ_free(_res_conv);
13890 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13891 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13892 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13893 return (uint32_t)ret_conv;
13895 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13896 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13897 uint32_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13901 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13902 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13903 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13904 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13905 return (uint32_t)ret_conv;
13908 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
13909 LDKChannelUpdateInfo o_conv;
13910 o_conv.inner = (void*)(o & (~1));
13911 o_conv.is_owned = (o & 1) || (o == 0);
13912 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13913 o_conv = ChannelUpdateInfo_clone(&o_conv);
13914 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13915 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
13916 return (uint32_t)ret_conv;
13919 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
13920 LDKDecodeError e_conv;
13921 e_conv.inner = (void*)(e & (~1));
13922 e_conv.is_owned = (e & 1) || (e == 0);
13923 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13924 e_conv = DecodeError_clone(&e_conv);
13925 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13926 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
13927 return (uint32_t)ret_conv;
13930 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
13931 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
13932 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
13936 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
13937 if ((_res & 1) != 0) return;
13938 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13939 CHECK_ACCESS(_res_ptr);
13940 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
13942 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
13945 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
13946 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13947 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
13948 return (uint32_t)ret_conv;
13950 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13951 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
13952 uint32_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
13956 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
13957 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
13958 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13959 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
13960 return (uint32_t)ret_conv;
13963 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
13964 LDKChannelInfo o_conv;
13965 o_conv.inner = (void*)(o & (~1));
13966 o_conv.is_owned = (o & 1) || (o == 0);
13967 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13968 o_conv = ChannelInfo_clone(&o_conv);
13969 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13970 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13971 return (uint32_t)ret_conv;
13974 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
13975 LDKDecodeError e_conv;
13976 e_conv.inner = (void*)(e & (~1));
13977 e_conv.is_owned = (e & 1) || (e == 0);
13978 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13979 e_conv = DecodeError_clone(&e_conv);
13980 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13981 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13982 return (uint32_t)ret_conv;
13985 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13986 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
13987 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13991 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
13992 if ((_res & 1) != 0) return;
13993 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13994 CHECK_ACCESS(_res_ptr);
13995 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13997 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14000 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14001 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14002 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14003 return (uint32_t)ret_conv;
14005 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14006 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
14007 uint32_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14011 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
14012 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
14013 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14014 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14015 return (uint32_t)ret_conv;
14018 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
14019 LDKRoutingFees o_conv;
14020 o_conv.inner = (void*)(o & (~1));
14021 o_conv.is_owned = (o & 1) || (o == 0);
14022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14023 o_conv = RoutingFees_clone(&o_conv);
14024 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14025 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14026 return (uint32_t)ret_conv;
14029 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
14030 LDKDecodeError e_conv;
14031 e_conv.inner = (void*)(e & (~1));
14032 e_conv.is_owned = (e & 1) || (e == 0);
14033 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14034 e_conv = DecodeError_clone(&e_conv);
14035 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14036 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14037 return (uint32_t)ret_conv;
14040 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
14041 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
14042 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14046 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
14047 if ((_res & 1) != 0) return;
14048 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14049 CHECK_ACCESS(_res_ptr);
14050 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14052 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14055 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14056 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14057 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14058 return (uint32_t)ret_conv;
14060 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
14061 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
14062 uint32_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14066 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
14067 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14068 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14069 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14070 return (uint32_t)ret_conv;
14073 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14074 LDKCVec_NetAddressZ _res_constr;
14075 _res_constr.datalen = _res->arr_len;
14076 if (_res_constr.datalen > 0)
14077 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14079 _res_constr.data = NULL;
14080 uint32_t* _res_vals = _res->elems;
14081 for (size_t m = 0; m < _res_constr.datalen; m++) {
14082 uint32_t _res_conv_12 = _res_vals[m];
14083 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14084 CHECK_ACCESS(_res_conv_12_ptr);
14085 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14086 FREE((void*)_res_conv_12);
14087 _res_constr.data[m] = _res_conv_12_conv;
14090 CVec_NetAddressZ_free(_res_constr);
14093 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
14094 LDKNodeAnnouncementInfo o_conv;
14095 o_conv.inner = (void*)(o & (~1));
14096 o_conv.is_owned = (o & 1) || (o == 0);
14097 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14098 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14099 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14100 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14101 return (uint32_t)ret_conv;
14104 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
14105 LDKDecodeError e_conv;
14106 e_conv.inner = (void*)(e & (~1));
14107 e_conv.is_owned = (e & 1) || (e == 0);
14108 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14109 e_conv = DecodeError_clone(&e_conv);
14110 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14111 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14112 return (uint32_t)ret_conv;
14115 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
14116 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
14117 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14121 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
14122 if ((_res & 1) != 0) return;
14123 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14124 CHECK_ACCESS(_res_ptr);
14125 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14127 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14130 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14131 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14132 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14133 return (uint32_t)ret_conv;
14135 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14136 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
14137 uint32_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14141 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
14142 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14143 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14144 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14145 return (uint32_t)ret_conv;
14148 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
14149 LDKCVec_u64Z _res_constr;
14150 _res_constr.datalen = _res->arr_len;
14151 if (_res_constr.datalen > 0)
14152 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14154 _res_constr.data = NULL;
14155 int64_t* _res_vals = _res->elems;
14156 for (size_t i = 0; i < _res_constr.datalen; i++) {
14157 int64_t _res_conv_8 = _res_vals[i];
14158 _res_constr.data[i] = _res_conv_8;
14161 CVec_u64Z_free(_res_constr);
14164 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
14165 LDKNodeInfo o_conv;
14166 o_conv.inner = (void*)(o & (~1));
14167 o_conv.is_owned = (o & 1) || (o == 0);
14168 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14169 o_conv = NodeInfo_clone(&o_conv);
14170 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14171 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14172 return (uint32_t)ret_conv;
14175 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
14176 LDKDecodeError e_conv;
14177 e_conv.inner = (void*)(e & (~1));
14178 e_conv.is_owned = (e & 1) || (e == 0);
14179 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14180 e_conv = DecodeError_clone(&e_conv);
14181 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14182 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14183 return (uint32_t)ret_conv;
14186 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
14187 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
14188 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14192 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
14193 if ((_res & 1) != 0) return;
14194 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14195 CHECK_ACCESS(_res_ptr);
14196 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14198 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14201 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14202 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14203 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14204 return (uint32_t)ret_conv;
14206 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14207 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
14208 uint32_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14212 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
14213 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14214 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14215 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14216 return (uint32_t)ret_conv;
14219 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
14220 LDKNetworkGraph o_conv;
14221 o_conv.inner = (void*)(o & (~1));
14222 o_conv.is_owned = (o & 1) || (o == 0);
14223 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14224 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14225 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14226 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14227 return (uint32_t)ret_conv;
14230 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
14231 LDKDecodeError e_conv;
14232 e_conv.inner = (void*)(e & (~1));
14233 e_conv.is_owned = (e & 1) || (e == 0);
14234 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14235 e_conv = DecodeError_clone(&e_conv);
14236 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14237 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14238 return (uint32_t)ret_conv;
14241 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
14242 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
14243 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14247 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
14248 if ((_res & 1) != 0) return;
14249 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14250 CHECK_ACCESS(_res_ptr);
14251 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14253 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14256 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
14257 LDKCVec_NetAddressZ o_constr;
14258 o_constr.datalen = o->arr_len;
14259 if (o_constr.datalen > 0)
14260 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14262 o_constr.data = NULL;
14263 uint32_t* o_vals = o->elems;
14264 for (size_t m = 0; m < o_constr.datalen; m++) {
14265 uint32_t o_conv_12 = o_vals[m];
14266 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
14267 CHECK_ACCESS(o_conv_12_ptr);
14268 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14269 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
14270 o_constr.data[m] = o_conv_12_conv;
14273 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14274 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14275 uint32_t ret_ref = (uintptr_t)ret_copy;
14279 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14280 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14281 *ret_copy = COption_CVec_NetAddressZZ_none();
14282 uint32_t ret_ref = (uintptr_t)ret_copy;
14286 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
14287 if ((_res & 1) != 0) return;
14288 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14289 CHECK_ACCESS(_res_ptr);
14290 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14292 COption_CVec_NetAddressZZ_free(_res_conv);
14295 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14296 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14297 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14298 uint32_t ret_ref = (uintptr_t)ret_copy;
14301 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
14302 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
14303 uint32_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14307 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
14308 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14309 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14310 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14311 uint32_t ret_ref = (uintptr_t)ret_copy;
14315 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14316 LDKDelayedPaymentOutputDescriptor o_conv;
14317 o_conv.inner = (void*)(o & (~1));
14318 o_conv.is_owned = (o & 1) || (o == 0);
14319 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14320 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14321 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14322 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14323 return (uint32_t)ret_conv;
14326 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14327 LDKDecodeError e_conv;
14328 e_conv.inner = (void*)(e & (~1));
14329 e_conv.is_owned = (e & 1) || (e == 0);
14330 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14331 e_conv = DecodeError_clone(&e_conv);
14332 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14333 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14334 return (uint32_t)ret_conv;
14337 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14338 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14339 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14343 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14344 if ((_res & 1) != 0) return;
14345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14346 CHECK_ACCESS(_res_ptr);
14347 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14349 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14352 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14353 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14354 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14355 return (uint32_t)ret_conv;
14357 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14358 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14359 uint32_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14363 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14364 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14365 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14366 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14367 return (uint32_t)ret_conv;
14370 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14371 LDKStaticPaymentOutputDescriptor o_conv;
14372 o_conv.inner = (void*)(o & (~1));
14373 o_conv.is_owned = (o & 1) || (o == 0);
14374 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14375 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14376 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14377 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14378 return (uint32_t)ret_conv;
14381 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14382 LDKDecodeError e_conv;
14383 e_conv.inner = (void*)(e & (~1));
14384 e_conv.is_owned = (e & 1) || (e == 0);
14385 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14386 e_conv = DecodeError_clone(&e_conv);
14387 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14388 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14389 return (uint32_t)ret_conv;
14392 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14393 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14394 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14398 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14399 if ((_res & 1) != 0) return;
14400 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14401 CHECK_ACCESS(_res_ptr);
14402 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14404 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14407 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14408 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14409 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14410 return (uint32_t)ret_conv;
14412 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14413 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14414 uint32_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14418 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14419 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14420 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14421 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14422 return (uint32_t)ret_conv;
14425 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14426 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14427 CHECK_ACCESS(o_ptr);
14428 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14429 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
14430 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14431 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14432 return (uint32_t)ret_conv;
14435 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14436 LDKDecodeError e_conv;
14437 e_conv.inner = (void*)(e & (~1));
14438 e_conv.is_owned = (e & 1) || (e == 0);
14439 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14440 e_conv = DecodeError_clone(&e_conv);
14441 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14442 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14443 return (uint32_t)ret_conv;
14446 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14447 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
14448 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14452 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14453 if ((_res & 1) != 0) return;
14454 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14455 CHECK_ACCESS(_res_ptr);
14456 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14458 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14461 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14462 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14463 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14464 return (uint32_t)ret_conv;
14466 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14467 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14468 uint32_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14472 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14473 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14474 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14475 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14476 return (uint32_t)ret_conv;
14479 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14480 LDKCVec_PaymentPreimageZ _res_constr;
14481 _res_constr.datalen = _res->arr_len;
14482 if (_res_constr.datalen > 0)
14483 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14485 _res_constr.data = NULL;
14486 int8_tArray* _res_vals = (void*) _res->elems;
14487 for (size_t m = 0; m < _res_constr.datalen; m++) {
14488 int8_tArray _res_conv_12 = _res_vals[m];
14489 LDKThirtyTwoBytes _res_conv_12_ref;
14490 CHECK(_res_conv_12->arr_len == 32);
14491 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14492 _res_constr.data[m] = _res_conv_12_ref;
14495 CVec_PaymentPreimageZ_free(_res_constr);
14498 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14499 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14500 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14501 return ((uint32_t)ret_conv);
14503 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
14504 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14505 uint32_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14509 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
14510 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14511 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14512 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14513 return ((uint32_t)ret_conv);
14516 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14517 LDKSignature a_ref;
14518 CHECK(a->arr_len == 64);
14519 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14520 LDKCVec_SignatureZ b_constr;
14521 b_constr.datalen = b->arr_len;
14522 if (b_constr.datalen > 0)
14523 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14525 b_constr.data = NULL;
14526 int8_tArray* b_vals = (void*) b->elems;
14527 for (size_t m = 0; m < b_constr.datalen; m++) {
14528 int8_tArray b_conv_12 = b_vals[m];
14529 LDKSignature b_conv_12_ref;
14530 CHECK(b_conv_12->arr_len == 64);
14531 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
14532 b_constr.data[m] = b_conv_12_ref;
14535 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14536 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14537 return ((uint32_t)ret_conv);
14540 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
14541 if ((_res & 1) != 0) return;
14542 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14543 CHECK_ACCESS(_res_ptr);
14544 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14546 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14549 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
14550 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14551 CHECK_ACCESS(o_ptr);
14552 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14553 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
14554 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14555 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14556 return (uint32_t)ret_conv;
14559 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14560 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14561 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14562 return (uint32_t)ret_conv;
14565 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
14566 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14567 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14571 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
14572 if ((_res & 1) != 0) return;
14573 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14574 CHECK_ACCESS(_res_ptr);
14575 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14577 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14580 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14581 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14582 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14583 return (uint32_t)ret_conv;
14585 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
14586 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14587 uint32_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14591 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
14592 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14593 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14594 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14595 return (uint32_t)ret_conv;
14598 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14599 LDKSignature o_ref;
14600 CHECK(o->arr_len == 64);
14601 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
14602 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14603 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14604 return (uint32_t)ret_conv;
14607 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
14608 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14609 *ret_conv = CResult_SignatureNoneZ_err();
14610 return (uint32_t)ret_conv;
14613 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
14614 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14615 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
14619 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
14620 if ((_res & 1) != 0) return;
14621 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14622 CHECK_ACCESS(_res_ptr);
14623 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14625 CResult_SignatureNoneZ_free(_res_conv);
14628 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14629 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14630 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14631 return (uint32_t)ret_conv;
14633 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
14634 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14635 uint32_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14639 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
14640 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14641 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14642 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14643 return (uint32_t)ret_conv;
14646 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
14647 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14648 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
14649 return ((uint32_t)ret_conv);
14651 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
14652 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
14653 uint32_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
14657 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
14658 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
14659 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14660 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
14661 return ((uint32_t)ret_conv);
14664 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
14665 LDKSignature a_ref;
14666 CHECK(a->arr_len == 64);
14667 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14668 LDKSignature b_ref;
14669 CHECK(b->arr_len == 64);
14670 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
14671 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14672 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
14673 return ((uint32_t)ret_conv);
14676 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
14677 if ((_res & 1) != 0) return;
14678 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14679 CHECK_ACCESS(_res_ptr);
14680 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
14682 C2Tuple_SignatureSignatureZ_free(_res_conv);
14685 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
14686 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14687 CHECK_ACCESS(o_ptr);
14688 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
14689 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
14690 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14691 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
14692 return (uint32_t)ret_conv;
14695 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
14696 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14697 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
14698 return (uint32_t)ret_conv;
14701 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
14702 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
14703 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
14707 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
14708 if ((_res & 1) != 0) return;
14709 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14710 CHECK_ACCESS(_res_ptr);
14711 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
14713 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
14716 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
14717 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14718 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
14719 return (uint32_t)ret_conv;
14721 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
14722 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
14723 uint32_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
14727 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
14728 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
14729 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14730 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
14731 return (uint32_t)ret_conv;
14734 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
14735 LDKSecretKey o_ref;
14736 CHECK(o->arr_len == 32);
14737 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
14738 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14739 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
14740 return (uint32_t)ret_conv;
14743 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
14744 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14745 *ret_conv = CResult_SecretKeyNoneZ_err();
14746 return (uint32_t)ret_conv;
14749 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
14750 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
14751 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
14755 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
14756 if ((_res & 1) != 0) return;
14757 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14758 CHECK_ACCESS(_res_ptr);
14759 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
14761 CResult_SecretKeyNoneZ_free(_res_conv);
14764 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
14765 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14766 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
14767 return (uint32_t)ret_conv;
14769 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
14770 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
14771 uint32_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
14775 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
14776 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
14777 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14778 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
14779 return (uint32_t)ret_conv;
14782 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
14783 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14784 CHECK_ACCESS(o_ptr);
14785 LDKSign o_conv = *(LDKSign*)(o_ptr);
14786 if (o_conv.free == LDKSign_JCalls_free) {
14787 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14788 LDKSign_JCalls_cloned(&o_conv);
14790 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14791 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14792 return (uint32_t)ret_conv;
14795 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
14796 LDKDecodeError e_conv;
14797 e_conv.inner = (void*)(e & (~1));
14798 e_conv.is_owned = (e & 1) || (e == 0);
14799 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14800 e_conv = DecodeError_clone(&e_conv);
14801 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14802 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14803 return (uint32_t)ret_conv;
14806 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
14807 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14808 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
14812 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
14813 if ((_res & 1) != 0) return;
14814 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14815 CHECK_ACCESS(_res_ptr);
14816 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14818 CResult_SignDecodeErrorZ_free(_res_conv);
14821 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14822 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14823 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14824 return (uint32_t)ret_conv;
14826 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
14827 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14828 uint32_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14832 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
14833 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14834 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14835 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14836 return (uint32_t)ret_conv;
14839 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
14840 LDKCVec_u5Z _res_constr;
14841 _res_constr.datalen = _res->arr_len;
14842 if (_res_constr.datalen > 0)
14843 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
14845 _res_constr.data = NULL;
14846 int8_t* _res_vals = (void*) _res->elems;
14847 for (size_t h = 0; h < _res_constr.datalen; h++) {
14848 int8_t _res_conv_7 = _res_vals[h];
14850 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
14853 CVec_u5Z_free(_res_constr);
14856 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
14857 LDKRecoverableSignature o_ref;
14858 CHECK(o->arr_len == 68);
14859 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
14860 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14861 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
14862 return (uint32_t)ret_conv;
14865 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14866 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14867 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14868 return (uint32_t)ret_conv;
14871 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
14872 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14873 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14877 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
14878 if ((_res & 1) != 0) return;
14879 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14880 CHECK_ACCESS(_res_ptr);
14881 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14883 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14886 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14887 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14888 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14889 return (uint32_t)ret_conv;
14891 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
14892 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14893 uint32_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14897 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
14898 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14899 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14900 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14901 return (uint32_t)ret_conv;
14904 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14905 LDKCVec_u8Z _res_ref;
14906 _res_ref.datalen = _res->arr_len;
14907 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14908 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14909 CVec_u8Z_free(_res_ref);
14912 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
14913 LDKCVec_CVec_u8ZZ _res_constr;
14914 _res_constr.datalen = _res->arr_len;
14915 if (_res_constr.datalen > 0)
14916 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14918 _res_constr.data = NULL;
14919 int8_tArray* _res_vals = (void*) _res->elems;
14920 for (size_t m = 0; m < _res_constr.datalen; m++) {
14921 int8_tArray _res_conv_12 = _res_vals[m];
14922 LDKCVec_u8Z _res_conv_12_ref;
14923 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
14924 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14925 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
14926 _res_constr.data[m] = _res_conv_12_ref;
14929 CVec_CVec_u8ZZ_free(_res_constr);
14932 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
14933 LDKCVec_CVec_u8ZZ o_constr;
14934 o_constr.datalen = o->arr_len;
14935 if (o_constr.datalen > 0)
14936 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14938 o_constr.data = NULL;
14939 int8_tArray* o_vals = (void*) o->elems;
14940 for (size_t m = 0; m < o_constr.datalen; m++) {
14941 int8_tArray o_conv_12 = o_vals[m];
14942 LDKCVec_u8Z o_conv_12_ref;
14943 o_conv_12_ref.datalen = o_conv_12->arr_len;
14944 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14945 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
14946 o_constr.data[m] = o_conv_12_ref;
14949 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14950 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14951 return (uint32_t)ret_conv;
14954 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
14955 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14956 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14957 return (uint32_t)ret_conv;
14960 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
14961 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
14962 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14966 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
14967 if ((_res & 1) != 0) return;
14968 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14969 CHECK_ACCESS(_res_ptr);
14970 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14972 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14975 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14976 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14977 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14978 return (uint32_t)ret_conv;
14980 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
14981 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
14982 uint32_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14986 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
14987 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
14988 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14989 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14990 return (uint32_t)ret_conv;
14993 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
14994 LDKInMemorySigner o_conv;
14995 o_conv.inner = (void*)(o & (~1));
14996 o_conv.is_owned = (o & 1) || (o == 0);
14997 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14998 o_conv = InMemorySigner_clone(&o_conv);
14999 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15000 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15001 return (uint32_t)ret_conv;
15004 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15005 LDKDecodeError e_conv;
15006 e_conv.inner = (void*)(e & (~1));
15007 e_conv.is_owned = (e & 1) || (e == 0);
15008 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15009 e_conv = DecodeError_clone(&e_conv);
15010 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15011 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15012 return (uint32_t)ret_conv;
15015 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15016 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15017 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15021 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15022 if ((_res & 1) != 0) return;
15023 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15024 CHECK_ACCESS(_res_ptr);
15025 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15027 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15030 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15031 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15032 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15033 return (uint32_t)ret_conv;
15035 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15036 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15037 uint32_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15041 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15042 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15043 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15044 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15045 return (uint32_t)ret_conv;
15048 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15049 LDKCVec_TxOutZ _res_constr;
15050 _res_constr.datalen = _res->arr_len;
15051 if (_res_constr.datalen > 0)
15052 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15054 _res_constr.data = NULL;
15055 uint32_t* _res_vals = _res->elems;
15056 for (size_t h = 0; h < _res_constr.datalen; h++) {
15057 uint32_t _res_conv_7 = _res_vals[h];
15058 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15059 CHECK_ACCESS(_res_conv_7_ptr);
15060 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15061 FREE((void*)_res_conv_7);
15062 _res_constr.data[h] = _res_conv_7_conv;
15065 CVec_TxOutZ_free(_res_constr);
15068 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15069 LDKTransaction o_ref;
15070 o_ref.datalen = o->arr_len;
15071 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15072 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15073 o_ref.data_is_owned = true;
15074 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15075 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15076 return (uint32_t)ret_conv;
15079 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15080 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15081 *ret_conv = CResult_TransactionNoneZ_err();
15082 return (uint32_t)ret_conv;
15085 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15086 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15087 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15091 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15092 if ((_res & 1) != 0) return;
15093 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15094 CHECK_ACCESS(_res_ptr);
15095 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15097 CResult_TransactionNoneZ_free(_res_conv);
15100 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15101 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15102 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15103 return (uint32_t)ret_conv;
15105 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15106 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15107 uint32_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15111 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15112 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15113 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15114 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15115 return (uint32_t)ret_conv;
15118 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15119 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15120 *ret_copy = COption_u16Z_some(o);
15121 uint32_t ret_ref = (uintptr_t)ret_copy;
15125 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15126 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15127 *ret_copy = COption_u16Z_none();
15128 uint32_t ret_ref = (uintptr_t)ret_copy;
15132 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15133 if ((_res & 1) != 0) return;
15134 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15135 CHECK_ACCESS(_res_ptr);
15136 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15138 COption_u16Z_free(_res_conv);
15141 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15142 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15143 *ret_copy = COption_u16Z_clone(arg);
15144 uint32_t ret_ref = (uintptr_t)ret_copy;
15147 uint32_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15148 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15149 uint32_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15153 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15154 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15155 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15156 *ret_copy = COption_u16Z_clone(orig_conv);
15157 uint32_t ret_ref = (uintptr_t)ret_copy;
15161 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15162 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15163 *ret_conv = CResult_NoneAPIErrorZ_ok();
15164 return (uint32_t)ret_conv;
15167 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15168 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15169 CHECK_ACCESS(e_ptr);
15170 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15171 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15172 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15173 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15174 return (uint32_t)ret_conv;
15177 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15178 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15179 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15183 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15184 if ((_res & 1) != 0) return;
15185 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15186 CHECK_ACCESS(_res_ptr);
15187 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15189 CResult_NoneAPIErrorZ_free(_res_conv);
15192 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15193 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15194 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15195 return (uint32_t)ret_conv;
15197 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15198 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15199 uint32_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15203 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15204 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15205 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15206 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15207 return (uint32_t)ret_conv;
15210 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15211 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15212 _res_constr.datalen = _res->arr_len;
15213 if (_res_constr.datalen > 0)
15214 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15216 _res_constr.data = NULL;
15217 uint32_t* _res_vals = _res->elems;
15218 for (size_t w = 0; w < _res_constr.datalen; w++) {
15219 uint32_t _res_conv_22 = _res_vals[w];
15220 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
15221 CHECK_ACCESS(_res_conv_22_ptr);
15222 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15223 FREE((void*)_res_conv_22);
15224 _res_constr.data[w] = _res_conv_22_conv;
15227 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15230 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15231 LDKCVec_APIErrorZ _res_constr;
15232 _res_constr.datalen = _res->arr_len;
15233 if (_res_constr.datalen > 0)
15234 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15236 _res_constr.data = NULL;
15237 uint32_t* _res_vals = _res->elems;
15238 for (size_t k = 0; k < _res_constr.datalen; k++) {
15239 uint32_t _res_conv_10 = _res_vals[k];
15240 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
15241 CHECK_ACCESS(_res_conv_10_ptr);
15242 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15243 FREE((void*)_res_conv_10);
15244 _res_constr.data[k] = _res_conv_10_conv;
15247 CVec_APIErrorZ_free(_res_constr);
15250 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15251 LDKThirtyTwoBytes o_ref;
15252 CHECK(o->arr_len == 32);
15253 memcpy(o_ref.data, o->elems, 32); FREE(o);
15254 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15255 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15256 return (uint32_t)ret_conv;
15259 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15260 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15261 CHECK_ACCESS(e_ptr);
15262 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15263 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15264 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15265 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15266 return (uint32_t)ret_conv;
15269 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15270 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15271 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15275 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_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__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15281 CResult__u832APIErrorZ_free(_res_conv);
15284 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15285 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15286 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15287 return (uint32_t)ret_conv;
15289 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15290 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15291 uint32_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15295 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15296 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15297 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15298 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15299 return (uint32_t)ret_conv;
15302 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15303 LDKThirtyTwoBytes o_ref;
15304 CHECK(o->arr_len == 32);
15305 memcpy(o_ref.data, o->elems, 32); FREE(o);
15306 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15307 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15308 return (uint32_t)ret_conv;
15311 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15312 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15313 CHECK_ACCESS(e_ptr);
15314 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15315 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15316 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15317 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15318 return (uint32_t)ret_conv;
15321 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15322 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15323 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15327 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15328 if ((_res & 1) != 0) return;
15329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15330 CHECK_ACCESS(_res_ptr);
15331 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15333 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15336 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15337 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15338 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15339 return (uint32_t)ret_conv;
15341 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15342 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15343 uint32_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15347 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15348 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15349 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15350 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15351 return (uint32_t)ret_conv;
15354 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15355 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15356 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15357 return (uint32_t)ret_conv;
15360 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15361 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15362 CHECK_ACCESS(e_ptr);
15363 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15364 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15365 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15366 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15367 return (uint32_t)ret_conv;
15370 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15371 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15372 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15376 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15377 if ((_res & 1) != 0) return;
15378 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15379 CHECK_ACCESS(_res_ptr);
15380 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15382 CResult_NonePaymentSendFailureZ_free(_res_conv);
15385 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15386 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15387 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15388 return (uint32_t)ret_conv;
15390 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15391 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15392 uint32_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15396 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15397 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15398 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15399 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15400 return (uint32_t)ret_conv;
15403 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15404 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15405 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15406 return ((uint32_t)ret_conv);
15408 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15409 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15410 uint32_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15414 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15415 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15416 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15417 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15418 return ((uint32_t)ret_conv);
15421 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15422 LDKThirtyTwoBytes a_ref;
15423 CHECK(a->arr_len == 32);
15424 memcpy(a_ref.data, a->elems, 32); FREE(a);
15425 LDKThirtyTwoBytes b_ref;
15426 CHECK(b->arr_len == 32);
15427 memcpy(b_ref.data, b->elems, 32); FREE(b);
15428 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15429 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15430 return ((uint32_t)ret_conv);
15433 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15434 if ((_res & 1) != 0) return;
15435 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15436 CHECK_ACCESS(_res_ptr);
15437 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15439 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15442 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15443 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15444 CHECK_ACCESS(o_ptr);
15445 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15446 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
15447 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15448 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15449 return (uint32_t)ret_conv;
15452 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15453 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15454 CHECK_ACCESS(e_ptr);
15455 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15456 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15457 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15458 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15459 return (uint32_t)ret_conv;
15462 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15463 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15464 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15468 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15469 if ((_res & 1) != 0) return;
15470 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15471 CHECK_ACCESS(_res_ptr);
15472 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15474 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15477 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15478 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15479 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15480 return (uint32_t)ret_conv;
15482 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15483 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15484 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15488 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15489 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15490 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15491 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15492 return (uint32_t)ret_conv;
15495 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15496 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15497 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15498 return ((uint32_t)ret_conv);
15500 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15501 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15502 uint32_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15506 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15507 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15508 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15509 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15510 return ((uint32_t)ret_conv);
15513 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15514 LDKThirtyTwoBytes a_ref;
15515 CHECK(a->arr_len == 32);
15516 memcpy(a_ref.data, a->elems, 32); FREE(a);
15517 LDKThirtyTwoBytes b_ref;
15518 CHECK(b->arr_len == 32);
15519 memcpy(b_ref.data, b->elems, 32); FREE(b);
15520 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15521 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15522 return ((uint32_t)ret_conv);
15525 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15526 if ((_res & 1) != 0) return;
15527 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15528 CHECK_ACCESS(_res_ptr);
15529 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15531 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15534 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
15535 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15536 CHECK_ACCESS(o_ptr);
15537 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15538 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15539 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15540 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15541 return (uint32_t)ret_conv;
15544 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15545 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15546 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15547 return (uint32_t)ret_conv;
15550 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
15551 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15552 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15556 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
15557 if ((_res & 1) != 0) return;
15558 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15559 CHECK_ACCESS(_res_ptr);
15560 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15562 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15565 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15566 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15567 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15568 return (uint32_t)ret_conv;
15570 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
15571 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15572 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15576 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
15577 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15578 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15579 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15580 return (uint32_t)ret_conv;
15583 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
15584 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15585 CHECK_ACCESS(o_ptr);
15586 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15587 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15588 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15589 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15590 return (uint32_t)ret_conv;
15593 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
15594 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15595 CHECK_ACCESS(e_ptr);
15596 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15597 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15598 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15599 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15600 return (uint32_t)ret_conv;
15603 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
15604 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15605 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15609 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
15610 if ((_res & 1) != 0) return;
15611 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15612 CHECK_ACCESS(_res_ptr);
15613 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15615 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15618 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15619 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15620 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15621 return (uint32_t)ret_conv;
15623 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
15624 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15625 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15629 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
15630 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15631 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15632 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15633 return (uint32_t)ret_conv;
15636 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15637 LDKThirtyTwoBytes o_ref;
15638 CHECK(o->arr_len == 32);
15639 memcpy(o_ref.data, o->elems, 32); FREE(o);
15640 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15641 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15642 return (uint32_t)ret_conv;
15645 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
15646 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15647 *ret_conv = CResult_PaymentSecretNoneZ_err();
15648 return (uint32_t)ret_conv;
15651 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
15652 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15653 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15657 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
15658 if ((_res & 1) != 0) return;
15659 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15660 CHECK_ACCESS(_res_ptr);
15661 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15663 CResult_PaymentSecretNoneZ_free(_res_conv);
15666 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15667 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15668 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15669 return (uint32_t)ret_conv;
15671 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
15672 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15673 uint32_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15677 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
15678 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15679 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15680 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15681 return (uint32_t)ret_conv;
15684 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15685 LDKThirtyTwoBytes o_ref;
15686 CHECK(o->arr_len == 32);
15687 memcpy(o_ref.data, o->elems, 32); FREE(o);
15688 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15689 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15690 return (uint32_t)ret_conv;
15693 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
15694 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15695 CHECK_ACCESS(e_ptr);
15696 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15697 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15698 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15699 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15700 return (uint32_t)ret_conv;
15703 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
15704 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15705 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15709 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
15710 if ((_res & 1) != 0) return;
15711 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15712 CHECK_ACCESS(_res_ptr);
15713 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15715 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15718 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15719 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15720 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15721 return (uint32_t)ret_conv;
15723 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
15724 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15725 uint32_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15729 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
15730 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15731 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15732 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15733 return (uint32_t)ret_conv;
15736 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15737 LDKThirtyTwoBytes o_ref;
15738 CHECK(o->arr_len == 32);
15739 memcpy(o_ref.data, o->elems, 32); FREE(o);
15740 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15741 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15742 return (uint32_t)ret_conv;
15745 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
15746 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15747 CHECK_ACCESS(e_ptr);
15748 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15749 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15750 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15751 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15752 return (uint32_t)ret_conv;
15755 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
15756 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15757 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15761 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
15762 if ((_res & 1) != 0) return;
15763 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15764 CHECK_ACCESS(_res_ptr);
15765 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15767 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15770 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15771 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15772 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15773 return (uint32_t)ret_conv;
15775 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
15776 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15777 uint32_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15781 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
15782 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15783 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15784 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15785 return (uint32_t)ret_conv;
15788 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
15789 LDKCounterpartyForwardingInfo o_conv;
15790 o_conv.inner = (void*)(o & (~1));
15791 o_conv.is_owned = (o & 1) || (o == 0);
15792 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15793 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
15794 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15795 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
15796 return (uint32_t)ret_conv;
15799 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
15800 LDKDecodeError e_conv;
15801 e_conv.inner = (void*)(e & (~1));
15802 e_conv.is_owned = (e & 1) || (e == 0);
15803 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15804 e_conv = DecodeError_clone(&e_conv);
15805 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15806 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
15807 return (uint32_t)ret_conv;
15810 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
15811 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
15812 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
15816 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
15817 if ((_res & 1) != 0) return;
15818 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15819 CHECK_ACCESS(_res_ptr);
15820 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
15822 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
15825 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
15826 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15827 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
15828 return (uint32_t)ret_conv;
15830 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
15831 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
15832 uint32_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
15836 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
15837 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
15838 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15839 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
15840 return (uint32_t)ret_conv;
15843 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
15844 LDKChannelCounterparty o_conv;
15845 o_conv.inner = (void*)(o & (~1));
15846 o_conv.is_owned = (o & 1) || (o == 0);
15847 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15848 o_conv = ChannelCounterparty_clone(&o_conv);
15849 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15850 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
15851 return (uint32_t)ret_conv;
15854 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
15855 LDKDecodeError e_conv;
15856 e_conv.inner = (void*)(e & (~1));
15857 e_conv.is_owned = (e & 1) || (e == 0);
15858 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15859 e_conv = DecodeError_clone(&e_conv);
15860 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15861 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
15862 return (uint32_t)ret_conv;
15865 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
15866 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
15867 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
15871 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
15872 if ((_res & 1) != 0) return;
15873 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15874 CHECK_ACCESS(_res_ptr);
15875 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
15877 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
15880 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
15881 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15882 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
15883 return (uint32_t)ret_conv;
15885 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
15886 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
15887 uint32_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
15891 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
15892 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
15893 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15894 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
15895 return (uint32_t)ret_conv;
15898 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
15899 LDKChannelDetails o_conv;
15900 o_conv.inner = (void*)(o & (~1));
15901 o_conv.is_owned = (o & 1) || (o == 0);
15902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15903 o_conv = ChannelDetails_clone(&o_conv);
15904 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15905 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
15906 return (uint32_t)ret_conv;
15909 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
15910 LDKDecodeError e_conv;
15911 e_conv.inner = (void*)(e & (~1));
15912 e_conv.is_owned = (e & 1) || (e == 0);
15913 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15914 e_conv = DecodeError_clone(&e_conv);
15915 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15916 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
15917 return (uint32_t)ret_conv;
15920 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
15921 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
15922 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
15926 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
15927 if ((_res & 1) != 0) return;
15928 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15929 CHECK_ACCESS(_res_ptr);
15930 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
15932 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
15935 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
15936 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15937 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
15938 return (uint32_t)ret_conv;
15940 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
15941 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
15942 uint32_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
15946 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
15947 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
15948 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15949 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
15950 return (uint32_t)ret_conv;
15953 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
15954 LDKPhantomRouteHints o_conv;
15955 o_conv.inner = (void*)(o & (~1));
15956 o_conv.is_owned = (o & 1) || (o == 0);
15957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15958 o_conv = PhantomRouteHints_clone(&o_conv);
15959 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15960 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
15961 return (uint32_t)ret_conv;
15964 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
15965 LDKDecodeError e_conv;
15966 e_conv.inner = (void*)(e & (~1));
15967 e_conv.is_owned = (e & 1) || (e == 0);
15968 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15969 e_conv = DecodeError_clone(&e_conv);
15970 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15971 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
15972 return (uint32_t)ret_conv;
15975 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
15976 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
15977 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
15981 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
15982 if ((_res & 1) != 0) return;
15983 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15984 CHECK_ACCESS(_res_ptr);
15985 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
15987 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
15990 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
15991 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15992 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
15993 return (uint32_t)ret_conv;
15995 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
15996 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
15997 uint32_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16001 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
16002 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
16003 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16004 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16005 return (uint32_t)ret_conv;
16008 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
16009 LDKCVec_ChannelMonitorZ _res_constr;
16010 _res_constr.datalen = _res->arr_len;
16011 if (_res_constr.datalen > 0)
16012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16014 _res_constr.data = NULL;
16015 uint32_t* _res_vals = _res->elems;
16016 for (size_t q = 0; q < _res_constr.datalen; q++) {
16017 uint32_t _res_conv_16 = _res_vals[q];
16018 LDKChannelMonitor _res_conv_16_conv;
16019 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16020 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16021 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16022 _res_constr.data[q] = _res_conv_16_conv;
16025 CVec_ChannelMonitorZ_free(_res_constr);
16028 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
16029 LDKThirtyTwoBytes a_ref;
16030 CHECK(a->arr_len == 32);
16031 memcpy(a_ref.data, a->elems, 32); FREE(a);
16032 LDKChannelManager b_conv;
16033 b_conv.inner = (void*)(b & (~1));
16034 b_conv.is_owned = (b & 1) || (b == 0);
16035 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16036 // WARNING: we need a move here but no clone is available for LDKChannelManager
16037 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16038 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16039 return ((uint32_t)ret_conv);
16042 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
16043 if ((_res & 1) != 0) return;
16044 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16045 CHECK_ACCESS(_res_ptr);
16046 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16048 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16051 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16052 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16053 CHECK_ACCESS(o_ptr);
16054 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16055 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16056 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16057 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16058 return (uint32_t)ret_conv;
16061 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16062 LDKDecodeError e_conv;
16063 e_conv.inner = (void*)(e & (~1));
16064 e_conv.is_owned = (e & 1) || (e == 0);
16065 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16066 e_conv = DecodeError_clone(&e_conv);
16067 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16068 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16069 return (uint32_t)ret_conv;
16072 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16073 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16074 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16078 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16079 if ((_res & 1) != 0) return;
16080 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16081 CHECK_ACCESS(_res_ptr);
16082 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16084 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16087 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
16088 LDKChannelConfig o_conv;
16089 o_conv.inner = (void*)(o & (~1));
16090 o_conv.is_owned = (o & 1) || (o == 0);
16091 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16092 o_conv = ChannelConfig_clone(&o_conv);
16093 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16094 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16095 return (uint32_t)ret_conv;
16098 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
16099 LDKDecodeError e_conv;
16100 e_conv.inner = (void*)(e & (~1));
16101 e_conv.is_owned = (e & 1) || (e == 0);
16102 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16103 e_conv = DecodeError_clone(&e_conv);
16104 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16105 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16106 return (uint32_t)ret_conv;
16109 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
16110 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
16111 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16115 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
16116 if ((_res & 1) != 0) return;
16117 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16118 CHECK_ACCESS(_res_ptr);
16119 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16121 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16124 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16125 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16126 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16127 return (uint32_t)ret_conv;
16129 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
16130 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
16131 uint32_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16135 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
16136 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
16137 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16138 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16139 return (uint32_t)ret_conv;
16142 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
16143 LDKOutPoint o_conv;
16144 o_conv.inner = (void*)(o & (~1));
16145 o_conv.is_owned = (o & 1) || (o == 0);
16146 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16147 o_conv = OutPoint_clone(&o_conv);
16148 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16149 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16150 return (uint32_t)ret_conv;
16153 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
16154 LDKDecodeError e_conv;
16155 e_conv.inner = (void*)(e & (~1));
16156 e_conv.is_owned = (e & 1) || (e == 0);
16157 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16158 e_conv = DecodeError_clone(&e_conv);
16159 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16160 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16161 return (uint32_t)ret_conv;
16164 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
16165 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
16166 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16170 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
16171 if ((_res & 1) != 0) return;
16172 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16173 CHECK_ACCESS(_res_ptr);
16174 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16176 CResult_OutPointDecodeErrorZ_free(_res_conv);
16179 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16180 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16181 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16182 return (uint32_t)ret_conv;
16184 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
16185 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
16186 uint32_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16190 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
16191 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
16192 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16193 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16194 return (uint32_t)ret_conv;
16197 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
16198 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16199 CHECK_ACCESS(o_ptr);
16200 LDKType o_conv = *(LDKType*)(o_ptr);
16201 if (o_conv.free == LDKType_JCalls_free) {
16202 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16203 LDKType_JCalls_cloned(&o_conv);
16205 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16206 *ret_copy = COption_TypeZ_some(o_conv);
16207 uint32_t ret_ref = (uintptr_t)ret_copy;
16211 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16212 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16213 *ret_copy = COption_TypeZ_none();
16214 uint32_t ret_ref = (uintptr_t)ret_copy;
16218 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
16219 if ((_res & 1) != 0) return;
16220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16221 CHECK_ACCESS(_res_ptr);
16222 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16224 COption_TypeZ_free(_res_conv);
16227 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16228 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16229 *ret_copy = COption_TypeZ_clone(arg);
16230 uint32_t ret_ref = (uintptr_t)ret_copy;
16233 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
16234 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
16235 uint32_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16239 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
16240 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
16241 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16242 *ret_copy = COption_TypeZ_clone(orig_conv);
16243 uint32_t ret_ref = (uintptr_t)ret_copy;
16247 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
16248 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16249 CHECK_ACCESS(o_ptr);
16250 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16251 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
16252 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16253 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16254 return (uint32_t)ret_conv;
16257 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
16258 LDKDecodeError e_conv;
16259 e_conv.inner = (void*)(e & (~1));
16260 e_conv.is_owned = (e & 1) || (e == 0);
16261 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16262 e_conv = DecodeError_clone(&e_conv);
16263 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16264 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16265 return (uint32_t)ret_conv;
16268 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
16269 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
16270 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16274 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
16275 if ((_res & 1) != 0) return;
16276 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16277 CHECK_ACCESS(_res_ptr);
16278 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16280 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16283 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16284 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16285 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16286 return (uint32_t)ret_conv;
16288 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
16289 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
16290 uint32_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16294 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
16295 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
16296 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16297 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16298 return (uint32_t)ret_conv;
16301 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16302 LDKThirtyTwoBytes o_ref;
16303 CHECK(o->arr_len == 32);
16304 memcpy(o_ref.data, o->elems, 32); FREE(o);
16305 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16306 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16307 return (uint32_t)ret_conv;
16310 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
16311 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16312 CHECK_ACCESS(e_ptr);
16313 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16314 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
16315 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16316 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16317 return (uint32_t)ret_conv;
16320 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
16321 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
16322 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16326 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
16327 if ((_res & 1) != 0) return;
16328 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16329 CHECK_ACCESS(_res_ptr);
16330 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16332 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16335 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16336 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16337 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16338 return (uint32_t)ret_conv;
16340 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
16341 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
16342 uint32_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16346 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
16347 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
16348 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16349 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16350 return (uint32_t)ret_conv;
16353 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
16354 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
16355 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16356 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
16357 return (uint32_t)ret_conv;
16360 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint32_t e) {
16361 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16362 CHECK_ACCESS(e_ptr);
16363 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16364 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16365 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16366 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
16367 return (uint32_t)ret_conv;
16370 jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint32_t o) {
16371 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
16372 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
16376 void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint32_t _res) {
16377 if ((_res & 1) != 0) return;
16378 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16379 CHECK_ACCESS(_res_ptr);
16380 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
16382 CResult_SiPrefixParseErrorZ_free(_res_conv);
16385 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
16386 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16387 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
16388 return (uint32_t)ret_conv;
16390 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint32_t arg) {
16391 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
16392 uint32_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
16396 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint32_t orig) {
16397 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
16398 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16399 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
16400 return (uint32_t)ret_conv;
16403 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint32_t o) {
16405 o_conv.inner = (void*)(o & (~1));
16406 o_conv.is_owned = (o & 1) || (o == 0);
16407 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16408 o_conv = Invoice_clone(&o_conv);
16409 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16410 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
16411 return (uint32_t)ret_conv;
16414 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint32_t e) {
16415 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16416 CHECK_ACCESS(e_ptr);
16417 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
16418 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
16419 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16420 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
16421 return (uint32_t)ret_conv;
16424 jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint32_t o) {
16425 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
16426 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
16430 void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_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_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
16436 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
16439 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
16440 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16441 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
16442 return (uint32_t)ret_conv;
16444 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint32_t arg) {
16445 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
16446 uint32_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
16450 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint32_t orig) {
16451 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
16452 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16453 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
16454 return (uint32_t)ret_conv;
16457 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint32_t o) {
16458 LDKSignedRawInvoice o_conv;
16459 o_conv.inner = (void*)(o & (~1));
16460 o_conv.is_owned = (o & 1) || (o == 0);
16461 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16462 o_conv = SignedRawInvoice_clone(&o_conv);
16463 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16464 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
16465 return (uint32_t)ret_conv;
16468 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint32_t e) {
16469 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16470 CHECK_ACCESS(e_ptr);
16471 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16472 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16473 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16474 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
16475 return (uint32_t)ret_conv;
16478 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint32_t o) {
16479 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
16480 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
16484 void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint32_t _res) {
16485 if ((_res & 1) != 0) return;
16486 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16487 CHECK_ACCESS(_res_ptr);
16488 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
16490 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
16493 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
16494 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16495 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
16496 return (uint32_t)ret_conv;
16498 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint32_t arg) {
16499 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
16500 uint32_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
16504 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint32_t orig) {
16505 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
16506 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16507 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
16508 return (uint32_t)ret_conv;
16511 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
16512 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16513 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
16514 return ((uint32_t)ret_conv);
16516 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
16517 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
16518 uint32_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
16522 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
16523 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
16524 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16525 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
16526 return ((uint32_t)ret_conv);
16529 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
16530 LDKRawInvoice a_conv;
16531 a_conv.inner = (void*)(a & (~1));
16532 a_conv.is_owned = (a & 1) || (a == 0);
16533 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16534 a_conv = RawInvoice_clone(&a_conv);
16535 LDKThirtyTwoBytes b_ref;
16536 CHECK(b->arr_len == 32);
16537 memcpy(b_ref.data, b->elems, 32); FREE(b);
16538 LDKInvoiceSignature c_conv;
16539 c_conv.inner = (void*)(c & (~1));
16540 c_conv.is_owned = (c & 1) || (c == 0);
16541 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16542 c_conv = InvoiceSignature_clone(&c_conv);
16543 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16544 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
16545 return ((uint32_t)ret_conv);
16548 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
16549 if ((_res & 1) != 0) return;
16550 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16551 CHECK_ACCESS(_res_ptr);
16552 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
16554 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
16557 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
16558 LDKPayeePubKey o_conv;
16559 o_conv.inner = (void*)(o & (~1));
16560 o_conv.is_owned = (o & 1) || (o == 0);
16561 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16562 o_conv = PayeePubKey_clone(&o_conv);
16563 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16564 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
16565 return (uint32_t)ret_conv;
16568 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
16569 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16570 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16571 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
16572 return (uint32_t)ret_conv;
16575 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
16576 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
16577 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
16581 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
16582 if ((_res & 1) != 0) return;
16583 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16584 CHECK_ACCESS(_res_ptr);
16585 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
16587 CResult_PayeePubKeyErrorZ_free(_res_conv);
16590 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
16591 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16592 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
16593 return (uint32_t)ret_conv;
16595 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
16596 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
16597 uint32_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
16601 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
16602 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
16603 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16604 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
16605 return (uint32_t)ret_conv;
16608 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
16609 LDKCVec_PrivateRouteZ _res_constr;
16610 _res_constr.datalen = _res->arr_len;
16611 if (_res_constr.datalen > 0)
16612 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
16614 _res_constr.data = NULL;
16615 uint32_t* _res_vals = _res->elems;
16616 for (size_t o = 0; o < _res_constr.datalen; o++) {
16617 uint32_t _res_conv_14 = _res_vals[o];
16618 LDKPrivateRoute _res_conv_14_conv;
16619 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
16620 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
16621 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16622 _res_constr.data[o] = _res_conv_14_conv;
16625 CVec_PrivateRouteZ_free(_res_constr);
16628 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
16629 LDKPositiveTimestamp o_conv;
16630 o_conv.inner = (void*)(o & (~1));
16631 o_conv.is_owned = (o & 1) || (o == 0);
16632 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16633 o_conv = PositiveTimestamp_clone(&o_conv);
16634 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16635 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
16636 return (uint32_t)ret_conv;
16639 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
16640 LDKCreationError e_conv = LDKCreationError_from_js(e);
16641 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16642 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
16643 return (uint32_t)ret_conv;
16646 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
16647 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
16648 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
16652 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
16653 if ((_res & 1) != 0) return;
16654 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16655 CHECK_ACCESS(_res_ptr);
16656 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
16658 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
16661 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
16662 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16663 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
16664 return (uint32_t)ret_conv;
16666 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
16667 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
16668 uint32_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
16672 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
16673 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
16674 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16675 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16676 return (uint32_t)ret_conv;
16679 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
16680 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16681 *ret_conv = CResult_NoneSemanticErrorZ_ok();
16682 return (uint32_t)ret_conv;
16685 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
16686 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16687 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16688 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16689 return (uint32_t)ret_conv;
16692 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
16693 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
16694 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16698 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
16699 if ((_res & 1) != 0) return;
16700 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16701 CHECK_ACCESS(_res_ptr);
16702 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16704 CResult_NoneSemanticErrorZ_free(_res_conv);
16707 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16708 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16709 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16710 return (uint32_t)ret_conv;
16712 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
16713 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
16714 uint32_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16718 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
16719 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
16720 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16721 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16722 return (uint32_t)ret_conv;
16725 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
16727 o_conv.inner = (void*)(o & (~1));
16728 o_conv.is_owned = (o & 1) || (o == 0);
16729 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16730 o_conv = Invoice_clone(&o_conv);
16731 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16732 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16733 return (uint32_t)ret_conv;
16736 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
16737 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16738 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16739 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16740 return (uint32_t)ret_conv;
16743 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
16744 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
16745 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16749 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
16750 if ((_res & 1) != 0) return;
16751 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16752 CHECK_ACCESS(_res_ptr);
16753 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16755 CResult_InvoiceSemanticErrorZ_free(_res_conv);
16758 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16759 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16760 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16761 return (uint32_t)ret_conv;
16763 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
16764 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
16765 uint32_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16769 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
16770 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
16771 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16772 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16773 return (uint32_t)ret_conv;
16776 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
16777 LDKDescription o_conv;
16778 o_conv.inner = (void*)(o & (~1));
16779 o_conv.is_owned = (o & 1) || (o == 0);
16780 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16781 o_conv = Description_clone(&o_conv);
16782 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16783 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16784 return (uint32_t)ret_conv;
16787 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
16788 LDKCreationError e_conv = LDKCreationError_from_js(e);
16789 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16790 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16791 return (uint32_t)ret_conv;
16794 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
16795 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
16796 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16800 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
16801 if ((_res & 1) != 0) return;
16802 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16803 CHECK_ACCESS(_res_ptr);
16804 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16806 CResult_DescriptionCreationErrorZ_free(_res_conv);
16809 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16810 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16811 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16812 return (uint32_t)ret_conv;
16814 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
16815 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
16816 uint32_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16820 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
16821 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
16822 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16823 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16824 return (uint32_t)ret_conv;
16827 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
16828 LDKPrivateRoute o_conv;
16829 o_conv.inner = (void*)(o & (~1));
16830 o_conv.is_owned = (o & 1) || (o == 0);
16831 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16832 o_conv = PrivateRoute_clone(&o_conv);
16833 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16834 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16835 return (uint32_t)ret_conv;
16838 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
16839 LDKCreationError e_conv = LDKCreationError_from_js(e);
16840 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16841 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16842 return (uint32_t)ret_conv;
16845 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
16846 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
16847 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16851 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
16852 if ((_res & 1) != 0) return;
16853 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16854 CHECK_ACCESS(_res_ptr);
16855 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16857 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16860 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16861 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16862 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16863 return (uint32_t)ret_conv;
16865 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
16866 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
16867 uint32_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16871 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
16872 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
16873 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16874 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16875 return (uint32_t)ret_conv;
16878 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
16879 LDKStr o_conv = str_ref_to_owned_c(o);
16880 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16881 *ret_conv = CResult_StringErrorZ_ok(o_conv);
16882 return (uint32_t)ret_conv;
16885 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
16886 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16887 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16888 *ret_conv = CResult_StringErrorZ_err(e_conv);
16889 return (uint32_t)ret_conv;
16892 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
16893 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
16894 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
16898 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
16899 if ((_res & 1) != 0) return;
16900 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16901 CHECK_ACCESS(_res_ptr);
16902 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16904 CResult_StringErrorZ_free(_res_conv);
16907 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
16908 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16909 *ret_conv = CResult_StringErrorZ_clone(arg);
16910 return (uint32_t)ret_conv;
16912 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint32_t arg) {
16913 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
16914 uint32_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
16918 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint32_t orig) {
16919 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
16920 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16921 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
16922 return (uint32_t)ret_conv;
16925 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
16926 LDKChannelMonitorUpdate o_conv;
16927 o_conv.inner = (void*)(o & (~1));
16928 o_conv.is_owned = (o & 1) || (o == 0);
16929 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16930 o_conv = ChannelMonitorUpdate_clone(&o_conv);
16931 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16932 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16933 return (uint32_t)ret_conv;
16936 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
16937 LDKDecodeError e_conv;
16938 e_conv.inner = (void*)(e & (~1));
16939 e_conv.is_owned = (e & 1) || (e == 0);
16940 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16941 e_conv = DecodeError_clone(&e_conv);
16942 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16943 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16944 return (uint32_t)ret_conv;
16947 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
16948 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
16949 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16953 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
16954 if ((_res & 1) != 0) return;
16955 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16956 CHECK_ACCESS(_res_ptr);
16957 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16959 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16962 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16963 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16964 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16965 return (uint32_t)ret_conv;
16967 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
16968 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
16969 uint32_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16973 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
16974 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
16975 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16976 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16977 return (uint32_t)ret_conv;
16980 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
16981 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16982 CHECK_ACCESS(o_ptr);
16983 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16984 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
16985 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16986 *ret_copy = COption_MonitorEventZ_some(o_conv);
16987 uint32_t ret_ref = (uintptr_t)ret_copy;
16991 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
16992 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16993 *ret_copy = COption_MonitorEventZ_none();
16994 uint32_t ret_ref = (uintptr_t)ret_copy;
16998 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
16999 if ((_res & 1) != 0) return;
17000 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17001 CHECK_ACCESS(_res_ptr);
17002 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17004 COption_MonitorEventZ_free(_res_conv);
17007 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17008 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17009 *ret_copy = COption_MonitorEventZ_clone(arg);
17010 uint32_t ret_ref = (uintptr_t)ret_copy;
17013 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
17014 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
17015 uint32_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17019 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
17020 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
17021 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17022 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17023 uint32_t ret_ref = (uintptr_t)ret_copy;
17027 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
17028 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17029 CHECK_ACCESS(o_ptr);
17030 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17031 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
17032 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17033 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17034 return (uint32_t)ret_conv;
17037 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
17038 LDKDecodeError e_conv;
17039 e_conv.inner = (void*)(e & (~1));
17040 e_conv.is_owned = (e & 1) || (e == 0);
17041 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17042 e_conv = DecodeError_clone(&e_conv);
17043 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17044 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17045 return (uint32_t)ret_conv;
17048 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
17049 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
17050 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17054 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
17055 if ((_res & 1) != 0) return;
17056 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17057 CHECK_ACCESS(_res_ptr);
17058 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17060 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17063 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17064 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17065 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17066 return (uint32_t)ret_conv;
17068 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
17069 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
17070 uint32_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17074 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
17075 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
17076 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17077 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17078 return (uint32_t)ret_conv;
17081 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
17082 LDKHTLCUpdate o_conv;
17083 o_conv.inner = (void*)(o & (~1));
17084 o_conv.is_owned = (o & 1) || (o == 0);
17085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17086 o_conv = HTLCUpdate_clone(&o_conv);
17087 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17088 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17089 return (uint32_t)ret_conv;
17092 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
17093 LDKDecodeError e_conv;
17094 e_conv.inner = (void*)(e & (~1));
17095 e_conv.is_owned = (e & 1) || (e == 0);
17096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17097 e_conv = DecodeError_clone(&e_conv);
17098 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17099 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17100 return (uint32_t)ret_conv;
17103 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
17104 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
17105 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17109 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
17110 if ((_res & 1) != 0) return;
17111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17112 CHECK_ACCESS(_res_ptr);
17113 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17115 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17118 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17119 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17120 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17121 return (uint32_t)ret_conv;
17123 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
17124 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
17125 uint32_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17129 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
17130 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
17131 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17132 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17133 return (uint32_t)ret_conv;
17136 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17137 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17138 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17139 return ((uint32_t)ret_conv);
17141 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
17142 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
17143 uint32_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17147 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
17148 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
17149 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17150 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17151 return ((uint32_t)ret_conv);
17154 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
17155 LDKOutPoint a_conv;
17156 a_conv.inner = (void*)(a & (~1));
17157 a_conv.is_owned = (a & 1) || (a == 0);
17158 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17159 a_conv = OutPoint_clone(&a_conv);
17161 b_ref.datalen = b->arr_len;
17162 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17163 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17164 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17165 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17166 return ((uint32_t)ret_conv);
17169 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
17170 if ((_res & 1) != 0) return;
17171 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17172 CHECK_ACCESS(_res_ptr);
17173 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17175 C2Tuple_OutPointScriptZ_free(_res_conv);
17178 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17179 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17180 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17181 return ((uint32_t)ret_conv);
17183 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
17184 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
17185 uint32_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17189 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
17190 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
17191 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17192 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17193 return ((uint32_t)ret_conv);
17196 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17198 b_ref.datalen = b->arr_len;
17199 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17200 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17201 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17202 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17203 return ((uint32_t)ret_conv);
17206 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
17207 if ((_res & 1) != 0) return;
17208 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17209 CHECK_ACCESS(_res_ptr);
17210 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17212 C2Tuple_u32ScriptZ_free(_res_conv);
17215 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
17216 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17217 _res_constr.datalen = _res->arr_len;
17218 if (_res_constr.datalen > 0)
17219 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17221 _res_constr.data = NULL;
17222 uint32_t* _res_vals = _res->elems;
17223 for (size_t v = 0; v < _res_constr.datalen; v++) {
17224 uint32_t _res_conv_21 = _res_vals[v];
17225 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
17226 CHECK_ACCESS(_res_conv_21_ptr);
17227 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17228 FREE((void*)_res_conv_21);
17229 _res_constr.data[v] = _res_conv_21_conv;
17232 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17235 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17236 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17237 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17238 return ((uint32_t)ret_conv);
17240 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
17241 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
17242 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17246 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
17247 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
17248 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17249 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17250 return ((uint32_t)ret_conv);
17253 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
17254 LDKThirtyTwoBytes a_ref;
17255 CHECK(a->arr_len == 32);
17256 memcpy(a_ref.data, a->elems, 32); FREE(a);
17257 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17258 b_constr.datalen = b->arr_len;
17259 if (b_constr.datalen > 0)
17260 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17262 b_constr.data = NULL;
17263 uint32_t* b_vals = b->elems;
17264 for (size_t v = 0; v < b_constr.datalen; v++) {
17265 uint32_t b_conv_21 = b_vals[v];
17266 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
17267 CHECK_ACCESS(b_conv_21_ptr);
17268 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17269 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
17270 b_constr.data[v] = b_conv_21_conv;
17273 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17274 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17275 return ((uint32_t)ret_conv);
17278 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
17279 if ((_res & 1) != 0) return;
17280 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17281 CHECK_ACCESS(_res_ptr);
17282 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17284 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17287 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
17288 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17289 _res_constr.datalen = _res->arr_len;
17290 if (_res_constr.datalen > 0)
17291 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17293 _res_constr.data = NULL;
17294 uint32_t* _res_vals = _res->elems;
17295 for (size_t o = 0; o < _res_constr.datalen; o++) {
17296 uint32_t _res_conv_40 = _res_vals[o];
17297 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
17298 CHECK_ACCESS(_res_conv_40_ptr);
17299 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17300 FREE((void*)_res_conv_40);
17301 _res_constr.data[o] = _res_conv_40_conv;
17304 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17307 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
17308 LDKCVec_EventZ _res_constr;
17309 _res_constr.datalen = _res->arr_len;
17310 if (_res_constr.datalen > 0)
17311 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17313 _res_constr.data = NULL;
17314 uint32_t* _res_vals = _res->elems;
17315 for (size_t h = 0; h < _res_constr.datalen; h++) {
17316 uint32_t _res_conv_7 = _res_vals[h];
17317 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17318 CHECK_ACCESS(_res_conv_7_ptr);
17319 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17320 FREE((void*)_res_conv_7);
17321 _res_constr.data[h] = _res_conv_7_conv;
17324 CVec_EventZ_free(_res_constr);
17327 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17328 LDKCVec_TransactionZ _res_constr;
17329 _res_constr.datalen = _res->arr_len;
17330 if (_res_constr.datalen > 0)
17331 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17333 _res_constr.data = NULL;
17334 int8_tArray* _res_vals = (void*) _res->elems;
17335 for (size_t m = 0; m < _res_constr.datalen; m++) {
17336 int8_tArray _res_conv_12 = _res_vals[m];
17337 LDKTransaction _res_conv_12_ref;
17338 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17339 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17340 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17341 _res_conv_12_ref.data_is_owned = true;
17342 _res_constr.data[m] = _res_conv_12_ref;
17345 CVec_TransactionZ_free(_res_constr);
17348 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
17349 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17350 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
17351 return ((uint32_t)ret_conv);
17353 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
17354 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
17355 uint32_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
17359 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
17360 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
17361 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17362 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
17363 return ((uint32_t)ret_conv);
17366 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
17367 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17368 CHECK_ACCESS(b_ptr);
17369 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
17370 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
17371 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17372 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
17373 return ((uint32_t)ret_conv);
17376 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
17377 if ((_res & 1) != 0) return;
17378 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17379 CHECK_ACCESS(_res_ptr);
17380 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
17382 C2Tuple_u32TxOutZ_free(_res_conv);
17385 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
17386 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
17387 _res_constr.datalen = _res->arr_len;
17388 if (_res_constr.datalen > 0)
17389 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17391 _res_constr.data = NULL;
17392 uint32_t* _res_vals = _res->elems;
17393 for (size_t u = 0; u < _res_constr.datalen; u++) {
17394 uint32_t _res_conv_20 = _res_vals[u];
17395 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
17396 CHECK_ACCESS(_res_conv_20_ptr);
17397 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
17398 FREE((void*)_res_conv_20);
17399 _res_constr.data[u] = _res_conv_20_conv;
17402 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
17405 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
17406 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17407 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
17408 return ((uint32_t)ret_conv);
17410 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
17411 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
17412 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
17416 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
17417 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
17418 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17419 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
17420 return ((uint32_t)ret_conv);
17423 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
17424 LDKThirtyTwoBytes a_ref;
17425 CHECK(a->arr_len == 32);
17426 memcpy(a_ref.data, a->elems, 32); FREE(a);
17427 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
17428 b_constr.datalen = b->arr_len;
17429 if (b_constr.datalen > 0)
17430 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17432 b_constr.data = NULL;
17433 uint32_t* b_vals = b->elems;
17434 for (size_t u = 0; u < b_constr.datalen; u++) {
17435 uint32_t b_conv_20 = b_vals[u];
17436 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
17437 CHECK_ACCESS(b_conv_20_ptr);
17438 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
17439 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
17440 b_constr.data[u] = b_conv_20_conv;
17443 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17444 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
17445 return ((uint32_t)ret_conv);
17448 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
17449 if ((_res & 1) != 0) return;
17450 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17451 CHECK_ACCESS(_res_ptr);
17452 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
17454 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
17457 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
17458 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
17459 _res_constr.datalen = _res->arr_len;
17460 if (_res_constr.datalen > 0)
17461 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
17463 _res_constr.data = NULL;
17464 uint32_t* _res_vals = _res->elems;
17465 for (size_t n = 0; n < _res_constr.datalen; n++) {
17466 uint32_t _res_conv_39 = _res_vals[n];
17467 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
17468 CHECK_ACCESS(_res_conv_39_ptr);
17469 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
17470 FREE((void*)_res_conv_39);
17471 _res_constr.data[n] = _res_conv_39_conv;
17474 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
17477 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
17478 LDKCVec_BalanceZ _res_constr;
17479 _res_constr.datalen = _res->arr_len;
17480 if (_res_constr.datalen > 0)
17481 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
17483 _res_constr.data = NULL;
17484 uint32_t* _res_vals = _res->elems;
17485 for (size_t j = 0; j < _res_constr.datalen; j++) {
17486 uint32_t _res_conv_9 = _res_vals[j];
17487 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
17488 CHECK_ACCESS(_res_conv_9_ptr);
17489 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
17490 FREE((void*)_res_conv_9);
17491 _res_constr.data[j] = _res_conv_9_conv;
17494 CVec_BalanceZ_free(_res_constr);
17497 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17498 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17499 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17500 return ((uint32_t)ret_conv);
17502 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
17503 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17504 uint32_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17508 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
17509 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17510 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17511 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17512 return ((uint32_t)ret_conv);
17515 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
17516 LDKThirtyTwoBytes a_ref;
17517 CHECK(a->arr_len == 32);
17518 memcpy(a_ref.data, a->elems, 32); FREE(a);
17519 LDKChannelMonitor b_conv;
17520 b_conv.inner = (void*)(b & (~1));
17521 b_conv.is_owned = (b & 1) || (b == 0);
17522 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17523 b_conv = ChannelMonitor_clone(&b_conv);
17524 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17525 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17526 return ((uint32_t)ret_conv);
17529 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
17530 if ((_res & 1) != 0) return;
17531 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17532 CHECK_ACCESS(_res_ptr);
17533 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17535 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17538 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
17539 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17540 CHECK_ACCESS(o_ptr);
17541 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
17542 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
17543 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17544 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
17545 return (uint32_t)ret_conv;
17548 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
17549 LDKDecodeError e_conv;
17550 e_conv.inner = (void*)(e & (~1));
17551 e_conv.is_owned = (e & 1) || (e == 0);
17552 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17553 e_conv = DecodeError_clone(&e_conv);
17554 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17555 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
17556 return (uint32_t)ret_conv;
17559 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
17560 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
17561 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
17565 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
17566 if ((_res & 1) != 0) return;
17567 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17568 CHECK_ACCESS(_res_ptr);
17569 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
17571 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
17574 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
17575 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17576 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
17577 return (uint32_t)ret_conv;
17579 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
17580 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
17581 uint32_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
17585 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
17586 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
17587 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17588 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
17589 return (uint32_t)ret_conv;
17592 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
17593 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17594 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
17595 return ((uint32_t)ret_conv);
17597 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
17598 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
17599 uint32_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
17603 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
17604 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
17605 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17606 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
17607 return ((uint32_t)ret_conv);
17610 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
17611 LDKPublicKey a_ref;
17612 CHECK(a->arr_len == 33);
17613 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
17614 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17615 CHECK_ACCESS(b_ptr);
17616 LDKType b_conv = *(LDKType*)(b_ptr);
17617 if (b_conv.free == LDKType_JCalls_free) {
17618 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17619 LDKType_JCalls_cloned(&b_conv);
17621 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17622 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
17623 return ((uint32_t)ret_conv);
17626 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
17627 if ((_res & 1) != 0) return;
17628 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17629 CHECK_ACCESS(_res_ptr);
17630 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
17632 C2Tuple_PublicKeyTypeZ_free(_res_conv);
17635 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
17636 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17637 _res_constr.datalen = _res->arr_len;
17638 if (_res_constr.datalen > 0)
17639 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17641 _res_constr.data = NULL;
17642 uint32_t* _res_vals = _res->elems;
17643 for (size_t z = 0; z < _res_constr.datalen; z++) {
17644 uint32_t _res_conv_25 = _res_vals[z];
17645 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
17646 CHECK_ACCESS(_res_conv_25_ptr);
17647 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17648 FREE((void*)_res_conv_25);
17649 _res_constr.data[z] = _res_conv_25_conv;
17652 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17655 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint32_t o) {
17656 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17657 CHECK_ACCESS(o_ptr);
17658 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17659 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17660 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17661 *ret_copy = COption_NetAddressZ_some(o_conv);
17662 uint32_t ret_ref = (uintptr_t)ret_copy;
17666 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
17667 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17668 *ret_copy = COption_NetAddressZ_none();
17669 uint32_t ret_ref = (uintptr_t)ret_copy;
17673 void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint32_t _res) {
17674 if ((_res & 1) != 0) return;
17675 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17676 CHECK_ACCESS(_res_ptr);
17677 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
17679 COption_NetAddressZ_free(_res_conv);
17682 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
17683 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17684 *ret_copy = COption_NetAddressZ_clone(arg);
17685 uint32_t ret_ref = (uintptr_t)ret_copy;
17688 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint32_t arg) {
17689 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
17690 uint32_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
17694 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint32_t orig) {
17695 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
17696 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17697 *ret_copy = COption_NetAddressZ_clone(orig_conv);
17698 uint32_t ret_ref = (uintptr_t)ret_copy;
17702 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
17704 o_ref.datalen = o->arr_len;
17705 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17706 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17707 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17708 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17709 return (uint32_t)ret_conv;
17712 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
17713 LDKPeerHandleError e_conv;
17714 e_conv.inner = (void*)(e & (~1));
17715 e_conv.is_owned = (e & 1) || (e == 0);
17716 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17717 e_conv = PeerHandleError_clone(&e_conv);
17718 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17719 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17720 return (uint32_t)ret_conv;
17723 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
17724 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
17725 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17729 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
17730 if ((_res & 1) != 0) return;
17731 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17732 CHECK_ACCESS(_res_ptr);
17733 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17735 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17738 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17739 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17740 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17741 return (uint32_t)ret_conv;
17743 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17744 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
17745 uint32_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17749 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
17750 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
17751 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17752 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17753 return (uint32_t)ret_conv;
17756 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
17757 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17758 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17759 return (uint32_t)ret_conv;
17762 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
17763 LDKPeerHandleError e_conv;
17764 e_conv.inner = (void*)(e & (~1));
17765 e_conv.is_owned = (e & 1) || (e == 0);
17766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17767 e_conv = PeerHandleError_clone(&e_conv);
17768 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17769 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17770 return (uint32_t)ret_conv;
17773 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
17774 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
17775 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17779 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
17780 if ((_res & 1) != 0) return;
17781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17782 CHECK_ACCESS(_res_ptr);
17783 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17785 CResult_NonePeerHandleErrorZ_free(_res_conv);
17788 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17789 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17790 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17791 return (uint32_t)ret_conv;
17793 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
17794 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
17795 uint32_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17799 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
17800 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
17801 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17802 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17803 return (uint32_t)ret_conv;
17806 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
17807 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17808 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17809 return (uint32_t)ret_conv;
17812 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
17813 LDKPeerHandleError e_conv;
17814 e_conv.inner = (void*)(e & (~1));
17815 e_conv.is_owned = (e & 1) || (e == 0);
17816 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17817 e_conv = PeerHandleError_clone(&e_conv);
17818 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17819 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17820 return (uint32_t)ret_conv;
17823 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
17824 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
17825 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17829 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
17830 if ((_res & 1) != 0) return;
17831 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17832 CHECK_ACCESS(_res_ptr);
17833 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17835 CResult_boolPeerHandleErrorZ_free(_res_conv);
17838 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17839 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17840 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17841 return (uint32_t)ret_conv;
17843 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17844 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
17845 uint32_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17849 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
17850 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
17851 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17852 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17853 return (uint32_t)ret_conv;
17856 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
17857 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17858 *ret_conv = CResult_NoneErrorZ_ok();
17859 return (uint32_t)ret_conv;
17862 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
17863 LDKIOError e_conv = LDKIOError_from_js(e);
17864 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17865 *ret_conv = CResult_NoneErrorZ_err(e_conv);
17866 return (uint32_t)ret_conv;
17869 jboolean __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
17870 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
17871 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17875 void __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
17876 if ((_res & 1) != 0) return;
17877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17878 CHECK_ACCESS(_res_ptr);
17879 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17881 CResult_NoneErrorZ_free(_res_conv);
17884 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17885 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17886 *ret_conv = CResult_NoneErrorZ_clone(arg);
17887 return (uint32_t)ret_conv;
17889 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
17890 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
17891 uint32_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17895 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
17896 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
17897 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17898 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17899 return (uint32_t)ret_conv;
17902 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
17903 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17904 CHECK_ACCESS(o_ptr);
17905 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17906 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17907 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17908 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17909 return (uint32_t)ret_conv;
17912 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
17913 LDKDecodeError e_conv;
17914 e_conv.inner = (void*)(e & (~1));
17915 e_conv.is_owned = (e & 1) || (e == 0);
17916 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17917 e_conv = DecodeError_clone(&e_conv);
17918 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17919 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17920 return (uint32_t)ret_conv;
17923 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
17924 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17925 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17929 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
17930 if ((_res & 1) != 0) return;
17931 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17932 CHECK_ACCESS(_res_ptr);
17933 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17935 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17938 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17939 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17940 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17941 return (uint32_t)ret_conv;
17943 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
17944 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17945 uint32_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17949 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
17950 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17951 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17952 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17953 return (uint32_t)ret_conv;
17956 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
17957 LDKCVec_UpdateAddHTLCZ _res_constr;
17958 _res_constr.datalen = _res->arr_len;
17959 if (_res_constr.datalen > 0)
17960 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17962 _res_constr.data = NULL;
17963 uint32_t* _res_vals = _res->elems;
17964 for (size_t p = 0; p < _res_constr.datalen; p++) {
17965 uint32_t _res_conv_15 = _res_vals[p];
17966 LDKUpdateAddHTLC _res_conv_15_conv;
17967 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17968 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17969 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17970 _res_constr.data[p] = _res_conv_15_conv;
17973 CVec_UpdateAddHTLCZ_free(_res_constr);
17976 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
17977 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17978 _res_constr.datalen = _res->arr_len;
17979 if (_res_constr.datalen > 0)
17980 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17982 _res_constr.data = NULL;
17983 uint32_t* _res_vals = _res->elems;
17984 for (size_t t = 0; t < _res_constr.datalen; t++) {
17985 uint32_t _res_conv_19 = _res_vals[t];
17986 LDKUpdateFulfillHTLC _res_conv_19_conv;
17987 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17988 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17989 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17990 _res_constr.data[t] = _res_conv_19_conv;
17993 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17996 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
17997 LDKCVec_UpdateFailHTLCZ _res_constr;
17998 _res_constr.datalen = _res->arr_len;
17999 if (_res_constr.datalen > 0)
18000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18002 _res_constr.data = NULL;
18003 uint32_t* _res_vals = _res->elems;
18004 for (size_t q = 0; q < _res_constr.datalen; q++) {
18005 uint32_t _res_conv_16 = _res_vals[q];
18006 LDKUpdateFailHTLC _res_conv_16_conv;
18007 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18008 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18009 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18010 _res_constr.data[q] = _res_conv_16_conv;
18013 CVec_UpdateFailHTLCZ_free(_res_constr);
18016 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
18017 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18018 _res_constr.datalen = _res->arr_len;
18019 if (_res_constr.datalen > 0)
18020 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18022 _res_constr.data = NULL;
18023 uint32_t* _res_vals = _res->elems;
18024 for (size_t z = 0; z < _res_constr.datalen; z++) {
18025 uint32_t _res_conv_25 = _res_vals[z];
18026 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18027 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
18028 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
18029 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18030 _res_constr.data[z] = _res_conv_25_conv;
18033 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18036 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
18037 LDKAcceptChannel o_conv;
18038 o_conv.inner = (void*)(o & (~1));
18039 o_conv.is_owned = (o & 1) || (o == 0);
18040 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18041 o_conv = AcceptChannel_clone(&o_conv);
18042 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18043 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18044 return (uint32_t)ret_conv;
18047 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
18048 LDKDecodeError e_conv;
18049 e_conv.inner = (void*)(e & (~1));
18050 e_conv.is_owned = (e & 1) || (e == 0);
18051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18052 e_conv = DecodeError_clone(&e_conv);
18053 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18054 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18055 return (uint32_t)ret_conv;
18058 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
18059 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
18060 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18064 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
18065 if ((_res & 1) != 0) return;
18066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18067 CHECK_ACCESS(_res_ptr);
18068 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18070 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18073 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18074 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18075 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18076 return (uint32_t)ret_conv;
18078 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18079 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
18080 uint32_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18084 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
18085 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
18086 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18087 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18088 return (uint32_t)ret_conv;
18091 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
18092 LDKAnnouncementSignatures o_conv;
18093 o_conv.inner = (void*)(o & (~1));
18094 o_conv.is_owned = (o & 1) || (o == 0);
18095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18096 o_conv = AnnouncementSignatures_clone(&o_conv);
18097 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18098 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18099 return (uint32_t)ret_conv;
18102 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
18103 LDKDecodeError e_conv;
18104 e_conv.inner = (void*)(e & (~1));
18105 e_conv.is_owned = (e & 1) || (e == 0);
18106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18107 e_conv = DecodeError_clone(&e_conv);
18108 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18109 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18110 return (uint32_t)ret_conv;
18113 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
18114 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
18115 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18119 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
18120 if ((_res & 1) != 0) return;
18121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18122 CHECK_ACCESS(_res_ptr);
18123 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18125 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18128 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18129 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18130 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18131 return (uint32_t)ret_conv;
18133 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
18134 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
18135 uint32_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18139 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
18140 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
18141 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18142 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18143 return (uint32_t)ret_conv;
18146 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
18147 LDKChannelReestablish o_conv;
18148 o_conv.inner = (void*)(o & (~1));
18149 o_conv.is_owned = (o & 1) || (o == 0);
18150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18151 o_conv = ChannelReestablish_clone(&o_conv);
18152 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18153 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18154 return (uint32_t)ret_conv;
18157 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
18158 LDKDecodeError e_conv;
18159 e_conv.inner = (void*)(e & (~1));
18160 e_conv.is_owned = (e & 1) || (e == 0);
18161 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18162 e_conv = DecodeError_clone(&e_conv);
18163 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18164 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18165 return (uint32_t)ret_conv;
18168 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
18169 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
18170 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18174 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
18175 if ((_res & 1) != 0) return;
18176 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18177 CHECK_ACCESS(_res_ptr);
18178 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18180 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18183 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18184 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18185 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18186 return (uint32_t)ret_conv;
18188 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
18189 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
18190 uint32_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18194 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
18195 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
18196 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18197 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18198 return (uint32_t)ret_conv;
18201 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
18202 LDKClosingSigned o_conv;
18203 o_conv.inner = (void*)(o & (~1));
18204 o_conv.is_owned = (o & 1) || (o == 0);
18205 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18206 o_conv = ClosingSigned_clone(&o_conv);
18207 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18208 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18209 return (uint32_t)ret_conv;
18212 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
18213 LDKDecodeError e_conv;
18214 e_conv.inner = (void*)(e & (~1));
18215 e_conv.is_owned = (e & 1) || (e == 0);
18216 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18217 e_conv = DecodeError_clone(&e_conv);
18218 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18219 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18220 return (uint32_t)ret_conv;
18223 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
18224 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
18225 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18229 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
18230 if ((_res & 1) != 0) return;
18231 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18232 CHECK_ACCESS(_res_ptr);
18233 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18235 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18238 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18239 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18240 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18241 return (uint32_t)ret_conv;
18243 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18244 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
18245 uint32_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18249 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
18250 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
18251 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18252 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18253 return (uint32_t)ret_conv;
18256 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
18257 LDKClosingSignedFeeRange o_conv;
18258 o_conv.inner = (void*)(o & (~1));
18259 o_conv.is_owned = (o & 1) || (o == 0);
18260 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18261 o_conv = ClosingSignedFeeRange_clone(&o_conv);
18262 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18263 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18264 return (uint32_t)ret_conv;
18267 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
18268 LDKDecodeError e_conv;
18269 e_conv.inner = (void*)(e & (~1));
18270 e_conv.is_owned = (e & 1) || (e == 0);
18271 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18272 e_conv = DecodeError_clone(&e_conv);
18273 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18274 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18275 return (uint32_t)ret_conv;
18278 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
18279 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
18280 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18284 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
18285 if ((_res & 1) != 0) return;
18286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18287 CHECK_ACCESS(_res_ptr);
18288 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
18290 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
18293 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
18294 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18295 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
18296 return (uint32_t)ret_conv;
18298 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18299 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
18300 uint32_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
18304 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
18305 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
18306 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18307 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
18308 return (uint32_t)ret_conv;
18311 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
18312 LDKCommitmentSigned o_conv;
18313 o_conv.inner = (void*)(o & (~1));
18314 o_conv.is_owned = (o & 1) || (o == 0);
18315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18316 o_conv = CommitmentSigned_clone(&o_conv);
18317 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18318 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
18319 return (uint32_t)ret_conv;
18322 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
18323 LDKDecodeError e_conv;
18324 e_conv.inner = (void*)(e & (~1));
18325 e_conv.is_owned = (e & 1) || (e == 0);
18326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18327 e_conv = DecodeError_clone(&e_conv);
18328 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18329 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
18330 return (uint32_t)ret_conv;
18333 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
18334 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
18335 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
18339 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
18340 if ((_res & 1) != 0) return;
18341 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18342 CHECK_ACCESS(_res_ptr);
18343 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
18345 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
18348 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
18349 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18350 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
18351 return (uint32_t)ret_conv;
18353 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18354 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
18355 uint32_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
18359 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
18360 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
18361 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18362 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
18363 return (uint32_t)ret_conv;
18366 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
18367 LDKFundingCreated o_conv;
18368 o_conv.inner = (void*)(o & (~1));
18369 o_conv.is_owned = (o & 1) || (o == 0);
18370 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18371 o_conv = FundingCreated_clone(&o_conv);
18372 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18373 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
18374 return (uint32_t)ret_conv;
18377 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
18378 LDKDecodeError e_conv;
18379 e_conv.inner = (void*)(e & (~1));
18380 e_conv.is_owned = (e & 1) || (e == 0);
18381 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18382 e_conv = DecodeError_clone(&e_conv);
18383 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18384 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
18385 return (uint32_t)ret_conv;
18388 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
18389 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
18390 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
18394 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
18395 if ((_res & 1) != 0) return;
18396 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18397 CHECK_ACCESS(_res_ptr);
18398 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
18400 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
18403 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
18404 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18405 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
18406 return (uint32_t)ret_conv;
18408 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
18409 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
18410 uint32_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
18414 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
18415 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
18416 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18417 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
18418 return (uint32_t)ret_conv;
18421 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
18422 LDKFundingSigned o_conv;
18423 o_conv.inner = (void*)(o & (~1));
18424 o_conv.is_owned = (o & 1) || (o == 0);
18425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18426 o_conv = FundingSigned_clone(&o_conv);
18427 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18428 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
18429 return (uint32_t)ret_conv;
18432 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
18433 LDKDecodeError e_conv;
18434 e_conv.inner = (void*)(e & (~1));
18435 e_conv.is_owned = (e & 1) || (e == 0);
18436 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18437 e_conv = DecodeError_clone(&e_conv);
18438 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18439 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
18440 return (uint32_t)ret_conv;
18443 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
18444 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
18445 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
18449 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
18450 if ((_res & 1) != 0) return;
18451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18452 CHECK_ACCESS(_res_ptr);
18453 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
18455 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
18458 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
18459 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18460 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
18461 return (uint32_t)ret_conv;
18463 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18464 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
18465 uint32_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
18469 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
18470 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
18471 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18472 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
18473 return (uint32_t)ret_conv;
18476 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint32_t o) {
18477 LDKChannelReady o_conv;
18478 o_conv.inner = (void*)(o & (~1));
18479 o_conv.is_owned = (o & 1) || (o == 0);
18480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18481 o_conv = ChannelReady_clone(&o_conv);
18482 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18483 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
18484 return (uint32_t)ret_conv;
18487 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint32_t e) {
18488 LDKDecodeError e_conv;
18489 e_conv.inner = (void*)(e & (~1));
18490 e_conv.is_owned = (e & 1) || (e == 0);
18491 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18492 e_conv = DecodeError_clone(&e_conv);
18493 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18494 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
18495 return (uint32_t)ret_conv;
18498 jboolean __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint32_t o) {
18499 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
18500 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
18504 void __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint32_t _res) {
18505 if ((_res & 1) != 0) return;
18506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18507 CHECK_ACCESS(_res_ptr);
18508 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
18510 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
18513 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
18514 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18515 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
18516 return (uint32_t)ret_conv;
18518 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint32_t arg) {
18519 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
18520 uint32_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
18524 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint32_t orig) {
18525 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
18526 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18527 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
18528 return (uint32_t)ret_conv;
18531 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
18533 o_conv.inner = (void*)(o & (~1));
18534 o_conv.is_owned = (o & 1) || (o == 0);
18535 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18536 o_conv = Init_clone(&o_conv);
18537 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18538 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
18539 return (uint32_t)ret_conv;
18542 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
18543 LDKDecodeError e_conv;
18544 e_conv.inner = (void*)(e & (~1));
18545 e_conv.is_owned = (e & 1) || (e == 0);
18546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18547 e_conv = DecodeError_clone(&e_conv);
18548 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18549 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
18550 return (uint32_t)ret_conv;
18553 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
18554 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
18555 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
18559 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
18560 if ((_res & 1) != 0) return;
18561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18562 CHECK_ACCESS(_res_ptr);
18563 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
18565 CResult_InitDecodeErrorZ_free(_res_conv);
18568 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
18569 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18570 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
18571 return (uint32_t)ret_conv;
18573 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
18574 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
18575 uint32_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
18579 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
18580 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
18581 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18582 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
18583 return (uint32_t)ret_conv;
18586 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
18587 LDKOpenChannel o_conv;
18588 o_conv.inner = (void*)(o & (~1));
18589 o_conv.is_owned = (o & 1) || (o == 0);
18590 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18591 o_conv = OpenChannel_clone(&o_conv);
18592 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18593 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
18594 return (uint32_t)ret_conv;
18597 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
18598 LDKDecodeError e_conv;
18599 e_conv.inner = (void*)(e & (~1));
18600 e_conv.is_owned = (e & 1) || (e == 0);
18601 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18602 e_conv = DecodeError_clone(&e_conv);
18603 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18604 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
18605 return (uint32_t)ret_conv;
18608 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
18609 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
18610 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
18614 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
18615 if ((_res & 1) != 0) return;
18616 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18617 CHECK_ACCESS(_res_ptr);
18618 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18620 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18623 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18624 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18625 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18626 return (uint32_t)ret_conv;
18628 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18629 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
18630 uint32_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18634 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
18635 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
18636 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18637 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18638 return (uint32_t)ret_conv;
18641 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
18642 LDKRevokeAndACK o_conv;
18643 o_conv.inner = (void*)(o & (~1));
18644 o_conv.is_owned = (o & 1) || (o == 0);
18645 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18646 o_conv = RevokeAndACK_clone(&o_conv);
18647 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18648 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18649 return (uint32_t)ret_conv;
18652 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
18653 LDKDecodeError e_conv;
18654 e_conv.inner = (void*)(e & (~1));
18655 e_conv.is_owned = (e & 1) || (e == 0);
18656 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18657 e_conv = DecodeError_clone(&e_conv);
18658 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18659 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18660 return (uint32_t)ret_conv;
18663 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
18664 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
18665 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18669 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
18670 if ((_res & 1) != 0) return;
18671 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18672 CHECK_ACCESS(_res_ptr);
18673 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18675 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18678 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18679 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18680 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18681 return (uint32_t)ret_conv;
18683 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
18684 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
18685 uint32_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18689 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
18690 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
18691 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18692 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18693 return (uint32_t)ret_conv;
18696 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
18697 LDKShutdown o_conv;
18698 o_conv.inner = (void*)(o & (~1));
18699 o_conv.is_owned = (o & 1) || (o == 0);
18700 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18701 o_conv = Shutdown_clone(&o_conv);
18702 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18703 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18704 return (uint32_t)ret_conv;
18707 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
18708 LDKDecodeError e_conv;
18709 e_conv.inner = (void*)(e & (~1));
18710 e_conv.is_owned = (e & 1) || (e == 0);
18711 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18712 e_conv = DecodeError_clone(&e_conv);
18713 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18714 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18715 return (uint32_t)ret_conv;
18718 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
18719 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
18720 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18724 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
18725 if ((_res & 1) != 0) return;
18726 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18727 CHECK_ACCESS(_res_ptr);
18728 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18730 CResult_ShutdownDecodeErrorZ_free(_res_conv);
18733 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18734 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18735 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18736 return (uint32_t)ret_conv;
18738 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
18739 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
18740 uint32_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18744 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
18745 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
18746 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18747 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18748 return (uint32_t)ret_conv;
18751 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
18752 LDKUpdateFailHTLC o_conv;
18753 o_conv.inner = (void*)(o & (~1));
18754 o_conv.is_owned = (o & 1) || (o == 0);
18755 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18756 o_conv = UpdateFailHTLC_clone(&o_conv);
18757 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18758 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18759 return (uint32_t)ret_conv;
18762 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
18763 LDKDecodeError e_conv;
18764 e_conv.inner = (void*)(e & (~1));
18765 e_conv.is_owned = (e & 1) || (e == 0);
18766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18767 e_conv = DecodeError_clone(&e_conv);
18768 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18769 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18770 return (uint32_t)ret_conv;
18773 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
18774 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
18775 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18779 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
18780 if ((_res & 1) != 0) return;
18781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18782 CHECK_ACCESS(_res_ptr);
18783 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18785 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18788 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18789 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18790 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18791 return (uint32_t)ret_conv;
18793 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18794 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
18795 uint32_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18799 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
18800 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
18801 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18802 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18803 return (uint32_t)ret_conv;
18806 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
18807 LDKUpdateFailMalformedHTLC o_conv;
18808 o_conv.inner = (void*)(o & (~1));
18809 o_conv.is_owned = (o & 1) || (o == 0);
18810 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18811 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18812 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18813 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18814 return (uint32_t)ret_conv;
18817 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
18818 LDKDecodeError e_conv;
18819 e_conv.inner = (void*)(e & (~1));
18820 e_conv.is_owned = (e & 1) || (e == 0);
18821 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18822 e_conv = DecodeError_clone(&e_conv);
18823 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18824 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18825 return (uint32_t)ret_conv;
18828 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
18829 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
18830 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18834 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
18835 if ((_res & 1) != 0) return;
18836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18837 CHECK_ACCESS(_res_ptr);
18838 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18840 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18843 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18844 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18845 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18846 return (uint32_t)ret_conv;
18848 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18849 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
18850 uint32_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18854 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
18855 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
18856 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18857 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18858 return (uint32_t)ret_conv;
18861 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
18862 LDKUpdateFee o_conv;
18863 o_conv.inner = (void*)(o & (~1));
18864 o_conv.is_owned = (o & 1) || (o == 0);
18865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18866 o_conv = UpdateFee_clone(&o_conv);
18867 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18868 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18869 return (uint32_t)ret_conv;
18872 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
18873 LDKDecodeError e_conv;
18874 e_conv.inner = (void*)(e & (~1));
18875 e_conv.is_owned = (e & 1) || (e == 0);
18876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18877 e_conv = DecodeError_clone(&e_conv);
18878 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18879 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18880 return (uint32_t)ret_conv;
18883 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
18884 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18885 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18889 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
18890 if ((_res & 1) != 0) return;
18891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18892 CHECK_ACCESS(_res_ptr);
18893 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18895 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18898 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18899 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18900 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18901 return (uint32_t)ret_conv;
18903 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
18904 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18905 uint32_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18909 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
18910 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18911 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18912 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18913 return (uint32_t)ret_conv;
18916 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
18917 LDKUpdateFulfillHTLC o_conv;
18918 o_conv.inner = (void*)(o & (~1));
18919 o_conv.is_owned = (o & 1) || (o == 0);
18920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18921 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18922 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18923 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18924 return (uint32_t)ret_conv;
18927 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
18928 LDKDecodeError e_conv;
18929 e_conv.inner = (void*)(e & (~1));
18930 e_conv.is_owned = (e & 1) || (e == 0);
18931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18932 e_conv = DecodeError_clone(&e_conv);
18933 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18934 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18935 return (uint32_t)ret_conv;
18938 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
18939 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18940 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18944 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
18945 if ((_res & 1) != 0) return;
18946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18947 CHECK_ACCESS(_res_ptr);
18948 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18950 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18953 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18954 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18955 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18956 return (uint32_t)ret_conv;
18958 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18959 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18960 uint32_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18964 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
18965 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18966 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18967 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18968 return (uint32_t)ret_conv;
18971 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
18972 LDKUpdateAddHTLC o_conv;
18973 o_conv.inner = (void*)(o & (~1));
18974 o_conv.is_owned = (o & 1) || (o == 0);
18975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18976 o_conv = UpdateAddHTLC_clone(&o_conv);
18977 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18978 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18979 return (uint32_t)ret_conv;
18982 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
18983 LDKDecodeError e_conv;
18984 e_conv.inner = (void*)(e & (~1));
18985 e_conv.is_owned = (e & 1) || (e == 0);
18986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18987 e_conv = DecodeError_clone(&e_conv);
18988 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18989 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18990 return (uint32_t)ret_conv;
18993 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
18994 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18995 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18999 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
19000 if ((_res & 1) != 0) return;
19001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19002 CHECK_ACCESS(_res_ptr);
19003 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19005 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19008 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19009 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19010 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19011 return (uint32_t)ret_conv;
19013 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19014 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
19015 uint32_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19019 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
19020 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
19021 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19022 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19023 return (uint32_t)ret_conv;
19026 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
19028 o_conv.inner = (void*)(o & (~1));
19029 o_conv.is_owned = (o & 1) || (o == 0);
19030 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19031 o_conv = Ping_clone(&o_conv);
19032 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19033 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19034 return (uint32_t)ret_conv;
19037 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
19038 LDKDecodeError e_conv;
19039 e_conv.inner = (void*)(e & (~1));
19040 e_conv.is_owned = (e & 1) || (e == 0);
19041 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19042 e_conv = DecodeError_clone(&e_conv);
19043 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19044 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19045 return (uint32_t)ret_conv;
19048 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
19049 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
19050 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19054 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
19055 if ((_res & 1) != 0) return;
19056 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19057 CHECK_ACCESS(_res_ptr);
19058 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19060 CResult_PingDecodeErrorZ_free(_res_conv);
19063 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19064 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19065 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19066 return (uint32_t)ret_conv;
19068 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
19069 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
19070 uint32_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19074 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
19075 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
19076 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19077 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19078 return (uint32_t)ret_conv;
19081 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
19083 o_conv.inner = (void*)(o & (~1));
19084 o_conv.is_owned = (o & 1) || (o == 0);
19085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19086 o_conv = Pong_clone(&o_conv);
19087 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19088 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19089 return (uint32_t)ret_conv;
19092 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
19093 LDKDecodeError e_conv;
19094 e_conv.inner = (void*)(e & (~1));
19095 e_conv.is_owned = (e & 1) || (e == 0);
19096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19097 e_conv = DecodeError_clone(&e_conv);
19098 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19099 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19100 return (uint32_t)ret_conv;
19103 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
19104 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
19105 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19109 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
19110 if ((_res & 1) != 0) return;
19111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19112 CHECK_ACCESS(_res_ptr);
19113 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19115 CResult_PongDecodeErrorZ_free(_res_conv);
19118 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19119 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19120 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19121 return (uint32_t)ret_conv;
19123 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
19124 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
19125 uint32_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19129 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
19130 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
19131 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19132 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19133 return (uint32_t)ret_conv;
19136 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19137 LDKUnsignedChannelAnnouncement o_conv;
19138 o_conv.inner = (void*)(o & (~1));
19139 o_conv.is_owned = (o & 1) || (o == 0);
19140 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19141 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19142 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19143 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19144 return (uint32_t)ret_conv;
19147 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19148 LDKDecodeError e_conv;
19149 e_conv.inner = (void*)(e & (~1));
19150 e_conv.is_owned = (e & 1) || (e == 0);
19151 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19152 e_conv = DecodeError_clone(&e_conv);
19153 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19154 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19155 return (uint32_t)ret_conv;
19158 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19159 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
19160 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19164 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19165 if ((_res & 1) != 0) return;
19166 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19167 CHECK_ACCESS(_res_ptr);
19168 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19170 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19173 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19174 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19175 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19176 return (uint32_t)ret_conv;
19178 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19179 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19180 uint32_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19184 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19185 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19186 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19187 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19188 return (uint32_t)ret_conv;
19191 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19192 LDKChannelAnnouncement o_conv;
19193 o_conv.inner = (void*)(o & (~1));
19194 o_conv.is_owned = (o & 1) || (o == 0);
19195 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19196 o_conv = ChannelAnnouncement_clone(&o_conv);
19197 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19198 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19199 return (uint32_t)ret_conv;
19202 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19203 LDKDecodeError e_conv;
19204 e_conv.inner = (void*)(e & (~1));
19205 e_conv.is_owned = (e & 1) || (e == 0);
19206 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19207 e_conv = DecodeError_clone(&e_conv);
19208 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19209 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19210 return (uint32_t)ret_conv;
19213 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19214 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
19215 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19219 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19220 if ((_res & 1) != 0) return;
19221 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19222 CHECK_ACCESS(_res_ptr);
19223 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19225 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19228 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19229 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19230 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19231 return (uint32_t)ret_conv;
19233 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19234 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19235 uint32_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19239 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19240 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19241 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19242 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19243 return (uint32_t)ret_conv;
19246 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19247 LDKUnsignedChannelUpdate o_conv;
19248 o_conv.inner = (void*)(o & (~1));
19249 o_conv.is_owned = (o & 1) || (o == 0);
19250 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19251 o_conv = UnsignedChannelUpdate_clone(&o_conv);
19252 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19253 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
19254 return (uint32_t)ret_conv;
19257 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
19258 LDKDecodeError e_conv;
19259 e_conv.inner = (void*)(e & (~1));
19260 e_conv.is_owned = (e & 1) || (e == 0);
19261 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19262 e_conv = DecodeError_clone(&e_conv);
19263 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19264 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
19265 return (uint32_t)ret_conv;
19268 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19269 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
19270 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
19274 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19275 if ((_res & 1) != 0) return;
19276 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19277 CHECK_ACCESS(_res_ptr);
19278 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
19280 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
19283 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19284 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19285 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
19286 return (uint32_t)ret_conv;
19288 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19289 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
19290 uint32_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19294 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19295 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
19296 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19297 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
19298 return (uint32_t)ret_conv;
19301 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19302 LDKChannelUpdate o_conv;
19303 o_conv.inner = (void*)(o & (~1));
19304 o_conv.is_owned = (o & 1) || (o == 0);
19305 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19306 o_conv = ChannelUpdate_clone(&o_conv);
19307 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19308 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
19309 return (uint32_t)ret_conv;
19312 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
19313 LDKDecodeError e_conv;
19314 e_conv.inner = (void*)(e & (~1));
19315 e_conv.is_owned = (e & 1) || (e == 0);
19316 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19317 e_conv = DecodeError_clone(&e_conv);
19318 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19319 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
19320 return (uint32_t)ret_conv;
19323 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19324 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
19325 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
19329 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19330 if ((_res & 1) != 0) return;
19331 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19332 CHECK_ACCESS(_res_ptr);
19333 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
19335 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
19338 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19339 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19340 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
19341 return (uint32_t)ret_conv;
19343 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19344 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
19345 uint32_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19349 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19350 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
19351 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19352 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
19353 return (uint32_t)ret_conv;
19356 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
19357 LDKErrorMessage o_conv;
19358 o_conv.inner = (void*)(o & (~1));
19359 o_conv.is_owned = (o & 1) || (o == 0);
19360 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19361 o_conv = ErrorMessage_clone(&o_conv);
19362 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19363 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
19364 return (uint32_t)ret_conv;
19367 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
19368 LDKDecodeError e_conv;
19369 e_conv.inner = (void*)(e & (~1));
19370 e_conv.is_owned = (e & 1) || (e == 0);
19371 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19372 e_conv = DecodeError_clone(&e_conv);
19373 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19374 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
19375 return (uint32_t)ret_conv;
19378 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
19379 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
19380 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
19384 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
19385 if ((_res & 1) != 0) return;
19386 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19387 CHECK_ACCESS(_res_ptr);
19388 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
19390 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
19393 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
19394 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19395 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
19396 return (uint32_t)ret_conv;
19398 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19399 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
19400 uint32_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
19404 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
19405 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
19406 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19407 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
19408 return (uint32_t)ret_conv;
19411 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
19412 LDKWarningMessage o_conv;
19413 o_conv.inner = (void*)(o & (~1));
19414 o_conv.is_owned = (o & 1) || (o == 0);
19415 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19416 o_conv = WarningMessage_clone(&o_conv);
19417 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19418 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
19419 return (uint32_t)ret_conv;
19422 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
19423 LDKDecodeError e_conv;
19424 e_conv.inner = (void*)(e & (~1));
19425 e_conv.is_owned = (e & 1) || (e == 0);
19426 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19427 e_conv = DecodeError_clone(&e_conv);
19428 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19429 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
19430 return (uint32_t)ret_conv;
19433 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
19434 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
19435 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
19439 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
19440 if ((_res & 1) != 0) return;
19441 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19442 CHECK_ACCESS(_res_ptr);
19443 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
19445 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
19448 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
19449 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19450 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
19451 return (uint32_t)ret_conv;
19453 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19454 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
19455 uint32_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
19459 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
19460 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
19461 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19462 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
19463 return (uint32_t)ret_conv;
19466 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19467 LDKUnsignedNodeAnnouncement o_conv;
19468 o_conv.inner = (void*)(o & (~1));
19469 o_conv.is_owned = (o & 1) || (o == 0);
19470 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19471 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
19472 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19473 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
19474 return (uint32_t)ret_conv;
19477 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19478 LDKDecodeError e_conv;
19479 e_conv.inner = (void*)(e & (~1));
19480 e_conv.is_owned = (e & 1) || (e == 0);
19481 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19482 e_conv = DecodeError_clone(&e_conv);
19483 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19484 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
19485 return (uint32_t)ret_conv;
19488 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19489 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
19490 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19494 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19495 if ((_res & 1) != 0) return;
19496 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19497 CHECK_ACCESS(_res_ptr);
19498 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
19500 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
19503 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19504 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19505 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
19506 return (uint32_t)ret_conv;
19508 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19509 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
19510 uint32_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19514 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19515 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
19516 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19517 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
19518 return (uint32_t)ret_conv;
19521 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19522 LDKNodeAnnouncement o_conv;
19523 o_conv.inner = (void*)(o & (~1));
19524 o_conv.is_owned = (o & 1) || (o == 0);
19525 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19526 o_conv = NodeAnnouncement_clone(&o_conv);
19527 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19528 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
19529 return (uint32_t)ret_conv;
19532 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19533 LDKDecodeError e_conv;
19534 e_conv.inner = (void*)(e & (~1));
19535 e_conv.is_owned = (e & 1) || (e == 0);
19536 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19537 e_conv = DecodeError_clone(&e_conv);
19538 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19539 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
19540 return (uint32_t)ret_conv;
19543 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19544 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
19545 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19549 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19550 if ((_res & 1) != 0) return;
19551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19552 CHECK_ACCESS(_res_ptr);
19553 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
19555 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
19558 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19559 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19560 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
19561 return (uint32_t)ret_conv;
19563 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19564 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
19565 uint32_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19569 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19570 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
19571 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19572 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
19573 return (uint32_t)ret_conv;
19576 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
19577 LDKQueryShortChannelIds o_conv;
19578 o_conv.inner = (void*)(o & (~1));
19579 o_conv.is_owned = (o & 1) || (o == 0);
19580 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19581 o_conv = QueryShortChannelIds_clone(&o_conv);
19582 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19583 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
19584 return (uint32_t)ret_conv;
19587 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
19588 LDKDecodeError e_conv;
19589 e_conv.inner = (void*)(e & (~1));
19590 e_conv.is_owned = (e & 1) || (e == 0);
19591 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19592 e_conv = DecodeError_clone(&e_conv);
19593 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19594 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
19595 return (uint32_t)ret_conv;
19598 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
19599 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
19600 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
19604 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
19605 if ((_res & 1) != 0) return;
19606 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19607 CHECK_ACCESS(_res_ptr);
19608 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
19610 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
19613 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
19614 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19615 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
19616 return (uint32_t)ret_conv;
19618 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
19619 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
19620 uint32_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19624 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
19625 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
19626 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19627 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19628 return (uint32_t)ret_conv;
19631 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
19632 LDKReplyShortChannelIdsEnd o_conv;
19633 o_conv.inner = (void*)(o & (~1));
19634 o_conv.is_owned = (o & 1) || (o == 0);
19635 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19636 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19637 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19638 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19639 return (uint32_t)ret_conv;
19642 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
19643 LDKDecodeError e_conv;
19644 e_conv.inner = (void*)(e & (~1));
19645 e_conv.is_owned = (e & 1) || (e == 0);
19646 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19647 e_conv = DecodeError_clone(&e_conv);
19648 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19649 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19650 return (uint32_t)ret_conv;
19653 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
19654 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
19655 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19659 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
19660 if ((_res & 1) != 0) return;
19661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19662 CHECK_ACCESS(_res_ptr);
19663 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19665 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19668 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19669 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19670 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19671 return (uint32_t)ret_conv;
19673 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
19674 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
19675 uint32_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19679 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
19680 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
19681 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19682 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19683 return (uint32_t)ret_conv;
19686 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
19687 LDKQueryChannelRange o_conv;
19688 o_conv.inner = (void*)(o & (~1));
19689 o_conv.is_owned = (o & 1) || (o == 0);
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19691 o_conv = QueryChannelRange_clone(&o_conv);
19692 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19693 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19694 return (uint32_t)ret_conv;
19697 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
19698 LDKDecodeError e_conv;
19699 e_conv.inner = (void*)(e & (~1));
19700 e_conv.is_owned = (e & 1) || (e == 0);
19701 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19702 e_conv = DecodeError_clone(&e_conv);
19703 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19704 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19705 return (uint32_t)ret_conv;
19708 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19709 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
19710 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19714 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
19715 if ((_res & 1) != 0) return;
19716 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19717 CHECK_ACCESS(_res_ptr);
19718 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19720 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19723 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19724 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19725 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19726 return (uint32_t)ret_conv;
19728 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19729 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
19730 uint32_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19734 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19735 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
19736 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19737 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19738 return (uint32_t)ret_conv;
19741 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
19742 LDKReplyChannelRange o_conv;
19743 o_conv.inner = (void*)(o & (~1));
19744 o_conv.is_owned = (o & 1) || (o == 0);
19745 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19746 o_conv = ReplyChannelRange_clone(&o_conv);
19747 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19748 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19749 return (uint32_t)ret_conv;
19752 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
19753 LDKDecodeError e_conv;
19754 e_conv.inner = (void*)(e & (~1));
19755 e_conv.is_owned = (e & 1) || (e == 0);
19756 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19757 e_conv = DecodeError_clone(&e_conv);
19758 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19759 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19760 return (uint32_t)ret_conv;
19763 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19764 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
19765 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19769 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
19770 if ((_res & 1) != 0) return;
19771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19772 CHECK_ACCESS(_res_ptr);
19773 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19775 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19778 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19779 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19780 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19781 return (uint32_t)ret_conv;
19783 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19784 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
19785 uint32_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19789 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19790 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
19791 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19792 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19793 return (uint32_t)ret_conv;
19796 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
19797 LDKGossipTimestampFilter o_conv;
19798 o_conv.inner = (void*)(o & (~1));
19799 o_conv.is_owned = (o & 1) || (o == 0);
19800 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19801 o_conv = GossipTimestampFilter_clone(&o_conv);
19802 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19803 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19804 return (uint32_t)ret_conv;
19807 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
19808 LDKDecodeError e_conv;
19809 e_conv.inner = (void*)(e & (~1));
19810 e_conv.is_owned = (e & 1) || (e == 0);
19811 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19812 e_conv = DecodeError_clone(&e_conv);
19813 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19814 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19815 return (uint32_t)ret_conv;
19818 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
19819 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
19820 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19824 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
19825 if ((_res & 1) != 0) return;
19826 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19827 CHECK_ACCESS(_res_ptr);
19828 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19830 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19833 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19834 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19835 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19836 return (uint32_t)ret_conv;
19838 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
19839 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
19840 uint32_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19844 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
19845 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
19846 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19847 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19848 return (uint32_t)ret_conv;
19851 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
19853 o_conv.inner = (void*)(o & (~1));
19854 o_conv.is_owned = (o & 1) || (o == 0);
19855 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19856 o_conv = Invoice_clone(&o_conv);
19857 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19858 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19859 return (uint32_t)ret_conv;
19862 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
19863 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19864 CHECK_ACCESS(e_ptr);
19865 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19866 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
19867 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19868 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19869 return (uint32_t)ret_conv;
19872 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
19873 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19874 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19878 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
19879 if ((_res & 1) != 0) return;
19880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19881 CHECK_ACCESS(_res_ptr);
19882 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19884 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19887 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19888 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19889 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19890 return (uint32_t)ret_conv;
19892 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
19893 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19894 uint32_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19898 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
19899 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19900 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19901 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19902 return (uint32_t)ret_conv;
19905 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
19906 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19907 CHECK_ACCESS(o_ptr);
19908 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19909 if (o_conv.free == LDKFilter_JCalls_free) {
19910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19911 LDKFilter_JCalls_cloned(&o_conv);
19913 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19914 *ret_copy = COption_FilterZ_some(o_conv);
19915 uint32_t ret_ref = (uintptr_t)ret_copy;
19919 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19920 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19921 *ret_copy = COption_FilterZ_none();
19922 uint32_t ret_ref = (uintptr_t)ret_copy;
19926 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
19927 if ((_res & 1) != 0) return;
19928 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19929 CHECK_ACCESS(_res_ptr);
19930 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19932 COption_FilterZ_free(_res_conv);
19935 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
19936 LDKLockedChannelMonitor o_conv;
19937 o_conv.inner = (void*)(o & (~1));
19938 o_conv.is_owned = (o & 1) || (o == 0);
19939 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19940 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19941 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19942 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19943 return (uint32_t)ret_conv;
19946 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19947 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19948 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19949 return (uint32_t)ret_conv;
19952 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
19953 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19954 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19958 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
19959 if ((_res & 1) != 0) return;
19960 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19961 CHECK_ACCESS(_res_ptr);
19962 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19964 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19967 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
19968 LDKCVec_OutPointZ _res_constr;
19969 _res_constr.datalen = _res->arr_len;
19970 if (_res_constr.datalen > 0)
19971 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19973 _res_constr.data = NULL;
19974 uint32_t* _res_vals = _res->elems;
19975 for (size_t k = 0; k < _res_constr.datalen; k++) {
19976 uint32_t _res_conv_10 = _res_vals[k];
19977 LDKOutPoint _res_conv_10_conv;
19978 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19979 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19980 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19981 _res_constr.data[k] = _res_conv_10_conv;
19984 CVec_OutPointZ_free(_res_constr);
19987 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
19988 if ((this_ptr & 1) != 0) return;
19989 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19990 CHECK_ACCESS(this_ptr_ptr);
19991 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19992 FREE((void*)this_ptr);
19993 PaymentPurpose_free(this_ptr_conv);
19996 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19997 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19998 *ret_copy = PaymentPurpose_clone(arg);
19999 uint32_t ret_ref = (uintptr_t)ret_copy;
20002 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
20003 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
20004 uint32_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20008 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
20009 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
20010 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20011 *ret_copy = PaymentPurpose_clone(orig_conv);
20012 uint32_t ret_ref = (uintptr_t)ret_copy;
20016 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20017 LDKThirtyTwoBytes payment_preimage_ref;
20018 CHECK(payment_preimage->arr_len == 32);
20019 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20020 LDKThirtyTwoBytes payment_secret_ref;
20021 CHECK(payment_secret->arr_len == 32);
20022 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20023 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20024 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20025 uint32_t ret_ref = (uintptr_t)ret_copy;
20029 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20030 LDKThirtyTwoBytes a_ref;
20031 CHECK(a->arr_len == 32);
20032 memcpy(a_ref.data, a->elems, 32); FREE(a);
20033 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20034 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20035 uint32_t ret_ref = (uintptr_t)ret_copy;
20039 int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint32_t obj) {
20040 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
20041 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20042 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20043 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20044 CVec_u8Z_free(ret_var);
20048 uint32_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20049 LDKu8slice ser_ref;
20050 ser_ref.datalen = ser->arr_len;
20051 ser_ref.data = ser->elems;
20052 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20053 *ret_conv = PaymentPurpose_read(ser_ref);
20055 return (uint32_t)ret_conv;
20058 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
20059 if ((this_ptr & 1) != 0) return;
20060 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20061 CHECK_ACCESS(this_ptr_ptr);
20062 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20063 FREE((void*)this_ptr);
20064 ClosureReason_free(this_ptr_conv);
20067 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20068 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20069 *ret_copy = ClosureReason_clone(arg);
20070 uint32_t ret_ref = (uintptr_t)ret_copy;
20073 uint32_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
20074 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
20075 uint32_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20079 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
20080 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
20081 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20082 *ret_copy = ClosureReason_clone(orig_conv);
20083 uint32_t ret_ref = (uintptr_t)ret_copy;
20087 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20088 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20089 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20090 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20091 uint32_t ret_ref = (uintptr_t)ret_copy;
20095 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20096 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20097 *ret_copy = ClosureReason_holder_force_closed();
20098 uint32_t ret_ref = (uintptr_t)ret_copy;
20102 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20103 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20104 *ret_copy = ClosureReason_cooperative_closure();
20105 uint32_t ret_ref = (uintptr_t)ret_copy;
20109 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20110 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20111 *ret_copy = ClosureReason_commitment_tx_confirmed();
20112 uint32_t ret_ref = (uintptr_t)ret_copy;
20116 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20117 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20118 *ret_copy = ClosureReason_funding_timed_out();
20119 uint32_t ret_ref = (uintptr_t)ret_copy;
20123 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20124 LDKStr err_conv = str_ref_to_owned_c(err);
20125 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20126 *ret_copy = ClosureReason_processing_error(err_conv);
20127 uint32_t ret_ref = (uintptr_t)ret_copy;
20131 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20132 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20133 *ret_copy = ClosureReason_disconnected_peer();
20134 uint32_t ret_ref = (uintptr_t)ret_copy;
20138 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20139 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20140 *ret_copy = ClosureReason_outdated_channel_manager();
20141 uint32_t ret_ref = (uintptr_t)ret_copy;
20145 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
20146 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
20147 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20148 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20149 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20150 CVec_u8Z_free(ret_var);
20154 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20155 LDKu8slice ser_ref;
20156 ser_ref.datalen = ser->arr_len;
20157 ser_ref.data = ser->elems;
20158 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20159 *ret_conv = ClosureReason_read(ser_ref);
20161 return (uint32_t)ret_conv;
20164 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
20165 if ((this_ptr & 1) != 0) return;
20166 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20167 CHECK_ACCESS(this_ptr_ptr);
20168 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
20169 FREE((void*)this_ptr);
20170 Event_free(this_ptr_conv);
20173 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
20174 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20175 *ret_copy = Event_clone(arg);
20176 uint32_t ret_ref = (uintptr_t)ret_copy;
20179 uint32_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
20180 LDKEvent* arg_conv = (LDKEvent*)arg;
20181 uint32_t ret_conv = Event_clone_ptr(arg_conv);
20185 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
20186 LDKEvent* orig_conv = (LDKEvent*)orig;
20187 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20188 *ret_copy = Event_clone(orig_conv);
20189 uint32_t ret_ref = (uintptr_t)ret_copy;
20193 uint32_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
20194 LDKThirtyTwoBytes temporary_channel_id_ref;
20195 CHECK(temporary_channel_id->arr_len == 32);
20196 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20197 LDKPublicKey counterparty_node_id_ref;
20198 CHECK(counterparty_node_id->arr_len == 33);
20199 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20200 LDKCVec_u8Z output_script_ref;
20201 output_script_ref.datalen = output_script->arr_len;
20202 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
20203 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
20204 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20205 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
20206 uint32_t ret_ref = (uintptr_t)ret_copy;
20210 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20211 LDKThirtyTwoBytes payment_hash_ref;
20212 CHECK(payment_hash->arr_len == 32);
20213 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20214 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20215 CHECK_ACCESS(purpose_ptr);
20216 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20217 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20218 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20219 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
20220 uint32_t ret_ref = (uintptr_t)ret_copy;
20224 uint32_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20225 LDKThirtyTwoBytes payment_hash_ref;
20226 CHECK(payment_hash->arr_len == 32);
20227 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20228 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20229 CHECK_ACCESS(purpose_ptr);
20230 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20231 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20232 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20233 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
20234 uint32_t ret_ref = (uintptr_t)ret_copy;
20238 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) {
20239 LDKThirtyTwoBytes payment_id_ref;
20240 CHECK(payment_id->arr_len == 32);
20241 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20242 LDKThirtyTwoBytes payment_preimage_ref;
20243 CHECK(payment_preimage->arr_len == 32);
20244 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20245 LDKThirtyTwoBytes payment_hash_ref;
20246 CHECK(payment_hash->arr_len == 32);
20247 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20248 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
20249 CHECK_ACCESS(fee_paid_msat_ptr);
20250 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
20251 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
20252 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20253 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
20254 uint32_t ret_ref = (uintptr_t)ret_copy;
20258 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
20259 LDKThirtyTwoBytes payment_id_ref;
20260 CHECK(payment_id->arr_len == 32);
20261 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20262 LDKThirtyTwoBytes payment_hash_ref;
20263 CHECK(payment_hash->arr_len == 32);
20264 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20265 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20266 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
20267 uint32_t ret_ref = (uintptr_t)ret_copy;
20271 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) {
20272 LDKThirtyTwoBytes payment_id_ref;
20273 CHECK(payment_id->arr_len == 32);
20274 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20275 LDKThirtyTwoBytes payment_hash_ref;
20276 CHECK(payment_hash->arr_len == 32);
20277 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20278 LDKCVec_RouteHopZ path_constr;
20279 path_constr.datalen = path->arr_len;
20280 if (path_constr.datalen > 0)
20281 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20283 path_constr.data = NULL;
20284 uint32_t* path_vals = path->elems;
20285 for (size_t k = 0; k < path_constr.datalen; k++) {
20286 uint32_t path_conv_10 = path_vals[k];
20287 LDKRouteHop path_conv_10_conv;
20288 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20289 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20290 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20291 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20292 path_constr.data[k] = path_conv_10_conv;
20295 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20296 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
20297 uint32_t ret_ref = (uintptr_t)ret_copy;
20301 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) {
20302 LDKThirtyTwoBytes payment_id_ref;
20303 CHECK(payment_id->arr_len == 32);
20304 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20305 LDKThirtyTwoBytes payment_hash_ref;
20306 CHECK(payment_hash->arr_len == 32);
20307 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20308 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
20309 CHECK_ACCESS(network_update_ptr);
20310 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
20311 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
20312 LDKCVec_RouteHopZ path_constr;
20313 path_constr.datalen = path->arr_len;
20314 if (path_constr.datalen > 0)
20315 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20317 path_constr.data = NULL;
20318 uint32_t* path_vals = path->elems;
20319 for (size_t k = 0; k < path_constr.datalen; k++) {
20320 uint32_t path_conv_10 = path_vals[k];
20321 LDKRouteHop path_conv_10_conv;
20322 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20323 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20324 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20325 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20326 path_constr.data[k] = path_conv_10_conv;
20329 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
20330 CHECK_ACCESS(short_channel_id_ptr);
20331 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
20332 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
20333 LDKRouteParameters retry_conv;
20334 retry_conv.inner = (void*)(retry & (~1));
20335 retry_conv.is_owned = (retry & 1) || (retry == 0);
20336 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
20337 retry_conv = RouteParameters_clone(&retry_conv);
20338 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20339 *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);
20340 uint32_t ret_ref = (uintptr_t)ret_copy;
20344 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
20345 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20346 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
20347 uint32_t ret_ref = (uintptr_t)ret_copy;
20351 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
20352 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
20353 outputs_constr.datalen = outputs->arr_len;
20354 if (outputs_constr.datalen > 0)
20355 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20357 outputs_constr.data = NULL;
20358 uint32_t* outputs_vals = outputs->elems;
20359 for (size_t b = 0; b < outputs_constr.datalen; b++) {
20360 uint32_t outputs_conv_27 = outputs_vals[b];
20361 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
20362 CHECK_ACCESS(outputs_conv_27_ptr);
20363 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
20364 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
20365 outputs_constr.data[b] = outputs_conv_27_conv;
20368 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20369 *ret_copy = Event_spendable_outputs(outputs_constr);
20370 uint32_t ret_ref = (uintptr_t)ret_copy;
20374 uint32_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(int8_tArray prev_channel_id, int8_tArray next_channel_id, uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
20375 LDKThirtyTwoBytes prev_channel_id_ref;
20376 CHECK(prev_channel_id->arr_len == 32);
20377 memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
20378 LDKThirtyTwoBytes next_channel_id_ref;
20379 CHECK(next_channel_id->arr_len == 32);
20380 memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
20381 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
20382 CHECK_ACCESS(fee_earned_msat_ptr);
20383 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
20384 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
20385 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20386 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
20387 uint32_t ret_ref = (uintptr_t)ret_copy;
20391 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) {
20392 LDKThirtyTwoBytes channel_id_ref;
20393 CHECK(channel_id->arr_len == 32);
20394 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20395 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
20396 CHECK_ACCESS(reason_ptr);
20397 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
20398 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
20399 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20400 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
20401 uint32_t ret_ref = (uintptr_t)ret_copy;
20405 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
20406 LDKThirtyTwoBytes channel_id_ref;
20407 CHECK(channel_id->arr_len == 32);
20408 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20409 LDKTransaction transaction_ref;
20410 transaction_ref.datalen = transaction->arr_len;
20411 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
20412 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
20413 transaction_ref.data_is_owned = true;
20414 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20415 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
20416 uint32_t ret_ref = (uintptr_t)ret_copy;
20420 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, uint32_t channel_type) {
20421 LDKThirtyTwoBytes temporary_channel_id_ref;
20422 CHECK(temporary_channel_id->arr_len == 32);
20423 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20424 LDKPublicKey counterparty_node_id_ref;
20425 CHECK(counterparty_node_id->arr_len == 33);
20426 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20427 LDKChannelTypeFeatures channel_type_conv;
20428 channel_type_conv.inner = (void*)(channel_type & (~1));
20429 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
20430 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
20431 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
20432 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20433 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
20434 uint32_t ret_ref = (uintptr_t)ret_copy;
20438 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
20439 LDKEvent* obj_conv = (LDKEvent*)obj;
20440 LDKCVec_u8Z ret_var = Event_write(obj_conv);
20441 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20442 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20443 CVec_u8Z_free(ret_var);
20447 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
20448 LDKu8slice ser_ref;
20449 ser_ref.datalen = ser->arr_len;
20450 ser_ref.data = ser->elems;
20451 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
20452 *ret_conv = Event_read(ser_ref);
20454 return (uint32_t)ret_conv;
20457 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
20458 if ((this_ptr & 1) != 0) return;
20459 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20460 CHECK_ACCESS(this_ptr_ptr);
20461 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20462 FREE((void*)this_ptr);
20463 MessageSendEvent_free(this_ptr_conv);
20466 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20467 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20468 *ret_copy = MessageSendEvent_clone(arg);
20469 uint32_t ret_ref = (uintptr_t)ret_copy;
20472 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
20473 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
20474 uint32_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
20478 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
20479 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
20480 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20481 *ret_copy = MessageSendEvent_clone(orig_conv);
20482 uint32_t ret_ref = (uintptr_t)ret_copy;
20486 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
20487 LDKPublicKey node_id_ref;
20488 CHECK(node_id->arr_len == 33);
20489 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20490 LDKAcceptChannel msg_conv;
20491 msg_conv.inner = (void*)(msg & (~1));
20492 msg_conv.is_owned = (msg & 1) || (msg == 0);
20493 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20494 msg_conv = AcceptChannel_clone(&msg_conv);
20495 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20496 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20497 uint32_t ret_ref = (uintptr_t)ret_copy;
20501 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
20502 LDKPublicKey node_id_ref;
20503 CHECK(node_id->arr_len == 33);
20504 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20505 LDKOpenChannel msg_conv;
20506 msg_conv.inner = (void*)(msg & (~1));
20507 msg_conv.is_owned = (msg & 1) || (msg == 0);
20508 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20509 msg_conv = OpenChannel_clone(&msg_conv);
20510 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20511 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20512 uint32_t ret_ref = (uintptr_t)ret_copy;
20516 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
20517 LDKPublicKey node_id_ref;
20518 CHECK(node_id->arr_len == 33);
20519 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20520 LDKFundingCreated msg_conv;
20521 msg_conv.inner = (void*)(msg & (~1));
20522 msg_conv.is_owned = (msg & 1) || (msg == 0);
20523 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20524 msg_conv = FundingCreated_clone(&msg_conv);
20525 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20526 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20527 uint32_t ret_ref = (uintptr_t)ret_copy;
20531 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
20532 LDKPublicKey node_id_ref;
20533 CHECK(node_id->arr_len == 33);
20534 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20535 LDKFundingSigned msg_conv;
20536 msg_conv.inner = (void*)(msg & (~1));
20537 msg_conv.is_owned = (msg & 1) || (msg == 0);
20538 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20539 msg_conv = FundingSigned_clone(&msg_conv);
20540 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20541 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20542 uint32_t ret_ref = (uintptr_t)ret_copy;
20546 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint32_t msg) {
20547 LDKPublicKey node_id_ref;
20548 CHECK(node_id->arr_len == 33);
20549 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20550 LDKChannelReady msg_conv;
20551 msg_conv.inner = (void*)(msg & (~1));
20552 msg_conv.is_owned = (msg & 1) || (msg == 0);
20553 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20554 msg_conv = ChannelReady_clone(&msg_conv);
20555 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20556 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
20557 uint32_t ret_ref = (uintptr_t)ret_copy;
20561 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
20562 LDKPublicKey node_id_ref;
20563 CHECK(node_id->arr_len == 33);
20564 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20565 LDKAnnouncementSignatures msg_conv;
20566 msg_conv.inner = (void*)(msg & (~1));
20567 msg_conv.is_owned = (msg & 1) || (msg == 0);
20568 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20569 msg_conv = AnnouncementSignatures_clone(&msg_conv);
20570 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20571 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20572 uint32_t ret_ref = (uintptr_t)ret_copy;
20576 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
20577 LDKPublicKey node_id_ref;
20578 CHECK(node_id->arr_len == 33);
20579 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20580 LDKCommitmentUpdate updates_conv;
20581 updates_conv.inner = (void*)(updates & (~1));
20582 updates_conv.is_owned = (updates & 1) || (updates == 0);
20583 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20584 updates_conv = CommitmentUpdate_clone(&updates_conv);
20585 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20586 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20587 uint32_t ret_ref = (uintptr_t)ret_copy;
20591 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
20592 LDKPublicKey node_id_ref;
20593 CHECK(node_id->arr_len == 33);
20594 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20595 LDKRevokeAndACK msg_conv;
20596 msg_conv.inner = (void*)(msg & (~1));
20597 msg_conv.is_owned = (msg & 1) || (msg == 0);
20598 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20599 msg_conv = RevokeAndACK_clone(&msg_conv);
20600 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20601 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20602 uint32_t ret_ref = (uintptr_t)ret_copy;
20606 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
20607 LDKPublicKey node_id_ref;
20608 CHECK(node_id->arr_len == 33);
20609 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20610 LDKClosingSigned msg_conv;
20611 msg_conv.inner = (void*)(msg & (~1));
20612 msg_conv.is_owned = (msg & 1) || (msg == 0);
20613 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20614 msg_conv = ClosingSigned_clone(&msg_conv);
20615 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20616 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20617 uint32_t ret_ref = (uintptr_t)ret_copy;
20621 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
20622 LDKPublicKey node_id_ref;
20623 CHECK(node_id->arr_len == 33);
20624 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20625 LDKShutdown msg_conv;
20626 msg_conv.inner = (void*)(msg & (~1));
20627 msg_conv.is_owned = (msg & 1) || (msg == 0);
20628 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20629 msg_conv = Shutdown_clone(&msg_conv);
20630 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20631 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20632 uint32_t ret_ref = (uintptr_t)ret_copy;
20636 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
20637 LDKPublicKey node_id_ref;
20638 CHECK(node_id->arr_len == 33);
20639 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20640 LDKChannelReestablish msg_conv;
20641 msg_conv.inner = (void*)(msg & (~1));
20642 msg_conv.is_owned = (msg & 1) || (msg == 0);
20643 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20644 msg_conv = ChannelReestablish_clone(&msg_conv);
20645 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20646 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20647 uint32_t ret_ref = (uintptr_t)ret_copy;
20651 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
20652 LDKChannelAnnouncement msg_conv;
20653 msg_conv.inner = (void*)(msg & (~1));
20654 msg_conv.is_owned = (msg & 1) || (msg == 0);
20655 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20656 msg_conv = ChannelAnnouncement_clone(&msg_conv);
20657 LDKChannelUpdate update_msg_conv;
20658 update_msg_conv.inner = (void*)(update_msg & (~1));
20659 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
20660 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20661 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20662 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20663 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20664 uint32_t ret_ref = (uintptr_t)ret_copy;
20668 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
20669 LDKNodeAnnouncement msg_conv;
20670 msg_conv.inner = (void*)(msg & (~1));
20671 msg_conv.is_owned = (msg & 1) || (msg == 0);
20672 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20673 msg_conv = NodeAnnouncement_clone(&msg_conv);
20674 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20675 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20676 uint32_t ret_ref = (uintptr_t)ret_copy;
20680 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
20681 LDKChannelUpdate msg_conv;
20682 msg_conv.inner = (void*)(msg & (~1));
20683 msg_conv.is_owned = (msg & 1) || (msg == 0);
20684 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20685 msg_conv = ChannelUpdate_clone(&msg_conv);
20686 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20687 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20688 uint32_t ret_ref = (uintptr_t)ret_copy;
20692 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
20693 LDKPublicKey node_id_ref;
20694 CHECK(node_id->arr_len == 33);
20695 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20696 LDKChannelUpdate msg_conv;
20697 msg_conv.inner = (void*)(msg & (~1));
20698 msg_conv.is_owned = (msg & 1) || (msg == 0);
20699 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20700 msg_conv = ChannelUpdate_clone(&msg_conv);
20701 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20702 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20703 uint32_t ret_ref = (uintptr_t)ret_copy;
20707 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
20708 LDKPublicKey node_id_ref;
20709 CHECK(node_id->arr_len == 33);
20710 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20711 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
20712 CHECK_ACCESS(action_ptr);
20713 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20714 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
20715 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20716 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20717 uint32_t ret_ref = (uintptr_t)ret_copy;
20721 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
20722 LDKPublicKey node_id_ref;
20723 CHECK(node_id->arr_len == 33);
20724 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20725 LDKQueryChannelRange msg_conv;
20726 msg_conv.inner = (void*)(msg & (~1));
20727 msg_conv.is_owned = (msg & 1) || (msg == 0);
20728 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20729 msg_conv = QueryChannelRange_clone(&msg_conv);
20730 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20731 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20732 uint32_t ret_ref = (uintptr_t)ret_copy;
20736 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
20737 LDKPublicKey node_id_ref;
20738 CHECK(node_id->arr_len == 33);
20739 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20740 LDKQueryShortChannelIds msg_conv;
20741 msg_conv.inner = (void*)(msg & (~1));
20742 msg_conv.is_owned = (msg & 1) || (msg == 0);
20743 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20744 msg_conv = QueryShortChannelIds_clone(&msg_conv);
20745 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20746 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20747 uint32_t ret_ref = (uintptr_t)ret_copy;
20751 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
20752 LDKPublicKey node_id_ref;
20753 CHECK(node_id->arr_len == 33);
20754 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20755 LDKReplyChannelRange msg_conv;
20756 msg_conv.inner = (void*)(msg & (~1));
20757 msg_conv.is_owned = (msg & 1) || (msg == 0);
20758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20759 msg_conv = ReplyChannelRange_clone(&msg_conv);
20760 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20761 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20762 uint32_t ret_ref = (uintptr_t)ret_copy;
20766 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint32_t msg) {
20767 LDKPublicKey node_id_ref;
20768 CHECK(node_id->arr_len == 33);
20769 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20770 LDKGossipTimestampFilter msg_conv;
20771 msg_conv.inner = (void*)(msg & (~1));
20772 msg_conv.is_owned = (msg & 1) || (msg == 0);
20773 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20774 msg_conv = GossipTimestampFilter_clone(&msg_conv);
20775 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20776 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
20777 uint32_t ret_ref = (uintptr_t)ret_copy;
20781 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
20782 if ((this_ptr & 1) != 0) return;
20783 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20784 CHECK_ACCESS(this_ptr_ptr);
20785 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20786 FREE((void*)this_ptr);
20787 MessageSendEventsProvider_free(this_ptr_conv);
20790 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
20791 if ((this_ptr & 1) != 0) return;
20792 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20793 CHECK_ACCESS(this_ptr_ptr);
20794 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20795 FREE((void*)this_ptr);
20796 EventsProvider_free(this_ptr_conv);
20799 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
20800 if ((this_ptr & 1) != 0) return;
20801 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20802 CHECK_ACCESS(this_ptr_ptr);
20803 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20804 FREE((void*)this_ptr);
20805 EventHandler_free(this_ptr_conv);
20808 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
20809 if ((this_ptr & 1) != 0) return;
20810 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20811 CHECK_ACCESS(this_ptr_ptr);
20812 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20813 FREE((void*)this_ptr);
20814 APIError_free(this_ptr_conv);
20817 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20818 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20819 *ret_copy = APIError_clone(arg);
20820 uint32_t ret_ref = (uintptr_t)ret_copy;
20823 uint32_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
20824 LDKAPIError* arg_conv = (LDKAPIError*)arg;
20825 uint32_t ret_conv = APIError_clone_ptr(arg_conv);
20829 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
20830 LDKAPIError* orig_conv = (LDKAPIError*)orig;
20831 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20832 *ret_copy = APIError_clone(orig_conv);
20833 uint32_t ret_ref = (uintptr_t)ret_copy;
20837 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20838 LDKStr err_conv = str_ref_to_owned_c(err);
20839 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20840 *ret_copy = APIError_apimisuse_error(err_conv);
20841 uint32_t ret_ref = (uintptr_t)ret_copy;
20845 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20846 LDKStr err_conv = str_ref_to_owned_c(err);
20847 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20848 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20849 uint32_t ret_ref = (uintptr_t)ret_copy;
20853 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20854 LDKStr err_conv = str_ref_to_owned_c(err);
20855 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20856 *ret_copy = APIError_route_error(err_conv);
20857 uint32_t ret_ref = (uintptr_t)ret_copy;
20861 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20862 LDKStr err_conv = str_ref_to_owned_c(err);
20863 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20864 *ret_copy = APIError_channel_unavailable(err_conv);
20865 uint32_t ret_ref = (uintptr_t)ret_copy;
20869 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20870 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20871 *ret_copy = APIError_monitor_update_failed();
20872 uint32_t ret_ref = (uintptr_t)ret_copy;
20876 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
20877 LDKShutdownScript script_conv;
20878 script_conv.inner = (void*)(script & (~1));
20879 script_conv.is_owned = (script & 1) || (script == 0);
20880 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20881 script_conv = ShutdownScript_clone(&script_conv);
20882 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20883 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20884 uint32_t ret_ref = (uintptr_t)ret_copy;
20888 void __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint32_t this_obj) {
20889 LDKBigSize this_obj_conv;
20890 this_obj_conv.inner = (void*)(this_obj & (~1));
20891 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20893 BigSize_free(this_obj_conv);
20896 int64_t __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint32_t this_ptr) {
20897 LDKBigSize this_ptr_conv;
20898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20899 this_ptr_conv.is_owned = false;
20900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20901 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
20905 void __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint32_t this_ptr, int64_t val) {
20906 LDKBigSize this_ptr_conv;
20907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20908 this_ptr_conv.is_owned = false;
20909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20910 BigSize_set_a(&this_ptr_conv, val);
20913 uint32_t __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
20914 LDKBigSize ret_var = BigSize_new(a_arg);
20915 uint32_t ret_ref = 0;
20916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20919 ret_ref = (uintptr_t)ret_var.inner;
20920 if (ret_var.is_owned) {
20926 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20927 LDKu8slice msg_ref;
20928 msg_ref.datalen = msg->arr_len;
20929 msg_ref.data = msg->elems;
20930 unsigned char sk_arr[32];
20931 CHECK(sk->arr_len == 32);
20932 memcpy(sk_arr, sk->elems, 32); FREE(sk);
20933 unsigned char (*sk_ref)[32] = &sk_arr;
20934 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20935 *ret_conv = sign(msg_ref, sk_ref);
20937 return (uint32_t)ret_conv;
20940 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20941 LDKu8slice msg_ref;
20942 msg_ref.datalen = msg->arr_len;
20943 msg_ref.data = msg->elems;
20944 LDKStr sig_conv = str_ref_to_owned_c(sig);
20945 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20946 *ret_conv = recover_pk(msg_ref, sig_conv);
20948 return (uint32_t)ret_conv;
20951 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20952 LDKu8slice msg_ref;
20953 msg_ref.datalen = msg->arr_len;
20954 msg_ref.data = msg->elems;
20955 LDKStr sig_conv = str_ref_to_owned_c(sig);
20956 LDKPublicKey pk_ref;
20957 CHECK(pk->arr_len == 33);
20958 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20959 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
20964 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20965 LDKu8slice hrp_bytes_ref;
20966 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20967 hrp_bytes_ref.data = hrp_bytes->elems;
20968 LDKCVec_u5Z data_without_signature_constr;
20969 data_without_signature_constr.datalen = data_without_signature->arr_len;
20970 if (data_without_signature_constr.datalen > 0)
20971 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20973 data_without_signature_constr.data = NULL;
20974 int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
20975 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20976 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20978 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20980 FREE(data_without_signature);
20981 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20982 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20983 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20984 CVec_u8Z_free(ret_var);
20989 void __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint32_t this_ptr) {
20990 if ((this_ptr & 1) != 0) return;
20991 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20992 CHECK_ACCESS(this_ptr_ptr);
20993 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
20994 FREE((void*)this_ptr);
20995 Persister_free(this_ptr_conv);
20998 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
20999 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
21000 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
21004 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
21005 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
21009 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
21010 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
21014 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
21015 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
21019 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
21020 uint32_t ret_conv = LDKLevel_to_js(Level_info());
21024 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
21025 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
21029 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
21030 uint32_t ret_conv = LDKLevel_to_js(Level_error());
21034 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
21035 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
21036 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
21037 jboolean ret_conv = Level_eq(a_conv, b_conv);
21041 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
21042 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
21043 int64_t ret_conv = Level_hash(o_conv);
21047 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
21048 uint32_t ret_conv = LDKLevel_to_js(Level_max());
21052 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
21053 LDKRecord this_obj_conv;
21054 this_obj_conv.inner = (void*)(this_obj & (~1));
21055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21057 Record_free(this_obj_conv);
21060 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
21061 LDKRecord this_ptr_conv;
21062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21063 this_ptr_conv.is_owned = false;
21064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21065 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
21069 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
21070 LDKRecord this_ptr_conv;
21071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21072 this_ptr_conv.is_owned = false;
21073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21074 LDKLevel val_conv = LDKLevel_from_js(val);
21075 Record_set_level(&this_ptr_conv, val_conv);
21078 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
21079 LDKRecord this_ptr_conv;
21080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21081 this_ptr_conv.is_owned = false;
21082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21083 LDKStr ret_str = Record_get_args(&this_ptr_conv);
21084 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21089 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
21090 LDKRecord this_ptr_conv;
21091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21092 this_ptr_conv.is_owned = false;
21093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21094 LDKStr val_conv = str_ref_to_owned_c(val);
21095 Record_set_args(&this_ptr_conv, val_conv);
21098 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
21099 LDKRecord this_ptr_conv;
21100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21101 this_ptr_conv.is_owned = false;
21102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21103 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
21104 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21109 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
21110 LDKRecord this_ptr_conv;
21111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21112 this_ptr_conv.is_owned = false;
21113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21114 LDKStr val_conv = str_ref_to_owned_c(val);
21115 Record_set_module_path(&this_ptr_conv, val_conv);
21118 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
21119 LDKRecord this_ptr_conv;
21120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21121 this_ptr_conv.is_owned = false;
21122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21123 LDKStr ret_str = Record_get_file(&this_ptr_conv);
21124 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21129 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
21130 LDKRecord this_ptr_conv;
21131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21132 this_ptr_conv.is_owned = false;
21133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21134 LDKStr val_conv = str_ref_to_owned_c(val);
21135 Record_set_file(&this_ptr_conv, val_conv);
21138 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
21139 LDKRecord this_ptr_conv;
21140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21141 this_ptr_conv.is_owned = false;
21142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21143 int32_t ret_conv = Record_get_line(&this_ptr_conv);
21147 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
21148 LDKRecord this_ptr_conv;
21149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21150 this_ptr_conv.is_owned = false;
21151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21152 Record_set_line(&this_ptr_conv, val);
21155 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
21156 LDKRecord ret_var = Record_clone(arg);
21157 uint32_t ret_ref = 0;
21158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21161 ret_ref = (uintptr_t)ret_var.inner;
21162 if (ret_var.is_owned) {
21167 uint32_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
21168 LDKRecord arg_conv;
21169 arg_conv.inner = (void*)(arg & (~1));
21170 arg_conv.is_owned = false;
21171 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21172 uint32_t ret_conv = Record_clone_ptr(&arg_conv);
21176 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
21177 LDKRecord orig_conv;
21178 orig_conv.inner = (void*)(orig & (~1));
21179 orig_conv.is_owned = false;
21180 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21181 LDKRecord ret_var = Record_clone(&orig_conv);
21182 uint32_t ret_ref = 0;
21183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21186 ret_ref = (uintptr_t)ret_var.inner;
21187 if (ret_var.is_owned) {
21193 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
21194 if ((this_ptr & 1) != 0) return;
21195 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21196 CHECK_ACCESS(this_ptr_ptr);
21197 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
21198 FREE((void*)this_ptr);
21199 Logger_free(this_ptr_conv);
21202 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
21203 LDKChannelHandshakeConfig this_obj_conv;
21204 this_obj_conv.inner = (void*)(this_obj & (~1));
21205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21207 ChannelHandshakeConfig_free(this_obj_conv);
21210 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
21211 LDKChannelHandshakeConfig this_ptr_conv;
21212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21213 this_ptr_conv.is_owned = false;
21214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21215 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
21219 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
21220 LDKChannelHandshakeConfig 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 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
21227 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
21228 LDKChannelHandshakeConfig this_ptr_conv;
21229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21230 this_ptr_conv.is_owned = false;
21231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21232 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
21236 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) {
21237 LDKChannelHandshakeConfig this_ptr_conv;
21238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21239 this_ptr_conv.is_owned = false;
21240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21241 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
21244 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
21245 LDKChannelHandshakeConfig this_ptr_conv;
21246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21247 this_ptr_conv.is_owned = false;
21248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21249 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
21253 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) {
21254 LDKChannelHandshakeConfig this_ptr_conv;
21255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21256 this_ptr_conv.is_owned = false;
21257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21258 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
21261 int8_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel"))) TS_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(uint32_t this_ptr) {
21262 LDKChannelHandshakeConfig this_ptr_conv;
21263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21264 this_ptr_conv.is_owned = false;
21265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21266 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
21270 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel"))) TS_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(uint32_t this_ptr, int8_t val) {
21271 LDKChannelHandshakeConfig this_ptr_conv;
21272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21273 this_ptr_conv.is_owned = false;
21274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21275 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
21278 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint32_t this_ptr) {
21279 LDKChannelHandshakeConfig this_ptr_conv;
21280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21281 this_ptr_conv.is_owned = false;
21282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21283 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
21287 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint32_t this_ptr, jboolean val) {
21288 LDKChannelHandshakeConfig this_ptr_conv;
21289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21290 this_ptr_conv.is_owned = false;
21291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21292 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
21295 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, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg) {
21296 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg);
21297 uint32_t ret_ref = 0;
21298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21301 ret_ref = (uintptr_t)ret_var.inner;
21302 if (ret_var.is_owned) {
21308 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
21309 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
21310 uint32_t ret_ref = 0;
21311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21314 ret_ref = (uintptr_t)ret_var.inner;
21315 if (ret_var.is_owned) {
21320 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
21321 LDKChannelHandshakeConfig arg_conv;
21322 arg_conv.inner = (void*)(arg & (~1));
21323 arg_conv.is_owned = false;
21324 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21325 uint32_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
21329 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
21330 LDKChannelHandshakeConfig orig_conv;
21331 orig_conv.inner = (void*)(orig & (~1));
21332 orig_conv.is_owned = false;
21333 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21334 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
21335 uint32_t ret_ref = 0;
21336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21339 ret_ref = (uintptr_t)ret_var.inner;
21340 if (ret_var.is_owned) {
21346 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
21347 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
21348 uint32_t ret_ref = 0;
21349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21352 ret_ref = (uintptr_t)ret_var.inner;
21353 if (ret_var.is_owned) {
21359 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
21360 LDKChannelHandshakeLimits this_obj_conv;
21361 this_obj_conv.inner = (void*)(this_obj & (~1));
21362 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21364 ChannelHandshakeLimits_free(this_obj_conv);
21367 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
21368 LDKChannelHandshakeLimits this_ptr_conv;
21369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21370 this_ptr_conv.is_owned = false;
21371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21372 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
21376 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
21377 LDKChannelHandshakeLimits this_ptr_conv;
21378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21379 this_ptr_conv.is_owned = false;
21380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21381 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21384 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint32_t this_ptr) {
21385 LDKChannelHandshakeLimits this_ptr_conv;
21386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21387 this_ptr_conv.is_owned = false;
21388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21389 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
21393 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint32_t this_ptr, int64_t val) {
21394 LDKChannelHandshakeLimits this_ptr_conv;
21395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21396 this_ptr_conv.is_owned = false;
21397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21398 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
21401 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
21402 LDKChannelHandshakeLimits this_ptr_conv;
21403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21404 this_ptr_conv.is_owned = false;
21405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21406 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21410 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) {
21411 LDKChannelHandshakeLimits this_ptr_conv;
21412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21413 this_ptr_conv.is_owned = false;
21414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21415 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21418 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) {
21419 LDKChannelHandshakeLimits this_ptr_conv;
21420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21421 this_ptr_conv.is_owned = false;
21422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21423 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21427 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) {
21428 LDKChannelHandshakeLimits this_ptr_conv;
21429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21430 this_ptr_conv.is_owned = false;
21431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21432 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21435 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
21436 LDKChannelHandshakeLimits this_ptr_conv;
21437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21438 this_ptr_conv.is_owned = false;
21439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21440 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21444 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) {
21445 LDKChannelHandshakeLimits this_ptr_conv;
21446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21447 this_ptr_conv.is_owned = false;
21448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21449 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21452 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
21453 LDKChannelHandshakeLimits this_ptr_conv;
21454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21455 this_ptr_conv.is_owned = false;
21456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21457 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21461 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) {
21462 LDKChannelHandshakeLimits this_ptr_conv;
21463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21464 this_ptr_conv.is_owned = false;
21465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21466 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21469 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
21470 LDKChannelHandshakeLimits this_ptr_conv;
21471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21472 this_ptr_conv.is_owned = false;
21473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21474 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21478 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
21479 LDKChannelHandshakeLimits this_ptr_conv;
21480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21481 this_ptr_conv.is_owned = false;
21482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21483 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21486 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint32_t this_ptr) {
21487 LDKChannelHandshakeLimits this_ptr_conv;
21488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21489 this_ptr_conv.is_owned = false;
21490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21491 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
21495 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint32_t this_ptr, jboolean val) {
21496 LDKChannelHandshakeLimits this_ptr_conv;
21497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21498 this_ptr_conv.is_owned = false;
21499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21500 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
21503 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
21504 LDKChannelHandshakeLimits this_ptr_conv;
21505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21506 this_ptr_conv.is_owned = false;
21507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21508 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21512 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
21513 LDKChannelHandshakeLimits this_ptr_conv;
21514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21515 this_ptr_conv.is_owned = false;
21516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21517 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21520 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
21521 LDKChannelHandshakeLimits this_ptr_conv;
21522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21523 this_ptr_conv.is_owned = false;
21524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21525 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21529 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) {
21530 LDKChannelHandshakeLimits this_ptr_conv;
21531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21532 this_ptr_conv.is_owned = false;
21533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21534 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21537 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_new"))) TS_ChannelHandshakeLimits_new(int64_t min_funding_satoshis_arg, int64_t max_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 trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
21538 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_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, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
21539 uint32_t ret_ref = 0;
21540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21543 ret_ref = (uintptr_t)ret_var.inner;
21544 if (ret_var.is_owned) {
21550 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21551 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21552 uint32_t ret_ref = 0;
21553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21556 ret_ref = (uintptr_t)ret_var.inner;
21557 if (ret_var.is_owned) {
21562 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
21563 LDKChannelHandshakeLimits arg_conv;
21564 arg_conv.inner = (void*)(arg & (~1));
21565 arg_conv.is_owned = false;
21566 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21567 uint32_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21571 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
21572 LDKChannelHandshakeLimits orig_conv;
21573 orig_conv.inner = (void*)(orig & (~1));
21574 orig_conv.is_owned = false;
21575 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21576 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21577 uint32_t ret_ref = 0;
21578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21581 ret_ref = (uintptr_t)ret_var.inner;
21582 if (ret_var.is_owned) {
21588 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
21589 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21590 uint32_t ret_ref = 0;
21591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21594 ret_ref = (uintptr_t)ret_var.inner;
21595 if (ret_var.is_owned) {
21601 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
21602 LDKChannelConfig this_obj_conv;
21603 this_obj_conv.inner = (void*)(this_obj & (~1));
21604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21606 ChannelConfig_free(this_obj_conv);
21609 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
21610 LDKChannelConfig this_ptr_conv;
21611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21612 this_ptr_conv.is_owned = false;
21613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21614 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21618 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) {
21619 LDKChannelConfig this_ptr_conv;
21620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21621 this_ptr_conv.is_owned = false;
21622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21623 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21626 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
21627 LDKChannelConfig this_ptr_conv;
21628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21629 this_ptr_conv.is_owned = false;
21630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21631 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21635 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) {
21636 LDKChannelConfig this_ptr_conv;
21637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21638 this_ptr_conv.is_owned = false;
21639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21640 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21643 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
21644 LDKChannelConfig this_ptr_conv;
21645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21646 this_ptr_conv.is_owned = false;
21647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21648 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21652 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21653 LDKChannelConfig this_ptr_conv;
21654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21655 this_ptr_conv.is_owned = false;
21656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21657 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21660 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
21661 LDKChannelConfig this_ptr_conv;
21662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21663 this_ptr_conv.is_owned = false;
21664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21665 jboolean ret_conv = ChannelConfig_get_announced_channel(&this_ptr_conv);
21669 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
21670 LDKChannelConfig this_ptr_conv;
21671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21672 this_ptr_conv.is_owned = false;
21673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21674 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
21677 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
21678 LDKChannelConfig this_ptr_conv;
21679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21680 this_ptr_conv.is_owned = false;
21681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21682 jboolean ret_conv = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
21686 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
21687 LDKChannelConfig this_ptr_conv;
21688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21689 this_ptr_conv.is_owned = false;
21690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21691 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
21694 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) {
21695 LDKChannelConfig this_ptr_conv;
21696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21697 this_ptr_conv.is_owned = false;
21698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21699 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21703 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) {
21704 LDKChannelConfig this_ptr_conv;
21705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21706 this_ptr_conv.is_owned = false;
21707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21708 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21711 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) {
21712 LDKChannelConfig this_ptr_conv;
21713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21714 this_ptr_conv.is_owned = false;
21715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21716 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21720 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) {
21721 LDKChannelConfig this_ptr_conv;
21722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21723 this_ptr_conv.is_owned = false;
21724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21725 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21728 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) {
21729 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);
21730 uint32_t ret_ref = 0;
21731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21734 ret_ref = (uintptr_t)ret_var.inner;
21735 if (ret_var.is_owned) {
21741 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21742 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21743 uint32_t ret_ref = 0;
21744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21747 ret_ref = (uintptr_t)ret_var.inner;
21748 if (ret_var.is_owned) {
21753 uint32_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
21754 LDKChannelConfig arg_conv;
21755 arg_conv.inner = (void*)(arg & (~1));
21756 arg_conv.is_owned = false;
21757 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21758 uint32_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
21762 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
21763 LDKChannelConfig orig_conv;
21764 orig_conv.inner = (void*)(orig & (~1));
21765 orig_conv.is_owned = false;
21766 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21767 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21768 uint32_t ret_ref = 0;
21769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21772 ret_ref = (uintptr_t)ret_var.inner;
21773 if (ret_var.is_owned) {
21779 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
21780 LDKChannelConfig ret_var = ChannelConfig_default();
21781 uint32_t ret_ref = 0;
21782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21785 ret_ref = (uintptr_t)ret_var.inner;
21786 if (ret_var.is_owned) {
21792 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
21793 LDKChannelConfig obj_conv;
21794 obj_conv.inner = (void*)(obj & (~1));
21795 obj_conv.is_owned = false;
21796 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21797 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
21798 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21799 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21800 CVec_u8Z_free(ret_var);
21804 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
21805 LDKu8slice ser_ref;
21806 ser_ref.datalen = ser->arr_len;
21807 ser_ref.data = ser->elems;
21808 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21809 *ret_conv = ChannelConfig_read(ser_ref);
21811 return (uint32_t)ret_conv;
21814 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
21815 LDKUserConfig this_obj_conv;
21816 this_obj_conv.inner = (void*)(this_obj & (~1));
21817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21819 UserConfig_free(this_obj_conv);
21822 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
21823 LDKUserConfig this_ptr_conv;
21824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21825 this_ptr_conv.is_owned = false;
21826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21827 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
21828 uint32_t ret_ref = 0;
21829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21832 ret_ref = (uintptr_t)ret_var.inner;
21833 if (ret_var.is_owned) {
21839 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
21840 LDKUserConfig this_ptr_conv;
21841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21842 this_ptr_conv.is_owned = false;
21843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21844 LDKChannelHandshakeConfig val_conv;
21845 val_conv.inner = (void*)(val & (~1));
21846 val_conv.is_owned = (val & 1) || (val == 0);
21847 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21848 val_conv = ChannelHandshakeConfig_clone(&val_conv);
21849 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
21852 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
21853 LDKUserConfig this_ptr_conv;
21854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21855 this_ptr_conv.is_owned = false;
21856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21857 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
21858 uint32_t ret_ref = 0;
21859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21862 ret_ref = (uintptr_t)ret_var.inner;
21863 if (ret_var.is_owned) {
21869 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) {
21870 LDKUserConfig this_ptr_conv;
21871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21872 this_ptr_conv.is_owned = false;
21873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21874 LDKChannelHandshakeLimits val_conv;
21875 val_conv.inner = (void*)(val & (~1));
21876 val_conv.is_owned = (val & 1) || (val == 0);
21877 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21878 val_conv = ChannelHandshakeLimits_clone(&val_conv);
21879 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
21882 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
21883 LDKUserConfig this_ptr_conv;
21884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21885 this_ptr_conv.is_owned = false;
21886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21887 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
21888 uint32_t ret_ref = 0;
21889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21892 ret_ref = (uintptr_t)ret_var.inner;
21893 if (ret_var.is_owned) {
21899 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
21900 LDKUserConfig this_ptr_conv;
21901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21902 this_ptr_conv.is_owned = false;
21903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21904 LDKChannelConfig val_conv;
21905 val_conv.inner = (void*)(val & (~1));
21906 val_conv.is_owned = (val & 1) || (val == 0);
21907 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21908 val_conv = ChannelConfig_clone(&val_conv);
21909 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
21912 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
21913 LDKUserConfig this_ptr_conv;
21914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21915 this_ptr_conv.is_owned = false;
21916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21917 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21921 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) {
21922 LDKUserConfig this_ptr_conv;
21923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21924 this_ptr_conv.is_owned = false;
21925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21926 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21929 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
21930 LDKUserConfig this_ptr_conv;
21931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21932 this_ptr_conv.is_owned = false;
21933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21934 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21938 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21939 LDKUserConfig this_ptr_conv;
21940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21941 this_ptr_conv.is_owned = false;
21942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21943 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21946 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
21947 LDKUserConfig this_ptr_conv;
21948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21949 this_ptr_conv.is_owned = false;
21950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21951 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21955 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21956 LDKUserConfig this_ptr_conv;
21957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21958 this_ptr_conv.is_owned = false;
21959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21960 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21963 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) {
21964 LDKChannelHandshakeConfig own_channel_config_arg_conv;
21965 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
21966 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
21967 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
21968 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
21969 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
21970 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
21971 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
21972 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
21973 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
21974 LDKChannelConfig channel_options_arg_conv;
21975 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
21976 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
21977 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
21978 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
21979 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);
21980 uint32_t ret_ref = 0;
21981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21984 ret_ref = (uintptr_t)ret_var.inner;
21985 if (ret_var.is_owned) {
21991 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21992 LDKUserConfig ret_var = UserConfig_clone(arg);
21993 uint32_t ret_ref = 0;
21994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21997 ret_ref = (uintptr_t)ret_var.inner;
21998 if (ret_var.is_owned) {
22003 uint32_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
22004 LDKUserConfig arg_conv;
22005 arg_conv.inner = (void*)(arg & (~1));
22006 arg_conv.is_owned = false;
22007 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22008 uint32_t ret_conv = UserConfig_clone_ptr(&arg_conv);
22012 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
22013 LDKUserConfig orig_conv;
22014 orig_conv.inner = (void*)(orig & (~1));
22015 orig_conv.is_owned = false;
22016 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22017 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
22018 uint32_t ret_ref = 0;
22019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22022 ret_ref = (uintptr_t)ret_var.inner;
22023 if (ret_var.is_owned) {
22029 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
22030 LDKUserConfig ret_var = UserConfig_default();
22031 uint32_t ret_ref = 0;
22032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22035 ret_ref = (uintptr_t)ret_var.inner;
22036 if (ret_var.is_owned) {
22042 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
22043 LDKBestBlock this_obj_conv;
22044 this_obj_conv.inner = (void*)(this_obj & (~1));
22045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22047 BestBlock_free(this_obj_conv);
22050 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
22051 LDKBestBlock ret_var = BestBlock_clone(arg);
22052 uint32_t ret_ref = 0;
22053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22056 ret_ref = (uintptr_t)ret_var.inner;
22057 if (ret_var.is_owned) {
22062 uint32_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
22063 LDKBestBlock arg_conv;
22064 arg_conv.inner = (void*)(arg & (~1));
22065 arg_conv.is_owned = false;
22066 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22067 uint32_t ret_conv = BestBlock_clone_ptr(&arg_conv);
22071 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
22072 LDKBestBlock orig_conv;
22073 orig_conv.inner = (void*)(orig & (~1));
22074 orig_conv.is_owned = false;
22075 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22076 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
22077 uint32_t ret_ref = 0;
22078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22081 ret_ref = (uintptr_t)ret_var.inner;
22082 if (ret_var.is_owned) {
22088 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
22089 LDKNetwork network_conv = LDKNetwork_from_js(network);
22090 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
22091 uint32_t ret_ref = 0;
22092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22095 ret_ref = (uintptr_t)ret_var.inner;
22096 if (ret_var.is_owned) {
22102 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
22103 LDKThirtyTwoBytes block_hash_ref;
22104 CHECK(block_hash->arr_len == 32);
22105 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
22106 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
22107 uint32_t ret_ref = 0;
22108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22111 ret_ref = (uintptr_t)ret_var.inner;
22112 if (ret_var.is_owned) {
22118 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
22119 LDKBestBlock this_arg_conv;
22120 this_arg_conv.inner = (void*)(this_arg & (~1));
22121 this_arg_conv.is_owned = false;
22122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22123 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22124 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
22128 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
22129 LDKBestBlock this_arg_conv;
22130 this_arg_conv.inner = (void*)(this_arg & (~1));
22131 this_arg_conv.is_owned = false;
22132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22133 int32_t ret_conv = BestBlock_height(&this_arg_conv);
22137 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
22138 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
22139 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
22143 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
22144 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
22148 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
22149 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
22153 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
22154 if ((this_ptr & 1) != 0) return;
22155 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22156 CHECK_ACCESS(this_ptr_ptr);
22157 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
22158 FREE((void*)this_ptr);
22159 Access_free(this_ptr_conv);
22162 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
22163 if ((this_ptr & 1) != 0) return;
22164 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22165 CHECK_ACCESS(this_ptr_ptr);
22166 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
22167 FREE((void*)this_ptr);
22168 Listen_free(this_ptr_conv);
22171 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
22172 if ((this_ptr & 1) != 0) return;
22173 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22174 CHECK_ACCESS(this_ptr_ptr);
22175 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
22176 FREE((void*)this_ptr);
22177 Confirm_free(this_ptr_conv);
22180 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
22181 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
22182 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
22186 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
22187 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
22191 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
22192 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
22196 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
22197 if ((this_ptr & 1) != 0) return;
22198 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22199 CHECK_ACCESS(this_ptr_ptr);
22200 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
22201 FREE((void*)this_ptr);
22202 Watch_free(this_ptr_conv);
22205 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
22206 if ((this_ptr & 1) != 0) return;
22207 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22208 CHECK_ACCESS(this_ptr_ptr);
22209 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
22210 FREE((void*)this_ptr);
22211 Filter_free(this_ptr_conv);
22214 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
22215 LDKWatchedOutput this_obj_conv;
22216 this_obj_conv.inner = (void*)(this_obj & (~1));
22217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22219 WatchedOutput_free(this_obj_conv);
22222 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
22223 LDKWatchedOutput this_ptr_conv;
22224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22225 this_ptr_conv.is_owned = false;
22226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22227 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22228 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
22232 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
22233 LDKWatchedOutput this_ptr_conv;
22234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22235 this_ptr_conv.is_owned = false;
22236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22237 LDKThirtyTwoBytes val_ref;
22238 CHECK(val->arr_len == 32);
22239 memcpy(val_ref.data, val->elems, 32); FREE(val);
22240 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
22243 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
22244 LDKWatchedOutput this_ptr_conv;
22245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22246 this_ptr_conv.is_owned = false;
22247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22248 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
22249 uint32_t ret_ref = 0;
22250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22253 ret_ref = (uintptr_t)ret_var.inner;
22254 if (ret_var.is_owned) {
22260 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
22261 LDKWatchedOutput this_ptr_conv;
22262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22263 this_ptr_conv.is_owned = false;
22264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22265 LDKOutPoint val_conv;
22266 val_conv.inner = (void*)(val & (~1));
22267 val_conv.is_owned = (val & 1) || (val == 0);
22268 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22269 val_conv = OutPoint_clone(&val_conv);
22270 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
22273 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
22274 LDKWatchedOutput this_ptr_conv;
22275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22276 this_ptr_conv.is_owned = false;
22277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22278 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
22279 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22280 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22284 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
22285 LDKWatchedOutput this_ptr_conv;
22286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22287 this_ptr_conv.is_owned = false;
22288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22289 LDKCVec_u8Z val_ref;
22290 val_ref.datalen = val->arr_len;
22291 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22292 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
22293 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
22296 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) {
22297 LDKThirtyTwoBytes block_hash_arg_ref;
22298 CHECK(block_hash_arg->arr_len == 32);
22299 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
22300 LDKOutPoint outpoint_arg_conv;
22301 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22302 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22303 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22304 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22305 LDKCVec_u8Z script_pubkey_arg_ref;
22306 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
22307 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22308 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
22309 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
22310 uint32_t ret_ref = 0;
22311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22314 ret_ref = (uintptr_t)ret_var.inner;
22315 if (ret_var.is_owned) {
22321 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
22322 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
22323 uint32_t ret_ref = 0;
22324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22327 ret_ref = (uintptr_t)ret_var.inner;
22328 if (ret_var.is_owned) {
22333 uint32_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
22334 LDKWatchedOutput arg_conv;
22335 arg_conv.inner = (void*)(arg & (~1));
22336 arg_conv.is_owned = false;
22337 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22338 uint32_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
22342 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
22343 LDKWatchedOutput orig_conv;
22344 orig_conv.inner = (void*)(orig & (~1));
22345 orig_conv.is_owned = false;
22346 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22347 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
22348 uint32_t ret_ref = 0;
22349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22352 ret_ref = (uintptr_t)ret_var.inner;
22353 if (ret_var.is_owned) {
22359 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
22360 LDKWatchedOutput o_conv;
22361 o_conv.inner = (void*)(o & (~1));
22362 o_conv.is_owned = false;
22363 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22364 int64_t ret_conv = WatchedOutput_hash(&o_conv);
22368 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
22369 if ((this_ptr & 1) != 0) return;
22370 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22371 CHECK_ACCESS(this_ptr_ptr);
22372 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
22373 FREE((void*)this_ptr);
22374 BroadcasterInterface_free(this_ptr_conv);
22377 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
22378 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
22379 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
22383 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
22384 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
22388 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
22389 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
22393 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
22394 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
22398 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
22399 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
22400 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
22401 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
22405 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
22406 if ((this_ptr & 1) != 0) return;
22407 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22408 CHECK_ACCESS(this_ptr_ptr);
22409 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
22410 FREE((void*)this_ptr);
22411 FeeEstimator_free(this_ptr_conv);
22414 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
22415 LDKMonitorUpdateId this_obj_conv;
22416 this_obj_conv.inner = (void*)(this_obj & (~1));
22417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22419 MonitorUpdateId_free(this_obj_conv);
22422 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
22423 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
22424 uint32_t ret_ref = 0;
22425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22428 ret_ref = (uintptr_t)ret_var.inner;
22429 if (ret_var.is_owned) {
22434 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
22435 LDKMonitorUpdateId arg_conv;
22436 arg_conv.inner = (void*)(arg & (~1));
22437 arg_conv.is_owned = false;
22438 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22439 uint32_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
22443 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
22444 LDKMonitorUpdateId orig_conv;
22445 orig_conv.inner = (void*)(orig & (~1));
22446 orig_conv.is_owned = false;
22447 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22448 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
22449 uint32_t ret_ref = 0;
22450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22453 ret_ref = (uintptr_t)ret_var.inner;
22454 if (ret_var.is_owned) {
22460 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
22461 LDKMonitorUpdateId o_conv;
22462 o_conv.inner = (void*)(o & (~1));
22463 o_conv.is_owned = false;
22464 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22465 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
22469 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
22470 LDKMonitorUpdateId a_conv;
22471 a_conv.inner = (void*)(a & (~1));
22472 a_conv.is_owned = false;
22473 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22474 LDKMonitorUpdateId b_conv;
22475 b_conv.inner = (void*)(b & (~1));
22476 b_conv.is_owned = false;
22477 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22478 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
22482 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
22483 if ((this_ptr & 1) != 0) return;
22484 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22485 CHECK_ACCESS(this_ptr_ptr);
22486 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22487 FREE((void*)this_ptr);
22488 Persist_free(this_ptr_conv);
22491 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
22492 LDKLockedChannelMonitor this_obj_conv;
22493 this_obj_conv.inner = (void*)(this_obj & (~1));
22494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22496 LockedChannelMonitor_free(this_obj_conv);
22499 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
22500 LDKChainMonitor this_obj_conv;
22501 this_obj_conv.inner = (void*)(this_obj & (~1));
22502 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22504 ChainMonitor_free(this_obj_conv);
22507 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) {
22508 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
22509 CHECK_ACCESS(chain_source_ptr);
22510 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22511 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
22512 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22513 // Manually implement clone for Java trait instances
22514 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22515 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22516 LDKFilter_JCalls_cloned(&chain_source_conv.some);
22519 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22520 CHECK_ACCESS(broadcaster_ptr);
22521 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22522 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22523 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22524 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22526 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22527 CHECK_ACCESS(logger_ptr);
22528 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22529 if (logger_conv.free == LDKLogger_JCalls_free) {
22530 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22531 LDKLogger_JCalls_cloned(&logger_conv);
22533 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
22534 CHECK_ACCESS(feeest_ptr);
22535 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22536 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22537 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22538 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22540 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
22541 CHECK_ACCESS(persister_ptr);
22542 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22543 if (persister_conv.free == LDKPersist_JCalls_free) {
22544 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22545 LDKPersist_JCalls_cloned(&persister_conv);
22547 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22548 uint32_t ret_ref = 0;
22549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22552 ret_ref = (uintptr_t)ret_var.inner;
22553 if (ret_var.is_owned) {
22559 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
22560 LDKChainMonitor this_arg_conv;
22561 this_arg_conv.inner = (void*)(this_arg & (~1));
22562 this_arg_conv.is_owned = false;
22563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22564 LDKCVec_ChannelDetailsZ ignored_channels_constr;
22565 ignored_channels_constr.datalen = ignored_channels->arr_len;
22566 if (ignored_channels_constr.datalen > 0)
22567 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22569 ignored_channels_constr.data = NULL;
22570 uint32_t* ignored_channels_vals = ignored_channels->elems;
22571 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22572 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
22573 LDKChannelDetails ignored_channels_conv_16_conv;
22574 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
22575 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
22576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22577 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22578 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22580 FREE(ignored_channels);
22581 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22582 uint32_tArray ret_arr = NULL;
22583 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22584 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22585 for (size_t j = 0; j < ret_var.datalen; j++) {
22586 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22587 *ret_conv_9_copy = ret_var.data[j];
22588 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
22589 ret_arr_ptr[j] = ret_conv_9_ref;
22592 FREE(ret_var.data);
22596 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
22597 LDKChainMonitor this_arg_conv;
22598 this_arg_conv.inner = (void*)(this_arg & (~1));
22599 this_arg_conv.is_owned = false;
22600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22601 LDKOutPoint funding_txo_conv;
22602 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22603 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22604 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22605 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22606 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22607 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22608 return (uint32_t)ret_conv;
22611 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
22612 LDKChainMonitor this_arg_conv;
22613 this_arg_conv.inner = (void*)(this_arg & (~1));
22614 this_arg_conv.is_owned = false;
22615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22616 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22617 uint32_tArray ret_arr = NULL;
22618 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22619 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22620 for (size_t k = 0; k < ret_var.datalen; k++) {
22621 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22622 uint32_t ret_conv_10_ref = 0;
22623 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22624 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22626 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
22627 if (ret_conv_10_var.is_owned) {
22628 ret_conv_10_ref |= 1;
22630 ret_arr_ptr[k] = ret_conv_10_ref;
22633 FREE(ret_var.data);
22637 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) {
22638 LDKChainMonitor this_arg_conv;
22639 this_arg_conv.inner = (void*)(this_arg & (~1));
22640 this_arg_conv.is_owned = false;
22641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22642 LDKOutPoint funding_txo_conv;
22643 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22644 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22645 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22646 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22647 LDKMonitorUpdateId completed_update_id_conv;
22648 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
22649 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
22650 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22651 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22652 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22653 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22654 return (uint32_t)ret_conv;
22657 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
22658 LDKChainMonitor this_arg_conv;
22659 this_arg_conv.inner = (void*)(this_arg & (~1));
22660 this_arg_conv.is_owned = false;
22661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22662 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22663 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22664 return (uint32_t)ret_ret;
22667 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
22668 LDKChainMonitor this_arg_conv;
22669 this_arg_conv.inner = (void*)(this_arg & (~1));
22670 this_arg_conv.is_owned = false;
22671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22672 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22673 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22674 return (uint32_t)ret_ret;
22677 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
22678 LDKChainMonitor this_arg_conv;
22679 this_arg_conv.inner = (void*)(this_arg & (~1));
22680 this_arg_conv.is_owned = false;
22681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22682 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22683 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22684 return (uint32_t)ret_ret;
22687 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
22688 LDKChainMonitor this_arg_conv;
22689 this_arg_conv.inner = (void*)(this_arg & (~1));
22690 this_arg_conv.is_owned = false;
22691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22692 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22693 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22694 return (uint32_t)ret_ret;
22697 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
22698 LDKChannelMonitorUpdate this_obj_conv;
22699 this_obj_conv.inner = (void*)(this_obj & (~1));
22700 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22702 ChannelMonitorUpdate_free(this_obj_conv);
22705 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
22706 LDKChannelMonitorUpdate this_ptr_conv;
22707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22708 this_ptr_conv.is_owned = false;
22709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22710 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22714 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
22715 LDKChannelMonitorUpdate this_ptr_conv;
22716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22717 this_ptr_conv.is_owned = false;
22718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22719 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22722 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22723 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22724 uint32_t ret_ref = 0;
22725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22728 ret_ref = (uintptr_t)ret_var.inner;
22729 if (ret_var.is_owned) {
22734 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
22735 LDKChannelMonitorUpdate arg_conv;
22736 arg_conv.inner = (void*)(arg & (~1));
22737 arg_conv.is_owned = false;
22738 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22739 uint32_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22743 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
22744 LDKChannelMonitorUpdate orig_conv;
22745 orig_conv.inner = (void*)(orig & (~1));
22746 orig_conv.is_owned = false;
22747 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22748 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22749 uint32_t ret_ref = 0;
22750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22753 ret_ref = (uintptr_t)ret_var.inner;
22754 if (ret_var.is_owned) {
22760 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
22761 LDKChannelMonitorUpdate obj_conv;
22762 obj_conv.inner = (void*)(obj & (~1));
22763 obj_conv.is_owned = false;
22764 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22765 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22766 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22767 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22768 CVec_u8Z_free(ret_var);
22772 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
22773 LDKu8slice ser_ref;
22774 ser_ref.datalen = ser->arr_len;
22775 ser_ref.data = ser->elems;
22776 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22777 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22779 return (uint32_t)ret_conv;
22782 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
22783 if ((this_ptr & 1) != 0) return;
22784 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22785 CHECK_ACCESS(this_ptr_ptr);
22786 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22787 FREE((void*)this_ptr);
22788 MonitorEvent_free(this_ptr_conv);
22791 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22792 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22793 *ret_copy = MonitorEvent_clone(arg);
22794 uint32_t ret_ref = (uintptr_t)ret_copy;
22797 uint32_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
22798 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
22799 uint32_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
22803 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
22804 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
22805 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22806 *ret_copy = MonitorEvent_clone(orig_conv);
22807 uint32_t ret_ref = (uintptr_t)ret_copy;
22811 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
22812 LDKHTLCUpdate a_conv;
22813 a_conv.inner = (void*)(a & (~1));
22814 a_conv.is_owned = (a & 1) || (a == 0);
22815 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22816 a_conv = HTLCUpdate_clone(&a_conv);
22817 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22818 *ret_copy = MonitorEvent_htlcevent(a_conv);
22819 uint32_t ret_ref = (uintptr_t)ret_copy;
22823 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
22824 LDKOutPoint a_conv;
22825 a_conv.inner = (void*)(a & (~1));
22826 a_conv.is_owned = (a & 1) || (a == 0);
22827 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22828 a_conv = OutPoint_clone(&a_conv);
22829 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22830 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22831 uint32_t ret_ref = (uintptr_t)ret_copy;
22835 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
22836 LDKOutPoint funding_txo_conv;
22837 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22838 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22839 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22840 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22841 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22842 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22843 uint32_t ret_ref = (uintptr_t)ret_copy;
22847 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
22848 LDKOutPoint a_conv;
22849 a_conv.inner = (void*)(a & (~1));
22850 a_conv.is_owned = (a & 1) || (a == 0);
22851 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22852 a_conv = OutPoint_clone(&a_conv);
22853 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22854 *ret_copy = MonitorEvent_update_failed(a_conv);
22855 uint32_t ret_ref = (uintptr_t)ret_copy;
22859 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
22860 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
22861 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22862 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22863 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22864 CVec_u8Z_free(ret_var);
22868 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
22869 LDKu8slice ser_ref;
22870 ser_ref.datalen = ser->arr_len;
22871 ser_ref.data = ser->elems;
22872 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22873 *ret_conv = MonitorEvent_read(ser_ref);
22875 return (uint32_t)ret_conv;
22878 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
22879 LDKHTLCUpdate this_obj_conv;
22880 this_obj_conv.inner = (void*)(this_obj & (~1));
22881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22883 HTLCUpdate_free(this_obj_conv);
22886 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22887 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22888 uint32_t ret_ref = 0;
22889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22892 ret_ref = (uintptr_t)ret_var.inner;
22893 if (ret_var.is_owned) {
22898 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
22899 LDKHTLCUpdate arg_conv;
22900 arg_conv.inner = (void*)(arg & (~1));
22901 arg_conv.is_owned = false;
22902 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22903 uint32_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
22907 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
22908 LDKHTLCUpdate orig_conv;
22909 orig_conv.inner = (void*)(orig & (~1));
22910 orig_conv.is_owned = false;
22911 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22912 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22913 uint32_t ret_ref = 0;
22914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22917 ret_ref = (uintptr_t)ret_var.inner;
22918 if (ret_var.is_owned) {
22924 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
22925 LDKHTLCUpdate obj_conv;
22926 obj_conv.inner = (void*)(obj & (~1));
22927 obj_conv.is_owned = false;
22928 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22929 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22930 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22931 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22932 CVec_u8Z_free(ret_var);
22936 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22937 LDKu8slice ser_ref;
22938 ser_ref.datalen = ser->arr_len;
22939 ser_ref.data = ser->elems;
22940 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22941 *ret_conv = HTLCUpdate_read(ser_ref);
22943 return (uint32_t)ret_conv;
22946 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
22947 if ((this_ptr & 1) != 0) return;
22948 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22949 CHECK_ACCESS(this_ptr_ptr);
22950 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22951 FREE((void*)this_ptr);
22952 Balance_free(this_ptr_conv);
22955 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22956 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22957 *ret_copy = Balance_clone(arg);
22958 uint32_t ret_ref = (uintptr_t)ret_copy;
22961 uint32_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
22962 LDKBalance* arg_conv = (LDKBalance*)arg;
22963 uint32_t ret_conv = Balance_clone_ptr(arg_conv);
22967 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
22968 LDKBalance* orig_conv = (LDKBalance*)orig;
22969 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22970 *ret_copy = Balance_clone(orig_conv);
22971 uint32_t ret_ref = (uintptr_t)ret_copy;
22975 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22976 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22977 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22978 uint32_t ret_ref = (uintptr_t)ret_copy;
22982 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22983 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22984 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22985 uint32_t ret_ref = (uintptr_t)ret_copy;
22989 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22990 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22991 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22992 uint32_t ret_ref = (uintptr_t)ret_copy;
22996 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) {
22997 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22998 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22999 uint32_t ret_ref = (uintptr_t)ret_copy;
23003 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
23004 LDKBalance* a_conv = (LDKBalance*)a;
23005 LDKBalance* b_conv = (LDKBalance*)b;
23006 jboolean ret_conv = Balance_eq(a_conv, b_conv);
23010 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
23011 LDKChannelMonitor this_obj_conv;
23012 this_obj_conv.inner = (void*)(this_obj & (~1));
23013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23015 ChannelMonitor_free(this_obj_conv);
23018 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
23019 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
23020 uint32_t ret_ref = 0;
23021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23024 ret_ref = (uintptr_t)ret_var.inner;
23025 if (ret_var.is_owned) {
23030 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
23031 LDKChannelMonitor arg_conv;
23032 arg_conv.inner = (void*)(arg & (~1));
23033 arg_conv.is_owned = false;
23034 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23035 uint32_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
23039 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
23040 LDKChannelMonitor orig_conv;
23041 orig_conv.inner = (void*)(orig & (~1));
23042 orig_conv.is_owned = false;
23043 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23044 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
23045 uint32_t ret_ref = 0;
23046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23049 ret_ref = (uintptr_t)ret_var.inner;
23050 if (ret_var.is_owned) {
23056 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
23057 LDKChannelMonitor obj_conv;
23058 obj_conv.inner = (void*)(obj & (~1));
23059 obj_conv.is_owned = false;
23060 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23061 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
23062 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23063 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23064 CVec_u8Z_free(ret_var);
23068 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) {
23069 LDKChannelMonitor this_arg_conv;
23070 this_arg_conv.inner = (void*)(this_arg & (~1));
23071 this_arg_conv.is_owned = false;
23072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23073 LDKChannelMonitorUpdate updates_conv;
23074 updates_conv.inner = (void*)(updates & (~1));
23075 updates_conv.is_owned = false;
23076 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23077 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23078 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
23079 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
23080 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23081 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
23082 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
23083 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23084 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23085 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23086 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23087 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
23088 return (uint32_t)ret_conv;
23091 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
23092 LDKChannelMonitor this_arg_conv;
23093 this_arg_conv.inner = (void*)(this_arg & (~1));
23094 this_arg_conv.is_owned = false;
23095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23096 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
23100 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
23101 LDKChannelMonitor this_arg_conv;
23102 this_arg_conv.inner = (void*)(this_arg & (~1));
23103 this_arg_conv.is_owned = false;
23104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23105 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
23106 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
23107 return ((uint32_t)ret_conv);
23110 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
23111 LDKChannelMonitor this_arg_conv;
23112 this_arg_conv.inner = (void*)(this_arg & (~1));
23113 this_arg_conv.is_owned = false;
23114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23115 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
23116 uint32_tArray ret_arr = NULL;
23117 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23118 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23119 for (size_t o = 0; o < ret_var.datalen; o++) {
23120 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
23121 *ret_conv_40_conv = ret_var.data[o];
23122 ret_arr_ptr[o] = ((uint32_t)ret_conv_40_conv);
23125 FREE(ret_var.data);
23129 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
23130 LDKChannelMonitor this_arg_conv;
23131 this_arg_conv.inner = (void*)(this_arg & (~1));
23132 this_arg_conv.is_owned = false;
23133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23134 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
23135 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
23136 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
23137 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
23140 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) {
23141 LDKChannelMonitor this_arg_conv;
23142 this_arg_conv.inner = (void*)(this_arg & (~1));
23143 this_arg_conv.is_owned = false;
23144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23145 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
23146 uint32_tArray ret_arr = NULL;
23147 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23148 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23149 for (size_t o = 0; o < ret_var.datalen; o++) {
23150 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23151 *ret_conv_14_copy = ret_var.data[o];
23152 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
23153 ret_arr_ptr[o] = ret_conv_14_ref;
23156 FREE(ret_var.data);
23160 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
23161 LDKChannelMonitor this_arg_conv;
23162 this_arg_conv.inner = (void*)(this_arg & (~1));
23163 this_arg_conv.is_owned = false;
23164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23165 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
23166 uint32_tArray ret_arr = NULL;
23167 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23168 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23169 for (size_t h = 0; h < ret_var.datalen; h++) {
23170 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23171 *ret_conv_7_copy = ret_var.data[h];
23172 uint32_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
23173 ret_arr_ptr[h] = ret_conv_7_ref;
23176 FREE(ret_var.data);
23180 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) {
23181 LDKChannelMonitor this_arg_conv;
23182 this_arg_conv.inner = (void*)(this_arg & (~1));
23183 this_arg_conv.is_owned = false;
23184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23185 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23186 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23187 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23188 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
23189 ptrArray ret_arr = NULL;
23190 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23191 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23192 for (size_t m = 0; m < ret_var.datalen; m++) {
23193 LDKTransaction ret_conv_12_var = ret_var.data[m];
23194 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
23195 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
23196 Transaction_free(ret_conv_12_var);
23197 ret_arr_ptr[m] = ret_conv_12_arr;
23200 FREE(ret_var.data);
23204 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) {
23205 LDKChannelMonitor this_arg_conv;
23206 this_arg_conv.inner = (void*)(this_arg & (~1));
23207 this_arg_conv.is_owned = false;
23208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23209 unsigned char header_arr[80];
23210 CHECK(header->arr_len == 80);
23211 memcpy(header_arr, header->elems, 80); FREE(header);
23212 unsigned char (*header_ref)[80] = &header_arr;
23213 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23214 txdata_constr.datalen = txdata->arr_len;
23215 if (txdata_constr.datalen > 0)
23216 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23218 txdata_constr.data = NULL;
23219 uint32_t* txdata_vals = txdata->elems;
23220 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23221 uint32_t txdata_conv_28 = txdata_vals[c];
23222 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23223 CHECK_ACCESS(txdata_conv_28_ptr);
23224 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23225 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23226 txdata_constr.data[c] = txdata_conv_28_conv;
23229 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23230 CHECK_ACCESS(broadcaster_ptr);
23231 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23232 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23233 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23234 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23236 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23237 CHECK_ACCESS(fee_estimator_ptr);
23238 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23239 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23241 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23243 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23244 CHECK_ACCESS(logger_ptr);
23245 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23246 if (logger_conv.free == LDKLogger_JCalls_free) {
23247 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23248 LDKLogger_JCalls_cloned(&logger_conv);
23250 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);
23251 uint32_tArray ret_arr = NULL;
23252 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23253 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23254 for (size_t n = 0; n < ret_var.datalen; n++) {
23255 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23256 *ret_conv_39_conv = ret_var.data[n];
23257 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23260 FREE(ret_var.data);
23264 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) {
23265 LDKChannelMonitor this_arg_conv;
23266 this_arg_conv.inner = (void*)(this_arg & (~1));
23267 this_arg_conv.is_owned = false;
23268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23269 unsigned char header_arr[80];
23270 CHECK(header->arr_len == 80);
23271 memcpy(header_arr, header->elems, 80); FREE(header);
23272 unsigned char (*header_ref)[80] = &header_arr;
23273 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23274 CHECK_ACCESS(broadcaster_ptr);
23275 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23276 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23277 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23278 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23280 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23281 CHECK_ACCESS(fee_estimator_ptr);
23282 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23283 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23284 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23285 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23287 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23288 CHECK_ACCESS(logger_ptr);
23289 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23290 if (logger_conv.free == LDKLogger_JCalls_free) {
23291 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23292 LDKLogger_JCalls_cloned(&logger_conv);
23294 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23297 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) {
23298 LDKChannelMonitor this_arg_conv;
23299 this_arg_conv.inner = (void*)(this_arg & (~1));
23300 this_arg_conv.is_owned = false;
23301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23302 unsigned char header_arr[80];
23303 CHECK(header->arr_len == 80);
23304 memcpy(header_arr, header->elems, 80); FREE(header);
23305 unsigned char (*header_ref)[80] = &header_arr;
23306 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23307 txdata_constr.datalen = txdata->arr_len;
23308 if (txdata_constr.datalen > 0)
23309 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23311 txdata_constr.data = NULL;
23312 uint32_t* txdata_vals = txdata->elems;
23313 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23314 uint32_t txdata_conv_28 = txdata_vals[c];
23315 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23316 CHECK_ACCESS(txdata_conv_28_ptr);
23317 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23318 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23319 txdata_constr.data[c] = txdata_conv_28_conv;
23322 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23323 CHECK_ACCESS(broadcaster_ptr);
23324 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23325 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23326 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23327 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23329 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23330 CHECK_ACCESS(fee_estimator_ptr);
23331 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23332 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23333 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23334 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23336 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23337 CHECK_ACCESS(logger_ptr);
23338 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23339 if (logger_conv.free == LDKLogger_JCalls_free) {
23340 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23341 LDKLogger_JCalls_cloned(&logger_conv);
23343 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);
23344 uint32_tArray ret_arr = NULL;
23345 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23346 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23347 for (size_t n = 0; n < ret_var.datalen; n++) {
23348 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23349 *ret_conv_39_conv = ret_var.data[n];
23350 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23353 FREE(ret_var.data);
23357 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) {
23358 LDKChannelMonitor this_arg_conv;
23359 this_arg_conv.inner = (void*)(this_arg & (~1));
23360 this_arg_conv.is_owned = false;
23361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23362 unsigned char txid_arr[32];
23363 CHECK(txid->arr_len == 32);
23364 memcpy(txid_arr, txid->elems, 32); FREE(txid);
23365 unsigned char (*txid_ref)[32] = &txid_arr;
23366 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23367 CHECK_ACCESS(broadcaster_ptr);
23368 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23369 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23370 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23371 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23373 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23374 CHECK_ACCESS(fee_estimator_ptr);
23375 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23376 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23377 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23378 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23380 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23381 CHECK_ACCESS(logger_ptr);
23382 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23383 if (logger_conv.free == LDKLogger_JCalls_free) {
23384 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23385 LDKLogger_JCalls_cloned(&logger_conv);
23387 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
23390 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) {
23391 LDKChannelMonitor this_arg_conv;
23392 this_arg_conv.inner = (void*)(this_arg & (~1));
23393 this_arg_conv.is_owned = false;
23394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23395 unsigned char header_arr[80];
23396 CHECK(header->arr_len == 80);
23397 memcpy(header_arr, header->elems, 80); FREE(header);
23398 unsigned char (*header_ref)[80] = &header_arr;
23399 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23400 CHECK_ACCESS(broadcaster_ptr);
23401 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23402 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23403 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23404 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23406 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23407 CHECK_ACCESS(fee_estimator_ptr);
23408 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23409 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23411 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23413 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23414 CHECK_ACCESS(logger_ptr);
23415 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23416 if (logger_conv.free == LDKLogger_JCalls_free) {
23417 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23418 LDKLogger_JCalls_cloned(&logger_conv);
23420 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23421 uint32_tArray ret_arr = NULL;
23422 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23423 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23424 for (size_t n = 0; n < ret_var.datalen; n++) {
23425 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23426 *ret_conv_39_conv = ret_var.data[n];
23427 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23430 FREE(ret_var.data);
23434 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
23435 LDKChannelMonitor this_arg_conv;
23436 this_arg_conv.inner = (void*)(this_arg & (~1));
23437 this_arg_conv.is_owned = false;
23438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23439 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
23440 ptrArray ret_arr = NULL;
23441 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23442 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23443 for (size_t m = 0; m < ret_var.datalen; m++) {
23444 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
23445 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
23446 ret_arr_ptr[m] = ret_conv_12_arr;
23449 FREE(ret_var.data);
23453 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
23454 LDKChannelMonitor this_arg_conv;
23455 this_arg_conv.inner = (void*)(this_arg & (~1));
23456 this_arg_conv.is_owned = false;
23457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23458 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
23459 uint32_t ret_ref = 0;
23460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23463 ret_ref = (uintptr_t)ret_var.inner;
23464 if (ret_var.is_owned) {
23470 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
23471 LDKChannelMonitor this_arg_conv;
23472 this_arg_conv.inner = (void*)(this_arg & (~1));
23473 this_arg_conv.is_owned = false;
23474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23475 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23476 uint32_tArray ret_arr = NULL;
23477 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23478 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23479 for (size_t j = 0; j < ret_var.datalen; j++) {
23480 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23481 *ret_conv_9_copy = ret_var.data[j];
23482 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
23483 ret_arr_ptr[j] = ret_conv_9_ref;
23486 FREE(ret_var.data);
23490 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
23491 LDKu8slice ser_ref;
23492 ser_ref.datalen = ser->arr_len;
23493 ser_ref.data = ser->elems;
23494 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
23495 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23496 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23497 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23498 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23500 return (uint32_t)ret_conv;
23503 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
23504 LDKOutPoint this_obj_conv;
23505 this_obj_conv.inner = (void*)(this_obj & (~1));
23506 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23508 OutPoint_free(this_obj_conv);
23511 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
23512 LDKOutPoint this_ptr_conv;
23513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23514 this_ptr_conv.is_owned = false;
23515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23516 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23517 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
23521 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
23522 LDKOutPoint this_ptr_conv;
23523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23524 this_ptr_conv.is_owned = false;
23525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23526 LDKThirtyTwoBytes val_ref;
23527 CHECK(val->arr_len == 32);
23528 memcpy(val_ref.data, val->elems, 32); FREE(val);
23529 OutPoint_set_txid(&this_ptr_conv, val_ref);
23532 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
23533 LDKOutPoint this_ptr_conv;
23534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23535 this_ptr_conv.is_owned = false;
23536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23537 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
23541 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
23542 LDKOutPoint this_ptr_conv;
23543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23544 this_ptr_conv.is_owned = false;
23545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23546 OutPoint_set_index(&this_ptr_conv, val);
23549 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
23550 LDKThirtyTwoBytes txid_arg_ref;
23551 CHECK(txid_arg->arr_len == 32);
23552 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
23553 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23554 uint32_t ret_ref = 0;
23555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23558 ret_ref = (uintptr_t)ret_var.inner;
23559 if (ret_var.is_owned) {
23565 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23566 LDKOutPoint ret_var = OutPoint_clone(arg);
23567 uint32_t ret_ref = 0;
23568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23571 ret_ref = (uintptr_t)ret_var.inner;
23572 if (ret_var.is_owned) {
23577 uint32_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
23578 LDKOutPoint arg_conv;
23579 arg_conv.inner = (void*)(arg & (~1));
23580 arg_conv.is_owned = false;
23581 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23582 uint32_t ret_conv = OutPoint_clone_ptr(&arg_conv);
23586 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
23587 LDKOutPoint orig_conv;
23588 orig_conv.inner = (void*)(orig & (~1));
23589 orig_conv.is_owned = false;
23590 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23591 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23592 uint32_t ret_ref = 0;
23593 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23594 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23596 ret_ref = (uintptr_t)ret_var.inner;
23597 if (ret_var.is_owned) {
23603 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
23604 LDKOutPoint a_conv;
23605 a_conv.inner = (void*)(a & (~1));
23606 a_conv.is_owned = false;
23607 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23608 LDKOutPoint b_conv;
23609 b_conv.inner = (void*)(b & (~1));
23610 b_conv.is_owned = false;
23611 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23612 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
23616 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
23617 LDKOutPoint o_conv;
23618 o_conv.inner = (void*)(o & (~1));
23619 o_conv.is_owned = false;
23620 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23621 int64_t ret_conv = OutPoint_hash(&o_conv);
23625 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
23626 LDKOutPoint this_arg_conv;
23627 this_arg_conv.inner = (void*)(this_arg & (~1));
23628 this_arg_conv.is_owned = false;
23629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23630 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23631 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
23635 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
23636 LDKOutPoint obj_conv;
23637 obj_conv.inner = (void*)(obj & (~1));
23638 obj_conv.is_owned = false;
23639 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23640 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23641 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23642 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23643 CVec_u8Z_free(ret_var);
23647 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
23648 LDKu8slice ser_ref;
23649 ser_ref.datalen = ser->arr_len;
23650 ser_ref.data = ser->elems;
23651 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23652 *ret_conv = OutPoint_read(ser_ref);
23654 return (uint32_t)ret_conv;
23657 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
23658 LDKDelayedPaymentOutputDescriptor this_obj_conv;
23659 this_obj_conv.inner = (void*)(this_obj & (~1));
23660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23662 DelayedPaymentOutputDescriptor_free(this_obj_conv);
23665 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23666 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23668 this_ptr_conv.is_owned = false;
23669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23670 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23671 uint32_t ret_ref = 0;
23672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23675 ret_ref = (uintptr_t)ret_var.inner;
23676 if (ret_var.is_owned) {
23682 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23683 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23685 this_ptr_conv.is_owned = false;
23686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23687 LDKOutPoint val_conv;
23688 val_conv.inner = (void*)(val & (~1));
23689 val_conv.is_owned = (val & 1) || (val == 0);
23690 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23691 val_conv = OutPoint_clone(&val_conv);
23692 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23695 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
23696 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23698 this_ptr_conv.is_owned = false;
23699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23700 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23701 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23705 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23706 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23708 this_ptr_conv.is_owned = false;
23709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23710 LDKPublicKey val_ref;
23711 CHECK(val->arr_len == 33);
23712 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23713 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23716 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
23717 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23719 this_ptr_conv.is_owned = false;
23720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23721 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23725 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23726 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23728 this_ptr_conv.is_owned = false;
23729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23730 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23733 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23734 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23736 this_ptr_conv.is_owned = false;
23737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23738 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23739 CHECK_ACCESS(val_ptr);
23740 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23741 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23742 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23745 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
23746 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23748 this_ptr_conv.is_owned = false;
23749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23750 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23751 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
23755 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
23756 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23758 this_ptr_conv.is_owned = false;
23759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23760 LDKPublicKey val_ref;
23761 CHECK(val->arr_len == 33);
23762 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23763 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23766 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23767 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23769 this_ptr_conv.is_owned = false;
23770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23771 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23772 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23776 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23777 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23779 this_ptr_conv.is_owned = false;
23780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23781 LDKThirtyTwoBytes val_ref;
23782 CHECK(val->arr_len == 32);
23783 memcpy(val_ref.data, val->elems, 32); FREE(val);
23784 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23787 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23788 LDKDelayedPaymentOutputDescriptor 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 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23796 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23797 LDKDelayedPaymentOutputDescriptor 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 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23804 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) {
23805 LDKOutPoint outpoint_arg_conv;
23806 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23807 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23809 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23810 LDKPublicKey per_commitment_point_arg_ref;
23811 CHECK(per_commitment_point_arg->arr_len == 33);
23812 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
23813 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23814 CHECK_ACCESS(output_arg_ptr);
23815 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23816 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23817 LDKPublicKey revocation_pubkey_arg_ref;
23818 CHECK(revocation_pubkey_arg->arr_len == 33);
23819 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
23820 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23821 CHECK(channel_keys_id_arg->arr_len == 32);
23822 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23823 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);
23824 uint32_t ret_ref = 0;
23825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23828 ret_ref = (uintptr_t)ret_var.inner;
23829 if (ret_var.is_owned) {
23835 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23836 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23837 uint32_t ret_ref = 0;
23838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23841 ret_ref = (uintptr_t)ret_var.inner;
23842 if (ret_var.is_owned) {
23847 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
23848 LDKDelayedPaymentOutputDescriptor arg_conv;
23849 arg_conv.inner = (void*)(arg & (~1));
23850 arg_conv.is_owned = false;
23851 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23852 uint32_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23856 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
23857 LDKDelayedPaymentOutputDescriptor orig_conv;
23858 orig_conv.inner = (void*)(orig & (~1));
23859 orig_conv.is_owned = false;
23860 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23861 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
23862 uint32_t ret_ref = 0;
23863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23866 ret_ref = (uintptr_t)ret_var.inner;
23867 if (ret_var.is_owned) {
23873 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
23874 LDKDelayedPaymentOutputDescriptor obj_conv;
23875 obj_conv.inner = (void*)(obj & (~1));
23876 obj_conv.is_owned = false;
23877 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23878 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23879 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23880 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23881 CVec_u8Z_free(ret_var);
23885 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
23886 LDKu8slice ser_ref;
23887 ser_ref.datalen = ser->arr_len;
23888 ser_ref.data = ser->elems;
23889 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23890 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23892 return (uint32_t)ret_conv;
23895 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
23896 LDKStaticPaymentOutputDescriptor this_obj_conv;
23897 this_obj_conv.inner = (void*)(this_obj & (~1));
23898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23900 StaticPaymentOutputDescriptor_free(this_obj_conv);
23903 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23904 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23906 this_ptr_conv.is_owned = false;
23907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23908 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23909 uint32_t ret_ref = 0;
23910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23913 ret_ref = (uintptr_t)ret_var.inner;
23914 if (ret_var.is_owned) {
23920 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23921 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23923 this_ptr_conv.is_owned = false;
23924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23925 LDKOutPoint val_conv;
23926 val_conv.inner = (void*)(val & (~1));
23927 val_conv.is_owned = (val & 1) || (val == 0);
23928 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23929 val_conv = OutPoint_clone(&val_conv);
23930 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23933 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23934 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23936 this_ptr_conv.is_owned = false;
23937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23938 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23939 CHECK_ACCESS(val_ptr);
23940 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23941 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23942 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23945 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23946 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23948 this_ptr_conv.is_owned = false;
23949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23950 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23951 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23955 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23956 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23958 this_ptr_conv.is_owned = false;
23959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23960 LDKThirtyTwoBytes val_ref;
23961 CHECK(val->arr_len == 32);
23962 memcpy(val_ref.data, val->elems, 32); FREE(val);
23963 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23966 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23967 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23969 this_ptr_conv.is_owned = false;
23970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23971 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23975 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23976 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23978 this_ptr_conv.is_owned = false;
23979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23980 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23983 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) {
23984 LDKOutPoint outpoint_arg_conv;
23985 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23986 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23987 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23988 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23989 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23990 CHECK_ACCESS(output_arg_ptr);
23991 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23992 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23993 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23994 CHECK(channel_keys_id_arg->arr_len == 32);
23995 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23996 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23997 uint32_t ret_ref = 0;
23998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24001 ret_ref = (uintptr_t)ret_var.inner;
24002 if (ret_var.is_owned) {
24008 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
24009 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
24010 uint32_t ret_ref = 0;
24011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24014 ret_ref = (uintptr_t)ret_var.inner;
24015 if (ret_var.is_owned) {
24020 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
24021 LDKStaticPaymentOutputDescriptor arg_conv;
24022 arg_conv.inner = (void*)(arg & (~1));
24023 arg_conv.is_owned = false;
24024 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24025 uint32_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
24029 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
24030 LDKStaticPaymentOutputDescriptor orig_conv;
24031 orig_conv.inner = (void*)(orig & (~1));
24032 orig_conv.is_owned = false;
24033 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24034 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
24035 uint32_t ret_ref = 0;
24036 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24037 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24039 ret_ref = (uintptr_t)ret_var.inner;
24040 if (ret_var.is_owned) {
24046 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
24047 LDKStaticPaymentOutputDescriptor obj_conv;
24048 obj_conv.inner = (void*)(obj & (~1));
24049 obj_conv.is_owned = false;
24050 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24051 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
24052 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24053 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24054 CVec_u8Z_free(ret_var);
24058 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
24059 LDKu8slice ser_ref;
24060 ser_ref.datalen = ser->arr_len;
24061 ser_ref.data = ser->elems;
24062 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24063 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
24065 return (uint32_t)ret_conv;
24068 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
24069 if ((this_ptr & 1) != 0) return;
24070 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24071 CHECK_ACCESS(this_ptr_ptr);
24072 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
24073 FREE((void*)this_ptr);
24074 SpendableOutputDescriptor_free(this_ptr_conv);
24077 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
24078 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24079 *ret_copy = SpendableOutputDescriptor_clone(arg);
24080 uint32_t ret_ref = (uintptr_t)ret_copy;
24083 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
24084 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
24085 uint32_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
24089 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
24090 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
24091 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24092 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
24093 uint32_t ret_ref = (uintptr_t)ret_copy;
24097 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
24098 LDKOutPoint outpoint_conv;
24099 outpoint_conv.inner = (void*)(outpoint & (~1));
24100 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
24101 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
24102 outpoint_conv = OutPoint_clone(&outpoint_conv);
24103 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
24104 CHECK_ACCESS(output_ptr);
24105 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
24106 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
24107 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24108 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
24109 uint32_t ret_ref = (uintptr_t)ret_copy;
24113 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
24114 LDKDelayedPaymentOutputDescriptor a_conv;
24115 a_conv.inner = (void*)(a & (~1));
24116 a_conv.is_owned = (a & 1) || (a == 0);
24117 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24118 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
24119 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24120 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
24121 uint32_t ret_ref = (uintptr_t)ret_copy;
24125 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
24126 LDKStaticPaymentOutputDescriptor a_conv;
24127 a_conv.inner = (void*)(a & (~1));
24128 a_conv.is_owned = (a & 1) || (a == 0);
24129 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24130 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
24131 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24132 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
24133 uint32_t ret_ref = (uintptr_t)ret_copy;
24137 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
24138 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
24139 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
24140 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24141 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24142 CVec_u8Z_free(ret_var);
24146 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
24147 LDKu8slice ser_ref;
24148 ser_ref.datalen = ser->arr_len;
24149 ser_ref.data = ser->elems;
24150 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
24151 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
24153 return (uint32_t)ret_conv;
24156 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
24157 if ((this_ptr & 1) != 0) return;
24158 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24159 CHECK_ACCESS(this_ptr_ptr);
24160 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
24161 FREE((void*)this_ptr);
24162 BaseSign_free(this_ptr_conv);
24165 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
24166 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24167 *ret_ret = Sign_clone(arg);
24168 return (uint32_t)ret_ret;
24170 uint32_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
24171 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
24172 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
24173 LDKSign* arg_conv = (LDKSign*)arg_ptr;
24174 uint32_t ret_conv = Sign_clone_ptr(arg_conv);
24178 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
24179 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
24180 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
24181 LDKSign* orig_conv = (LDKSign*)orig_ptr;
24182 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24183 *ret_ret = Sign_clone(orig_conv);
24184 return (uint32_t)ret_ret;
24187 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
24188 if ((this_ptr & 1) != 0) return;
24189 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24190 CHECK_ACCESS(this_ptr_ptr);
24191 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
24192 FREE((void*)this_ptr);
24193 Sign_free(this_ptr_conv);
24196 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
24197 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
24198 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
24202 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
24203 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
24207 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
24208 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
24212 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
24213 if ((this_ptr & 1) != 0) return;
24214 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24215 CHECK_ACCESS(this_ptr_ptr);
24216 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
24217 FREE((void*)this_ptr);
24218 KeysInterface_free(this_ptr_conv);
24221 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
24222 LDKInMemorySigner this_obj_conv;
24223 this_obj_conv.inner = (void*)(this_obj & (~1));
24224 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24226 InMemorySigner_free(this_obj_conv);
24229 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
24230 LDKInMemorySigner this_ptr_conv;
24231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24232 this_ptr_conv.is_owned = false;
24233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24234 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24235 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
24239 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
24240 LDKInMemorySigner this_ptr_conv;
24241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24242 this_ptr_conv.is_owned = false;
24243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24244 LDKSecretKey val_ref;
24245 CHECK(val->arr_len == 32);
24246 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24247 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
24250 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
24251 LDKInMemorySigner this_ptr_conv;
24252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24253 this_ptr_conv.is_owned = false;
24254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24255 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24256 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
24260 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
24261 LDKInMemorySigner this_ptr_conv;
24262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24263 this_ptr_conv.is_owned = false;
24264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24265 LDKSecretKey val_ref;
24266 CHECK(val->arr_len == 32);
24267 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24268 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
24271 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
24272 LDKInMemorySigner this_ptr_conv;
24273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24274 this_ptr_conv.is_owned = false;
24275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24276 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24277 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
24281 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
24282 LDKInMemorySigner this_ptr_conv;
24283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24284 this_ptr_conv.is_owned = false;
24285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24286 LDKSecretKey val_ref;
24287 CHECK(val->arr_len == 32);
24288 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24289 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
24292 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
24293 LDKInMemorySigner this_ptr_conv;
24294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24295 this_ptr_conv.is_owned = false;
24296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24297 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24298 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
24302 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) {
24303 LDKInMemorySigner this_ptr_conv;
24304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24305 this_ptr_conv.is_owned = false;
24306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24307 LDKSecretKey val_ref;
24308 CHECK(val->arr_len == 32);
24309 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24310 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
24313 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
24314 LDKInMemorySigner this_ptr_conv;
24315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24316 this_ptr_conv.is_owned = false;
24317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24318 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24319 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
24323 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
24324 LDKInMemorySigner this_ptr_conv;
24325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24326 this_ptr_conv.is_owned = false;
24327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24328 LDKSecretKey val_ref;
24329 CHECK(val->arr_len == 32);
24330 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24331 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
24334 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
24335 LDKInMemorySigner this_ptr_conv;
24336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24337 this_ptr_conv.is_owned = false;
24338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24339 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24340 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
24344 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
24345 LDKInMemorySigner this_ptr_conv;
24346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24347 this_ptr_conv.is_owned = false;
24348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24349 LDKThirtyTwoBytes val_ref;
24350 CHECK(val->arr_len == 32);
24351 memcpy(val_ref.data, val->elems, 32); FREE(val);
24352 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
24355 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
24356 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
24357 uint32_t ret_ref = 0;
24358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24361 ret_ref = (uintptr_t)ret_var.inner;
24362 if (ret_var.is_owned) {
24367 uint32_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
24368 LDKInMemorySigner arg_conv;
24369 arg_conv.inner = (void*)(arg & (~1));
24370 arg_conv.is_owned = false;
24371 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24372 uint32_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
24376 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
24377 LDKInMemorySigner orig_conv;
24378 orig_conv.inner = (void*)(orig & (~1));
24379 orig_conv.is_owned = false;
24380 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24381 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
24382 uint32_t ret_ref = 0;
24383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24386 ret_ref = (uintptr_t)ret_var.inner;
24387 if (ret_var.is_owned) {
24393 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) {
24394 LDKSecretKey node_secret_ref;
24395 CHECK(node_secret->arr_len == 32);
24396 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
24397 LDKSecretKey funding_key_ref;
24398 CHECK(funding_key->arr_len == 32);
24399 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
24400 LDKSecretKey revocation_base_key_ref;
24401 CHECK(revocation_base_key->arr_len == 32);
24402 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
24403 LDKSecretKey payment_key_ref;
24404 CHECK(payment_key->arr_len == 32);
24405 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
24406 LDKSecretKey delayed_payment_base_key_ref;
24407 CHECK(delayed_payment_base_key->arr_len == 32);
24408 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
24409 LDKSecretKey htlc_base_key_ref;
24410 CHECK(htlc_base_key->arr_len == 32);
24411 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
24412 LDKThirtyTwoBytes commitment_seed_ref;
24413 CHECK(commitment_seed->arr_len == 32);
24414 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
24415 LDKThirtyTwoBytes channel_keys_id_ref;
24416 CHECK(channel_keys_id->arr_len == 32);
24417 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
24418 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);
24419 uint32_t ret_ref = 0;
24420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24423 ret_ref = (uintptr_t)ret_var.inner;
24424 if (ret_var.is_owned) {
24430 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
24431 LDKInMemorySigner this_arg_conv;
24432 this_arg_conv.inner = (void*)(this_arg & (~1));
24433 this_arg_conv.is_owned = false;
24434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24435 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
24436 uint32_t ret_ref = 0;
24437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24440 ret_ref = (uintptr_t)ret_var.inner;
24441 if (ret_var.is_owned) {
24447 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
24448 LDKInMemorySigner this_arg_conv;
24449 this_arg_conv.inner = (void*)(this_arg & (~1));
24450 this_arg_conv.is_owned = false;
24451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24452 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
24456 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
24457 LDKInMemorySigner this_arg_conv;
24458 this_arg_conv.inner = (void*)(this_arg & (~1));
24459 this_arg_conv.is_owned = false;
24460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24461 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
24465 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
24466 LDKInMemorySigner this_arg_conv;
24467 this_arg_conv.inner = (void*)(this_arg & (~1));
24468 this_arg_conv.is_owned = false;
24469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24470 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
24474 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
24475 LDKInMemorySigner this_arg_conv;
24476 this_arg_conv.inner = (void*)(this_arg & (~1));
24477 this_arg_conv.is_owned = false;
24478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24479 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24480 uint32_t ret_ref = 0;
24481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24484 ret_ref = (uintptr_t)ret_var.inner;
24485 if (ret_var.is_owned) {
24491 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
24492 LDKInMemorySigner this_arg_conv;
24493 this_arg_conv.inner = (void*)(this_arg & (~1));
24494 this_arg_conv.is_owned = false;
24495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24496 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24497 uint32_t ret_ref = 0;
24498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24501 ret_ref = (uintptr_t)ret_var.inner;
24502 if (ret_var.is_owned) {
24508 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
24509 LDKInMemorySigner this_arg_conv;
24510 this_arg_conv.inner = (void*)(this_arg & (~1));
24511 this_arg_conv.is_owned = false;
24512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24513 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
24517 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_counterparty_payment_input"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint32_t descriptor) {
24518 LDKInMemorySigner this_arg_conv;
24519 this_arg_conv.inner = (void*)(this_arg & (~1));
24520 this_arg_conv.is_owned = false;
24521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24522 LDKTransaction spend_tx_ref;
24523 spend_tx_ref.datalen = spend_tx->arr_len;
24524 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24525 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24526 spend_tx_ref.data_is_owned = true;
24527 LDKStaticPaymentOutputDescriptor descriptor_conv;
24528 descriptor_conv.inner = (void*)(descriptor & (~1));
24529 descriptor_conv.is_owned = false;
24530 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24531 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24532 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24533 return (uint32_t)ret_conv;
24536 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_dynamic_p2wsh_input"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint32_t descriptor) {
24537 LDKInMemorySigner this_arg_conv;
24538 this_arg_conv.inner = (void*)(this_arg & (~1));
24539 this_arg_conv.is_owned = false;
24540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24541 LDKTransaction spend_tx_ref;
24542 spend_tx_ref.datalen = spend_tx->arr_len;
24543 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24544 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24545 spend_tx_ref.data_is_owned = true;
24546 LDKDelayedPaymentOutputDescriptor descriptor_conv;
24547 descriptor_conv.inner = (void*)(descriptor & (~1));
24548 descriptor_conv.is_owned = false;
24549 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24550 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24551 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24552 return (uint32_t)ret_conv;
24555 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
24556 LDKInMemorySigner this_arg_conv;
24557 this_arg_conv.inner = (void*)(this_arg & (~1));
24558 this_arg_conv.is_owned = false;
24559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24560 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24561 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24562 return (uint32_t)ret_ret;
24565 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
24566 LDKInMemorySigner this_arg_conv;
24567 this_arg_conv.inner = (void*)(this_arg & (~1));
24568 this_arg_conv.is_owned = false;
24569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24570 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24571 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24572 return (uint32_t)ret_ret;
24575 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
24576 LDKInMemorySigner obj_conv;
24577 obj_conv.inner = (void*)(obj & (~1));
24578 obj_conv.is_owned = false;
24579 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24580 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24581 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24582 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24583 CVec_u8Z_free(ret_var);
24587 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
24588 LDKu8slice ser_ref;
24589 ser_ref.datalen = ser->arr_len;
24590 ser_ref.data = ser->elems;
24591 LDKSecretKey arg_ref;
24592 CHECK(arg->arr_len == 32);
24593 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
24594 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24595 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
24597 return (uint32_t)ret_conv;
24600 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
24601 LDKKeysManager this_obj_conv;
24602 this_obj_conv.inner = (void*)(this_obj & (~1));
24603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24605 KeysManager_free(this_obj_conv);
24608 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
24609 unsigned char seed_arr[32];
24610 CHECK(seed->arr_len == 32);
24611 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24612 unsigned char (*seed_ref)[32] = &seed_arr;
24613 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24614 uint32_t ret_ref = 0;
24615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24618 ret_ref = (uintptr_t)ret_var.inner;
24619 if (ret_var.is_owned) {
24625 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) {
24626 LDKKeysManager this_arg_conv;
24627 this_arg_conv.inner = (void*)(this_arg & (~1));
24628 this_arg_conv.is_owned = false;
24629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24630 unsigned char params_arr[32];
24631 CHECK(params->arr_len == 32);
24632 memcpy(params_arr, params->elems, 32); FREE(params);
24633 unsigned char (*params_ref)[32] = ¶ms_arr;
24634 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24635 uint32_t ret_ref = 0;
24636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24639 ret_ref = (uintptr_t)ret_var.inner;
24640 if (ret_var.is_owned) {
24646 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) {
24647 LDKKeysManager this_arg_conv;
24648 this_arg_conv.inner = (void*)(this_arg & (~1));
24649 this_arg_conv.is_owned = false;
24650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24651 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24652 descriptors_constr.datalen = descriptors->arr_len;
24653 if (descriptors_constr.datalen > 0)
24654 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24656 descriptors_constr.data = NULL;
24657 uint32_t* descriptors_vals = descriptors->elems;
24658 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24659 uint32_t descriptors_conv_27 = descriptors_vals[b];
24660 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24661 CHECK_ACCESS(descriptors_conv_27_ptr);
24662 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24663 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24664 descriptors_constr.data[b] = descriptors_conv_27_conv;
24667 LDKCVec_TxOutZ outputs_constr;
24668 outputs_constr.datalen = outputs->arr_len;
24669 if (outputs_constr.datalen > 0)
24670 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24672 outputs_constr.data = NULL;
24673 uint32_t* outputs_vals = outputs->elems;
24674 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24675 uint32_t outputs_conv_7 = outputs_vals[h];
24676 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24677 CHECK_ACCESS(outputs_conv_7_ptr);
24678 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24679 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24680 outputs_constr.data[h] = outputs_conv_7_conv;
24683 LDKCVec_u8Z change_destination_script_ref;
24684 change_destination_script_ref.datalen = change_destination_script->arr_len;
24685 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24686 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24687 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24688 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24689 return (uint32_t)ret_conv;
24692 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
24693 LDKKeysManager this_arg_conv;
24694 this_arg_conv.inner = (void*)(this_arg & (~1));
24695 this_arg_conv.is_owned = false;
24696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24697 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24698 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24699 return (uint32_t)ret_ret;
24702 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
24703 LDKPhantomKeysManager this_obj_conv;
24704 this_obj_conv.inner = (void*)(this_obj & (~1));
24705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24707 PhantomKeysManager_free(this_obj_conv);
24710 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
24711 LDKPhantomKeysManager this_arg_conv;
24712 this_arg_conv.inner = (void*)(this_arg & (~1));
24713 this_arg_conv.is_owned = false;
24714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24715 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24716 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
24717 return (uint32_t)ret_ret;
24720 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) {
24721 unsigned char seed_arr[32];
24722 CHECK(seed->arr_len == 32);
24723 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24724 unsigned char (*seed_ref)[32] = &seed_arr;
24725 unsigned char cross_node_seed_arr[32];
24726 CHECK(cross_node_seed->arr_len == 32);
24727 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
24728 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
24729 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
24730 uint32_t ret_ref = 0;
24731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24734 ret_ref = (uintptr_t)ret_var.inner;
24735 if (ret_var.is_owned) {
24741 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) {
24742 LDKPhantomKeysManager this_arg_conv;
24743 this_arg_conv.inner = (void*)(this_arg & (~1));
24744 this_arg_conv.is_owned = false;
24745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24746 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24747 descriptors_constr.datalen = descriptors->arr_len;
24748 if (descriptors_constr.datalen > 0)
24749 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24751 descriptors_constr.data = NULL;
24752 uint32_t* descriptors_vals = descriptors->elems;
24753 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24754 uint32_t descriptors_conv_27 = descriptors_vals[b];
24755 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24756 CHECK_ACCESS(descriptors_conv_27_ptr);
24757 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24758 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24759 descriptors_constr.data[b] = descriptors_conv_27_conv;
24762 LDKCVec_TxOutZ outputs_constr;
24763 outputs_constr.datalen = outputs->arr_len;
24764 if (outputs_constr.datalen > 0)
24765 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24767 outputs_constr.data = NULL;
24768 uint32_t* outputs_vals = outputs->elems;
24769 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24770 uint32_t outputs_conv_7 = outputs_vals[h];
24771 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24772 CHECK_ACCESS(outputs_conv_7_ptr);
24773 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24774 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24775 outputs_constr.data[h] = outputs_conv_7_conv;
24778 LDKCVec_u8Z change_destination_script_ref;
24779 change_destination_script_ref.datalen = change_destination_script->arr_len;
24780 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24781 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24782 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24783 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24784 return (uint32_t)ret_conv;
24787 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) {
24788 LDKPhantomKeysManager this_arg_conv;
24789 this_arg_conv.inner = (void*)(this_arg & (~1));
24790 this_arg_conv.is_owned = false;
24791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24792 unsigned char params_arr[32];
24793 CHECK(params->arr_len == 32);
24794 memcpy(params_arr, params->elems, 32); FREE(params);
24795 unsigned char (*params_ref)[32] = ¶ms_arr;
24796 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24797 uint32_t ret_ref = 0;
24798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24801 ret_ref = (uintptr_t)ret_var.inner;
24802 if (ret_var.is_owned) {
24808 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
24809 LDKChannelManager this_obj_conv;
24810 this_obj_conv.inner = (void*)(this_obj & (~1));
24811 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24813 ChannelManager_free(this_obj_conv);
24816 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
24817 LDKChainParameters this_obj_conv;
24818 this_obj_conv.inner = (void*)(this_obj & (~1));
24819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24821 ChainParameters_free(this_obj_conv);
24824 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
24825 LDKChainParameters this_ptr_conv;
24826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24827 this_ptr_conv.is_owned = false;
24828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24829 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
24833 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
24834 LDKChainParameters this_ptr_conv;
24835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24836 this_ptr_conv.is_owned = false;
24837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24838 LDKNetwork val_conv = LDKNetwork_from_js(val);
24839 ChainParameters_set_network(&this_ptr_conv, val_conv);
24842 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
24843 LDKChainParameters this_ptr_conv;
24844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24845 this_ptr_conv.is_owned = false;
24846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24847 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24848 uint32_t ret_ref = 0;
24849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24852 ret_ref = (uintptr_t)ret_var.inner;
24853 if (ret_var.is_owned) {
24859 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
24860 LDKChainParameters this_ptr_conv;
24861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24862 this_ptr_conv.is_owned = false;
24863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24864 LDKBestBlock val_conv;
24865 val_conv.inner = (void*)(val & (~1));
24866 val_conv.is_owned = (val & 1) || (val == 0);
24867 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24868 val_conv = BestBlock_clone(&val_conv);
24869 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24872 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
24873 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
24874 LDKBestBlock best_block_arg_conv;
24875 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
24876 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
24877 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24878 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24879 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24880 uint32_t ret_ref = 0;
24881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24884 ret_ref = (uintptr_t)ret_var.inner;
24885 if (ret_var.is_owned) {
24891 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24892 LDKChainParameters ret_var = ChainParameters_clone(arg);
24893 uint32_t ret_ref = 0;
24894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24897 ret_ref = (uintptr_t)ret_var.inner;
24898 if (ret_var.is_owned) {
24903 uint32_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
24904 LDKChainParameters arg_conv;
24905 arg_conv.inner = (void*)(arg & (~1));
24906 arg_conv.is_owned = false;
24907 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24908 uint32_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
24912 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
24913 LDKChainParameters orig_conv;
24914 orig_conv.inner = (void*)(orig & (~1));
24915 orig_conv.is_owned = false;
24916 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24917 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24918 uint32_t ret_ref = 0;
24919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24922 ret_ref = (uintptr_t)ret_var.inner;
24923 if (ret_var.is_owned) {
24929 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
24930 LDKCounterpartyForwardingInfo this_obj_conv;
24931 this_obj_conv.inner = (void*)(this_obj & (~1));
24932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24934 CounterpartyForwardingInfo_free(this_obj_conv);
24937 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
24938 LDKCounterpartyForwardingInfo this_ptr_conv;
24939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24940 this_ptr_conv.is_owned = false;
24941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24942 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24946 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
24947 LDKCounterpartyForwardingInfo this_ptr_conv;
24948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24949 this_ptr_conv.is_owned = false;
24950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24951 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24954 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
24955 LDKCounterpartyForwardingInfo this_ptr_conv;
24956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24957 this_ptr_conv.is_owned = false;
24958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24959 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24963 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
24964 LDKCounterpartyForwardingInfo this_ptr_conv;
24965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24966 this_ptr_conv.is_owned = false;
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24968 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24971 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24972 LDKCounterpartyForwardingInfo this_ptr_conv;
24973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24974 this_ptr_conv.is_owned = false;
24975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24976 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24980 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24981 LDKCounterpartyForwardingInfo this_ptr_conv;
24982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24983 this_ptr_conv.is_owned = false;
24984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24985 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24988 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) {
24989 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24990 uint32_t ret_ref = 0;
24991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24994 ret_ref = (uintptr_t)ret_var.inner;
24995 if (ret_var.is_owned) {
25001 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
25002 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
25003 uint32_t ret_ref = 0;
25004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25007 ret_ref = (uintptr_t)ret_var.inner;
25008 if (ret_var.is_owned) {
25013 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
25014 LDKCounterpartyForwardingInfo arg_conv;
25015 arg_conv.inner = (void*)(arg & (~1));
25016 arg_conv.is_owned = false;
25017 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25018 uint32_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
25022 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
25023 LDKCounterpartyForwardingInfo orig_conv;
25024 orig_conv.inner = (void*)(orig & (~1));
25025 orig_conv.is_owned = false;
25026 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25027 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
25028 uint32_t ret_ref = 0;
25029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25032 ret_ref = (uintptr_t)ret_var.inner;
25033 if (ret_var.is_owned) {
25039 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
25040 LDKChannelCounterparty this_obj_conv;
25041 this_obj_conv.inner = (void*)(this_obj & (~1));
25042 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25044 ChannelCounterparty_free(this_obj_conv);
25047 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
25048 LDKChannelCounterparty this_ptr_conv;
25049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25050 this_ptr_conv.is_owned = false;
25051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25052 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25053 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
25057 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
25058 LDKChannelCounterparty this_ptr_conv;
25059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25060 this_ptr_conv.is_owned = false;
25061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25062 LDKPublicKey val_ref;
25063 CHECK(val->arr_len == 33);
25064 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25065 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
25068 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
25069 LDKChannelCounterparty this_ptr_conv;
25070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25071 this_ptr_conv.is_owned = false;
25072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25073 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
25074 uint32_t ret_ref = 0;
25075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25078 ret_ref = (uintptr_t)ret_var.inner;
25079 if (ret_var.is_owned) {
25085 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
25086 LDKChannelCounterparty this_ptr_conv;
25087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25088 this_ptr_conv.is_owned = false;
25089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25090 LDKInitFeatures val_conv;
25091 val_conv.inner = (void*)(val & (~1));
25092 val_conv.is_owned = (val & 1) || (val == 0);
25093 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25094 val_conv = InitFeatures_clone(&val_conv);
25095 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
25098 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25099 LDKChannelCounterparty this_ptr_conv;
25100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25101 this_ptr_conv.is_owned = false;
25102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25103 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
25107 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
25108 LDKChannelCounterparty this_ptr_conv;
25109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25110 this_ptr_conv.is_owned = false;
25111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25112 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
25115 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
25116 LDKChannelCounterparty this_ptr_conv;
25117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25118 this_ptr_conv.is_owned = false;
25119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25120 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
25121 uint32_t ret_ref = 0;
25122 if ((uintptr_t)ret_var.inner > 4096) {
25123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25126 ret_ref = (uintptr_t)ret_var.inner;
25127 if (ret_var.is_owned) {
25134 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
25135 LDKChannelCounterparty this_ptr_conv;
25136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25137 this_ptr_conv.is_owned = false;
25138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25139 LDKCounterpartyForwardingInfo val_conv;
25140 val_conv.inner = (void*)(val & (~1));
25141 val_conv.is_owned = (val & 1) || (val == 0);
25142 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25143 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
25144 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
25147 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint32_t this_ptr) {
25148 LDKChannelCounterparty this_ptr_conv;
25149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25150 this_ptr_conv.is_owned = false;
25151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25152 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25153 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
25154 uint32_t ret_ref = (uintptr_t)ret_copy;
25158 void __attribute__((export_name("TS_ChannelCounterparty_set_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_set_outbound_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
25159 LDKChannelCounterparty this_ptr_conv;
25160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25161 this_ptr_conv.is_owned = false;
25162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25163 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25164 CHECK_ACCESS(val_ptr);
25165 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25166 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25167 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25170 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint32_t this_ptr) {
25171 LDKChannelCounterparty this_ptr_conv;
25172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25173 this_ptr_conv.is_owned = false;
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25175 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25176 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
25177 uint32_t ret_ref = (uintptr_t)ret_copy;
25181 void __attribute__((export_name("TS_ChannelCounterparty_set_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_set_outbound_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
25182 LDKChannelCounterparty this_ptr_conv;
25183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25184 this_ptr_conv.is_owned = false;
25185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25186 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25187 CHECK_ACCESS(val_ptr);
25188 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25189 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25190 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25193 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, uint32_t outbound_htlc_minimum_msat_arg, uint32_t outbound_htlc_maximum_msat_arg) {
25194 LDKPublicKey node_id_arg_ref;
25195 CHECK(node_id_arg->arr_len == 33);
25196 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
25197 LDKInitFeatures features_arg_conv;
25198 features_arg_conv.inner = (void*)(features_arg & (~1));
25199 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25200 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
25201 features_arg_conv = InitFeatures_clone(&features_arg_conv);
25202 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
25203 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
25204 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
25205 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
25206 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
25207 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
25208 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
25209 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
25210 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
25211 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
25212 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
25213 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
25214 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
25215 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
25216 uint32_t ret_ref = 0;
25217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25220 ret_ref = (uintptr_t)ret_var.inner;
25221 if (ret_var.is_owned) {
25227 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
25228 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
25229 uint32_t ret_ref = 0;
25230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25233 ret_ref = (uintptr_t)ret_var.inner;
25234 if (ret_var.is_owned) {
25239 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
25240 LDKChannelCounterparty arg_conv;
25241 arg_conv.inner = (void*)(arg & (~1));
25242 arg_conv.is_owned = false;
25243 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25244 uint32_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
25248 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
25249 LDKChannelCounterparty orig_conv;
25250 orig_conv.inner = (void*)(orig & (~1));
25251 orig_conv.is_owned = false;
25252 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25253 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
25254 uint32_t ret_ref = 0;
25255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25258 ret_ref = (uintptr_t)ret_var.inner;
25259 if (ret_var.is_owned) {
25265 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
25266 LDKChannelDetails this_obj_conv;
25267 this_obj_conv.inner = (void*)(this_obj & (~1));
25268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25270 ChannelDetails_free(this_obj_conv);
25273 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
25274 LDKChannelDetails this_ptr_conv;
25275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25276 this_ptr_conv.is_owned = false;
25277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25278 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25279 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
25283 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25284 LDKChannelDetails this_ptr_conv;
25285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25286 this_ptr_conv.is_owned = false;
25287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25288 LDKThirtyTwoBytes val_ref;
25289 CHECK(val->arr_len == 32);
25290 memcpy(val_ref.data, val->elems, 32); FREE(val);
25291 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
25294 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
25295 LDKChannelDetails this_ptr_conv;
25296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25297 this_ptr_conv.is_owned = false;
25298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25299 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
25300 uint32_t ret_ref = 0;
25301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25304 ret_ref = (uintptr_t)ret_var.inner;
25305 if (ret_var.is_owned) {
25311 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
25312 LDKChannelDetails this_ptr_conv;
25313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25314 this_ptr_conv.is_owned = false;
25315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25316 LDKChannelCounterparty val_conv;
25317 val_conv.inner = (void*)(val & (~1));
25318 val_conv.is_owned = (val & 1) || (val == 0);
25319 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25320 val_conv = ChannelCounterparty_clone(&val_conv);
25321 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
25324 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
25325 LDKChannelDetails this_ptr_conv;
25326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25327 this_ptr_conv.is_owned = false;
25328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25329 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
25330 uint32_t ret_ref = 0;
25331 if ((uintptr_t)ret_var.inner > 4096) {
25332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25335 ret_ref = (uintptr_t)ret_var.inner;
25336 if (ret_var.is_owned) {
25343 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
25344 LDKChannelDetails this_ptr_conv;
25345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25346 this_ptr_conv.is_owned = false;
25347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25348 LDKOutPoint val_conv;
25349 val_conv.inner = (void*)(val & (~1));
25350 val_conv.is_owned = (val & 1) || (val == 0);
25351 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25352 val_conv = OutPoint_clone(&val_conv);
25353 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
25356 uint32_t __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint32_t this_ptr) {
25357 LDKChannelDetails this_ptr_conv;
25358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25359 this_ptr_conv.is_owned = false;
25360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25361 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
25362 uint32_t ret_ref = 0;
25363 if ((uintptr_t)ret_var.inner > 4096) {
25364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25367 ret_ref = (uintptr_t)ret_var.inner;
25368 if (ret_var.is_owned) {
25375 void __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint32_t this_ptr, uint32_t val) {
25376 LDKChannelDetails this_ptr_conv;
25377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25378 this_ptr_conv.is_owned = false;
25379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25380 LDKChannelTypeFeatures val_conv;
25381 val_conv.inner = (void*)(val & (~1));
25382 val_conv.is_owned = (val & 1) || (val == 0);
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25384 val_conv = ChannelTypeFeatures_clone(&val_conv);
25385 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
25388 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
25389 LDKChannelDetails this_ptr_conv;
25390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25391 this_ptr_conv.is_owned = false;
25392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25393 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25394 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
25395 uint32_t ret_ref = (uintptr_t)ret_copy;
25399 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
25400 LDKChannelDetails this_ptr_conv;
25401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25402 this_ptr_conv.is_owned = false;
25403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25404 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25405 CHECK_ACCESS(val_ptr);
25406 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25407 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25408 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
25411 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint32_t this_ptr) {
25412 LDKChannelDetails 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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25417 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
25418 uint32_t ret_ref = (uintptr_t)ret_copy;
25422 void __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25423 LDKChannelDetails this_ptr_conv;
25424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25425 this_ptr_conv.is_owned = false;
25426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25427 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25428 CHECK_ACCESS(val_ptr);
25429 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25430 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25431 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
25434 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint32_t this_ptr) {
25435 LDKChannelDetails this_ptr_conv;
25436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25437 this_ptr_conv.is_owned = false;
25438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25439 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25440 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
25441 uint32_t ret_ref = (uintptr_t)ret_copy;
25445 void __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25446 LDKChannelDetails this_ptr_conv;
25447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25448 this_ptr_conv.is_owned = false;
25449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25450 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25451 CHECK_ACCESS(val_ptr);
25452 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25453 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25454 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
25457 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
25458 LDKChannelDetails this_ptr_conv;
25459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25460 this_ptr_conv.is_owned = false;
25461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25462 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
25466 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
25467 LDKChannelDetails this_ptr_conv;
25468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25469 this_ptr_conv.is_owned = false;
25470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25471 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
25474 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25475 LDKChannelDetails 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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25480 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
25481 uint32_t ret_ref = (uintptr_t)ret_copy;
25485 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
25486 LDKChannelDetails this_ptr_conv;
25487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25488 this_ptr_conv.is_owned = false;
25489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25490 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25491 CHECK_ACCESS(val_ptr);
25492 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25493 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25494 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
25497 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
25498 LDKChannelDetails this_ptr_conv;
25499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25500 this_ptr_conv.is_owned = false;
25501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25502 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
25506 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
25507 LDKChannelDetails this_ptr_conv;
25508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25509 this_ptr_conv.is_owned = false;
25510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25511 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
25514 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
25515 LDKChannelDetails this_ptr_conv;
25516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25517 this_ptr_conv.is_owned = false;
25518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25519 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
25523 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
25524 LDKChannelDetails this_ptr_conv;
25525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25526 this_ptr_conv.is_owned = false;
25527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25528 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
25531 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
25532 LDKChannelDetails this_ptr_conv;
25533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25534 this_ptr_conv.is_owned = false;
25535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25536 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
25540 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25541 LDKChannelDetails this_ptr_conv;
25542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25543 this_ptr_conv.is_owned = false;
25544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25545 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
25548 int64_t __attribute__((export_name("TS_ChannelDetails_get_next_outbound_htlc_limit_msat"))) TS_ChannelDetails_get_next_outbound_htlc_limit_msat(uint32_t this_ptr) {
25549 LDKChannelDetails this_ptr_conv;
25550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25551 this_ptr_conv.is_owned = false;
25552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25553 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
25557 void __attribute__((export_name("TS_ChannelDetails_set_next_outbound_htlc_limit_msat"))) TS_ChannelDetails_set_next_outbound_htlc_limit_msat(uint32_t this_ptr, int64_t val) {
25558 LDKChannelDetails this_ptr_conv;
25559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25560 this_ptr_conv.is_owned = false;
25561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25562 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
25565 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
25566 LDKChannelDetails this_ptr_conv;
25567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25568 this_ptr_conv.is_owned = false;
25569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25570 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
25574 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25575 LDKChannelDetails this_ptr_conv;
25576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25577 this_ptr_conv.is_owned = false;
25578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25579 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
25582 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
25583 LDKChannelDetails this_ptr_conv;
25584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25585 this_ptr_conv.is_owned = false;
25586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25587 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25588 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
25589 uint32_t ret_ref = (uintptr_t)ret_copy;
25593 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
25594 LDKChannelDetails this_ptr_conv;
25595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25596 this_ptr_conv.is_owned = false;
25597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25598 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25599 CHECK_ACCESS(val_ptr);
25600 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25601 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
25602 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25605 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
25606 LDKChannelDetails this_ptr_conv;
25607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25608 this_ptr_conv.is_owned = false;
25609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25610 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25611 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25612 uint32_t ret_ref = (uintptr_t)ret_copy;
25616 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) {
25617 LDKChannelDetails this_ptr_conv;
25618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25619 this_ptr_conv.is_owned = false;
25620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25621 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25622 CHECK_ACCESS(val_ptr);
25623 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25624 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
25625 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25628 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
25629 LDKChannelDetails this_ptr_conv;
25630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25631 this_ptr_conv.is_owned = false;
25632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25633 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
25637 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
25638 LDKChannelDetails this_ptr_conv;
25639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25640 this_ptr_conv.is_owned = false;
25641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25642 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25645 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint32_t this_ptr) {
25646 LDKChannelDetails this_ptr_conv;
25647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25648 this_ptr_conv.is_owned = false;
25649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25650 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
25654 void __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint32_t this_ptr, jboolean val) {
25655 LDKChannelDetails this_ptr_conv;
25656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25657 this_ptr_conv.is_owned = false;
25658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25659 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
25662 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
25663 LDKChannelDetails this_ptr_conv;
25664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25665 this_ptr_conv.is_owned = false;
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25667 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
25671 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
25672 LDKChannelDetails this_ptr_conv;
25673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25674 this_ptr_conv.is_owned = false;
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25676 ChannelDetails_set_is_usable(&this_ptr_conv, val);
25679 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
25680 LDKChannelDetails this_ptr_conv;
25681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25682 this_ptr_conv.is_owned = false;
25683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25684 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
25688 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
25689 LDKChannelDetails this_ptr_conv;
25690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25691 this_ptr_conv.is_owned = false;
25692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25693 ChannelDetails_set_is_public(&this_ptr_conv, val);
25696 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint32_t this_ptr) {
25697 LDKChannelDetails this_ptr_conv;
25698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25699 this_ptr_conv.is_owned = false;
25700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25701 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25702 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
25703 uint32_t ret_ref = (uintptr_t)ret_copy;
25707 void __attribute__((export_name("TS_ChannelDetails_set_inbound_htlc_minimum_msat"))) TS_ChannelDetails_set_inbound_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
25708 LDKChannelDetails this_ptr_conv;
25709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25710 this_ptr_conv.is_owned = false;
25711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25712 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25713 CHECK_ACCESS(val_ptr);
25714 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25715 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25716 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25719 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint32_t this_ptr) {
25720 LDKChannelDetails this_ptr_conv;
25721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25722 this_ptr_conv.is_owned = false;
25723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25724 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25725 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
25726 uint32_t ret_ref = (uintptr_t)ret_copy;
25730 void __attribute__((export_name("TS_ChannelDetails_set_inbound_htlc_maximum_msat"))) TS_ChannelDetails_set_inbound_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
25731 LDKChannelDetails this_ptr_conv;
25732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25733 this_ptr_conv.is_owned = false;
25734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25735 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25736 CHECK_ACCESS(val_ptr);
25737 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25738 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25739 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25742 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 channel_type_arg, uint32_t short_channel_id_arg, uint32_t outbound_scid_alias_arg, uint32_t inbound_scid_alias_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 next_outbound_htlc_limit_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_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint32_t inbound_htlc_minimum_msat_arg, uint32_t inbound_htlc_maximum_msat_arg) {
25743 LDKThirtyTwoBytes channel_id_arg_ref;
25744 CHECK(channel_id_arg->arr_len == 32);
25745 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25746 LDKChannelCounterparty counterparty_arg_conv;
25747 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
25748 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
25749 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25750 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25751 LDKOutPoint funding_txo_arg_conv;
25752 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
25753 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
25754 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25755 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25756 LDKChannelTypeFeatures channel_type_arg_conv;
25757 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
25758 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
25759 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
25760 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
25761 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
25762 CHECK_ACCESS(short_channel_id_arg_ptr);
25763 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25764 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
25765 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
25766 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
25767 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
25768 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
25769 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
25770 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
25771 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
25772 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
25773 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
25774 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25775 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25776 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
25777 CHECK_ACCESS(confirmations_required_arg_ptr);
25778 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25779 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
25780 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
25781 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25782 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25783 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
25784 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
25785 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
25786 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
25787 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
25788 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
25789 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
25790 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
25791 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
25792 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv);
25793 uint32_t ret_ref = 0;
25794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25797 ret_ref = (uintptr_t)ret_var.inner;
25798 if (ret_var.is_owned) {
25804 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25805 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25806 uint32_t ret_ref = 0;
25807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25810 ret_ref = (uintptr_t)ret_var.inner;
25811 if (ret_var.is_owned) {
25816 uint32_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
25817 LDKChannelDetails arg_conv;
25818 arg_conv.inner = (void*)(arg & (~1));
25819 arg_conv.is_owned = false;
25820 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25821 uint32_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
25825 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
25826 LDKChannelDetails orig_conv;
25827 orig_conv.inner = (void*)(orig & (~1));
25828 orig_conv.is_owned = false;
25829 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25830 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25831 uint32_t ret_ref = 0;
25832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25835 ret_ref = (uintptr_t)ret_var.inner;
25836 if (ret_var.is_owned) {
25842 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint32_t this_arg) {
25843 LDKChannelDetails this_arg_conv;
25844 this_arg_conv.inner = (void*)(this_arg & (~1));
25845 this_arg_conv.is_owned = false;
25846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25847 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25848 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
25849 uint32_t ret_ref = (uintptr_t)ret_copy;
25853 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint32_t this_arg) {
25854 LDKChannelDetails this_arg_conv;
25855 this_arg_conv.inner = (void*)(this_arg & (~1));
25856 this_arg_conv.is_owned = false;
25857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25858 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25859 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
25860 uint32_t ret_ref = (uintptr_t)ret_copy;
25864 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
25865 if ((this_ptr & 1) != 0) return;
25866 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25867 CHECK_ACCESS(this_ptr_ptr);
25868 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25869 FREE((void*)this_ptr);
25870 PaymentSendFailure_free(this_ptr_conv);
25873 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25874 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25875 *ret_copy = PaymentSendFailure_clone(arg);
25876 uint32_t ret_ref = (uintptr_t)ret_copy;
25879 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
25880 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
25881 uint32_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
25885 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
25886 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
25887 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25888 *ret_copy = PaymentSendFailure_clone(orig_conv);
25889 uint32_t ret_ref = (uintptr_t)ret_copy;
25893 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
25894 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
25895 CHECK_ACCESS(a_ptr);
25896 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25897 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
25898 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25899 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25900 uint32_t ret_ref = (uintptr_t)ret_copy;
25904 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
25905 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25906 a_constr.datalen = a->arr_len;
25907 if (a_constr.datalen > 0)
25908 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25910 a_constr.data = NULL;
25911 uint32_t* a_vals = a->elems;
25912 for (size_t w = 0; w < a_constr.datalen; w++) {
25913 uint32_t a_conv_22 = a_vals[w];
25914 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
25915 CHECK_ACCESS(a_conv_22_ptr);
25916 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25917 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
25918 a_constr.data[w] = a_conv_22_conv;
25921 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25922 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25923 uint32_t ret_ref = (uintptr_t)ret_copy;
25927 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
25928 LDKCVec_APIErrorZ a_constr;
25929 a_constr.datalen = a->arr_len;
25930 if (a_constr.datalen > 0)
25931 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25933 a_constr.data = NULL;
25934 uint32_t* a_vals = a->elems;
25935 for (size_t k = 0; k < a_constr.datalen; k++) {
25936 uint32_t a_conv_10 = a_vals[k];
25937 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
25938 CHECK_ACCESS(a_conv_10_ptr);
25939 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25940 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
25941 a_constr.data[k] = a_conv_10_conv;
25944 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25945 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25946 uint32_t ret_ref = (uintptr_t)ret_copy;
25950 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) {
25951 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25952 results_constr.datalen = results->arr_len;
25953 if (results_constr.datalen > 0)
25954 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25956 results_constr.data = NULL;
25957 uint32_t* results_vals = results->elems;
25958 for (size_t w = 0; w < results_constr.datalen; w++) {
25959 uint32_t results_conv_22 = results_vals[w];
25960 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
25961 CHECK_ACCESS(results_conv_22_ptr);
25962 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25963 results_constr.data[w] = results_conv_22_conv;
25966 LDKRouteParameters failed_paths_retry_conv;
25967 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
25968 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
25969 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25970 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25971 LDKThirtyTwoBytes payment_id_ref;
25972 CHECK(payment_id->arr_len == 32);
25973 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25974 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25975 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25976 uint32_t ret_ref = (uintptr_t)ret_copy;
25980 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
25981 LDKPhantomRouteHints this_obj_conv;
25982 this_obj_conv.inner = (void*)(this_obj & (~1));
25983 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25985 PhantomRouteHints_free(this_obj_conv);
25988 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
25989 LDKPhantomRouteHints this_ptr_conv;
25990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25991 this_ptr_conv.is_owned = false;
25992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25993 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
25994 uint32_tArray ret_arr = NULL;
25995 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
25996 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
25997 for (size_t q = 0; q < ret_var.datalen; q++) {
25998 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25999 uint32_t ret_conv_16_ref = 0;
26000 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26001 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26003 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26004 if (ret_conv_16_var.is_owned) {
26005 ret_conv_16_ref |= 1;
26007 ret_arr_ptr[q] = ret_conv_16_ref;
26010 FREE(ret_var.data);
26014 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
26015 LDKPhantomRouteHints this_ptr_conv;
26016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26017 this_ptr_conv.is_owned = false;
26018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26019 LDKCVec_ChannelDetailsZ val_constr;
26020 val_constr.datalen = val->arr_len;
26021 if (val_constr.datalen > 0)
26022 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26024 val_constr.data = NULL;
26025 uint32_t* val_vals = val->elems;
26026 for (size_t q = 0; q < val_constr.datalen; q++) {
26027 uint32_t val_conv_16 = val_vals[q];
26028 LDKChannelDetails val_conv_16_conv;
26029 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
26030 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
26031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
26032 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
26033 val_constr.data[q] = val_conv_16_conv;
26036 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
26039 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
26040 LDKPhantomRouteHints this_ptr_conv;
26041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26042 this_ptr_conv.is_owned = false;
26043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26044 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
26048 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
26049 LDKPhantomRouteHints this_ptr_conv;
26050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26051 this_ptr_conv.is_owned = false;
26052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26053 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
26056 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
26057 LDKPhantomRouteHints this_ptr_conv;
26058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26059 this_ptr_conv.is_owned = false;
26060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26061 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26062 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
26066 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
26067 LDKPhantomRouteHints this_ptr_conv;
26068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26069 this_ptr_conv.is_owned = false;
26070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26071 LDKPublicKey val_ref;
26072 CHECK(val->arr_len == 33);
26073 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26074 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
26077 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) {
26078 LDKCVec_ChannelDetailsZ channels_arg_constr;
26079 channels_arg_constr.datalen = channels_arg->arr_len;
26080 if (channels_arg_constr.datalen > 0)
26081 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26083 channels_arg_constr.data = NULL;
26084 uint32_t* channels_arg_vals = channels_arg->elems;
26085 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
26086 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
26087 LDKChannelDetails channels_arg_conv_16_conv;
26088 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
26089 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
26090 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
26091 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
26092 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
26094 FREE(channels_arg);
26095 LDKPublicKey real_node_pubkey_arg_ref;
26096 CHECK(real_node_pubkey_arg->arr_len == 33);
26097 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
26098 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
26099 uint32_t ret_ref = 0;
26100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26103 ret_ref = (uintptr_t)ret_var.inner;
26104 if (ret_var.is_owned) {
26110 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
26111 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
26112 uint32_t ret_ref = 0;
26113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26116 ret_ref = (uintptr_t)ret_var.inner;
26117 if (ret_var.is_owned) {
26122 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
26123 LDKPhantomRouteHints arg_conv;
26124 arg_conv.inner = (void*)(arg & (~1));
26125 arg_conv.is_owned = false;
26126 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26127 uint32_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
26131 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
26132 LDKPhantomRouteHints orig_conv;
26133 orig_conv.inner = (void*)(orig & (~1));
26134 orig_conv.is_owned = false;
26135 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26136 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
26137 uint32_t ret_ref = 0;
26138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26141 ret_ref = (uintptr_t)ret_var.inner;
26142 if (ret_var.is_owned) {
26148 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) {
26149 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
26150 CHECK_ACCESS(fee_est_ptr);
26151 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
26152 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
26153 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26154 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
26156 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
26157 CHECK_ACCESS(chain_monitor_ptr);
26158 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26159 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26160 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26161 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26163 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
26164 CHECK_ACCESS(tx_broadcaster_ptr);
26165 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26166 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26167 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26168 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26170 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26171 CHECK_ACCESS(logger_ptr);
26172 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26173 if (logger_conv.free == LDKLogger_JCalls_free) {
26174 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26175 LDKLogger_JCalls_cloned(&logger_conv);
26177 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26178 CHECK_ACCESS(keys_manager_ptr);
26179 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26180 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26181 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26182 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26184 LDKUserConfig config_conv;
26185 config_conv.inner = (void*)(config & (~1));
26186 config_conv.is_owned = (config & 1) || (config == 0);
26187 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26188 config_conv = UserConfig_clone(&config_conv);
26189 LDKChainParameters params_conv;
26190 params_conv.inner = (void*)(params & (~1));
26191 params_conv.is_owned = (params & 1) || (params == 0);
26192 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
26193 params_conv = ChainParameters_clone(¶ms_conv);
26194 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
26195 uint32_t ret_ref = 0;
26196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26199 ret_ref = (uintptr_t)ret_var.inner;
26200 if (ret_var.is_owned) {
26206 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
26207 LDKChannelManager this_arg_conv;
26208 this_arg_conv.inner = (void*)(this_arg & (~1));
26209 this_arg_conv.is_owned = false;
26210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26211 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
26212 uint32_t ret_ref = 0;
26213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26216 ret_ref = (uintptr_t)ret_var.inner;
26217 if (ret_var.is_owned) {
26223 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) {
26224 LDKChannelManager this_arg_conv;
26225 this_arg_conv.inner = (void*)(this_arg & (~1));
26226 this_arg_conv.is_owned = false;
26227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26228 LDKPublicKey their_network_key_ref;
26229 CHECK(their_network_key->arr_len == 33);
26230 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
26231 LDKUserConfig override_config_conv;
26232 override_config_conv.inner = (void*)(override_config & (~1));
26233 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
26234 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
26235 override_config_conv = UserConfig_clone(&override_config_conv);
26236 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
26237 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
26238 return (uint32_t)ret_conv;
26241 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
26242 LDKChannelManager this_arg_conv;
26243 this_arg_conv.inner = (void*)(this_arg & (~1));
26244 this_arg_conv.is_owned = false;
26245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26246 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
26247 uint32_tArray ret_arr = NULL;
26248 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26249 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26250 for (size_t q = 0; q < ret_var.datalen; q++) {
26251 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26252 uint32_t ret_conv_16_ref = 0;
26253 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26254 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26256 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26257 if (ret_conv_16_var.is_owned) {
26258 ret_conv_16_ref |= 1;
26260 ret_arr_ptr[q] = ret_conv_16_ref;
26263 FREE(ret_var.data);
26267 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
26268 LDKChannelManager this_arg_conv;
26269 this_arg_conv.inner = (void*)(this_arg & (~1));
26270 this_arg_conv.is_owned = false;
26271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26272 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
26273 uint32_tArray ret_arr = NULL;
26274 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26275 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26276 for (size_t q = 0; q < ret_var.datalen; q++) {
26277 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26278 uint32_t ret_conv_16_ref = 0;
26279 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26280 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26282 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26283 if (ret_conv_16_var.is_owned) {
26284 ret_conv_16_ref |= 1;
26286 ret_arr_ptr[q] = ret_conv_16_ref;
26289 FREE(ret_var.data);
26293 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
26294 LDKChannelManager this_arg_conv;
26295 this_arg_conv.inner = (void*)(this_arg & (~1));
26296 this_arg_conv.is_owned = false;
26297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26298 unsigned char channel_id_arr[32];
26299 CHECK(channel_id->arr_len == 32);
26300 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26301 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26302 LDKPublicKey counterparty_node_id_ref;
26303 CHECK(counterparty_node_id->arr_len == 33);
26304 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26305 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26306 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26307 return (uint32_t)ret_conv;
26310 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, int8_tArray counterparty_node_id, int32_t target_feerate_sats_per_1000_weight) {
26311 LDKChannelManager this_arg_conv;
26312 this_arg_conv.inner = (void*)(this_arg & (~1));
26313 this_arg_conv.is_owned = false;
26314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26315 unsigned char channel_id_arr[32];
26316 CHECK(channel_id->arr_len == 32);
26317 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26318 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26319 LDKPublicKey counterparty_node_id_ref;
26320 CHECK(counterparty_node_id->arr_len == 33);
26321 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26322 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26323 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
26324 return (uint32_t)ret_conv;
26327 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
26328 LDKChannelManager this_arg_conv;
26329 this_arg_conv.inner = (void*)(this_arg & (~1));
26330 this_arg_conv.is_owned = false;
26331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26332 unsigned char channel_id_arr[32];
26333 CHECK(channel_id->arr_len == 32);
26334 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26335 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26336 LDKPublicKey counterparty_node_id_ref;
26337 CHECK(counterparty_node_id->arr_len == 33);
26338 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26339 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26340 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26341 return (uint32_t)ret_conv;
26344 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
26345 LDKChannelManager this_arg_conv;
26346 this_arg_conv.inner = (void*)(this_arg & (~1));
26347 this_arg_conv.is_owned = false;
26348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26349 ChannelManager_force_close_all_channels(&this_arg_conv);
26352 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) {
26353 LDKChannelManager this_arg_conv;
26354 this_arg_conv.inner = (void*)(this_arg & (~1));
26355 this_arg_conv.is_owned = false;
26356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26357 LDKRoute route_conv;
26358 route_conv.inner = (void*)(route & (~1));
26359 route_conv.is_owned = false;
26360 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26361 LDKThirtyTwoBytes payment_hash_ref;
26362 CHECK(payment_hash->arr_len == 32);
26363 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26364 LDKThirtyTwoBytes payment_secret_ref;
26365 CHECK(payment_secret->arr_len == 32);
26366 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26367 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
26368 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
26369 return (uint32_t)ret_conv;
26372 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
26373 LDKChannelManager this_arg_conv;
26374 this_arg_conv.inner = (void*)(this_arg & (~1));
26375 this_arg_conv.is_owned = false;
26376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26377 LDKRoute route_conv;
26378 route_conv.inner = (void*)(route & (~1));
26379 route_conv.is_owned = false;
26380 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26381 LDKThirtyTwoBytes payment_id_ref;
26382 CHECK(payment_id->arr_len == 32);
26383 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26384 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
26385 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
26386 return (uint32_t)ret_conv;
26389 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
26390 LDKChannelManager this_arg_conv;
26391 this_arg_conv.inner = (void*)(this_arg & (~1));
26392 this_arg_conv.is_owned = false;
26393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26394 LDKThirtyTwoBytes payment_id_ref;
26395 CHECK(payment_id->arr_len == 32);
26396 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26397 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
26400 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) {
26401 LDKChannelManager this_arg_conv;
26402 this_arg_conv.inner = (void*)(this_arg & (~1));
26403 this_arg_conv.is_owned = false;
26404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26405 LDKRoute route_conv;
26406 route_conv.inner = (void*)(route & (~1));
26407 route_conv.is_owned = false;
26408 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26409 LDKThirtyTwoBytes payment_preimage_ref;
26410 CHECK(payment_preimage->arr_len == 32);
26411 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26412 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
26413 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
26414 return (uint32_t)ret_conv;
26417 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 counterparty_node_id, int8_tArray funding_transaction) {
26418 LDKChannelManager this_arg_conv;
26419 this_arg_conv.inner = (void*)(this_arg & (~1));
26420 this_arg_conv.is_owned = false;
26421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26422 unsigned char temporary_channel_id_arr[32];
26423 CHECK(temporary_channel_id->arr_len == 32);
26424 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26425 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26426 LDKPublicKey counterparty_node_id_ref;
26427 CHECK(counterparty_node_id->arr_len == 33);
26428 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26429 LDKTransaction funding_transaction_ref;
26430 funding_transaction_ref.datalen = funding_transaction->arr_len;
26431 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
26432 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
26433 funding_transaction_ref.data_is_owned = true;
26434 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26435 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
26436 return (uint32_t)ret_conv;
26439 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) {
26440 LDKChannelManager this_arg_conv;
26441 this_arg_conv.inner = (void*)(this_arg & (~1));
26442 this_arg_conv.is_owned = false;
26443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26444 LDKThreeBytes rgb_ref;
26445 CHECK(rgb->arr_len == 3);
26446 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
26447 LDKThirtyTwoBytes alias_ref;
26448 CHECK(alias->arr_len == 32);
26449 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
26450 LDKCVec_NetAddressZ addresses_constr;
26451 addresses_constr.datalen = addresses->arr_len;
26452 if (addresses_constr.datalen > 0)
26453 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26455 addresses_constr.data = NULL;
26456 uint32_t* addresses_vals = addresses->elems;
26457 for (size_t m = 0; m < addresses_constr.datalen; m++) {
26458 uint32_t addresses_conv_12 = addresses_vals[m];
26459 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
26460 CHECK_ACCESS(addresses_conv_12_ptr);
26461 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
26462 addresses_constr.data[m] = addresses_conv_12_conv;
26465 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
26468 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
26469 LDKChannelManager this_arg_conv;
26470 this_arg_conv.inner = (void*)(this_arg & (~1));
26471 this_arg_conv.is_owned = false;
26472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26473 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
26476 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
26477 LDKChannelManager this_arg_conv;
26478 this_arg_conv.inner = (void*)(this_arg & (~1));
26479 this_arg_conv.is_owned = false;
26480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26481 ChannelManager_timer_tick_occurred(&this_arg_conv);
26484 void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
26485 LDKChannelManager this_arg_conv;
26486 this_arg_conv.inner = (void*)(this_arg & (~1));
26487 this_arg_conv.is_owned = false;
26488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26489 unsigned char payment_hash_arr[32];
26490 CHECK(payment_hash->arr_len == 32);
26491 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
26492 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
26493 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
26496 void __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
26497 LDKChannelManager this_arg_conv;
26498 this_arg_conv.inner = (void*)(this_arg & (~1));
26499 this_arg_conv.is_owned = false;
26500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26501 LDKThirtyTwoBytes payment_preimage_ref;
26502 CHECK(payment_preimage->arr_len == 32);
26503 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26504 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
26507 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
26508 LDKChannelManager this_arg_conv;
26509 this_arg_conv.inner = (void*)(this_arg & (~1));
26510 this_arg_conv.is_owned = false;
26511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26512 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26513 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
26517 uint32_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
26518 LDKChannelManager this_arg_conv;
26519 this_arg_conv.inner = (void*)(this_arg & (~1));
26520 this_arg_conv.is_owned = false;
26521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26522 unsigned char temporary_channel_id_arr[32];
26523 CHECK(temporary_channel_id->arr_len == 32);
26524 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26525 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26526 LDKPublicKey counterparty_node_id_ref;
26527 CHECK(counterparty_node_id->arr_len == 33);
26528 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26529 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26530 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26531 return (uint32_t)ret_conv;
26534 uint32_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
26535 LDKChannelManager this_arg_conv;
26536 this_arg_conv.inner = (void*)(this_arg & (~1));
26537 this_arg_conv.is_owned = false;
26538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26539 unsigned char temporary_channel_id_arr[32];
26540 CHECK(temporary_channel_id->arr_len == 32);
26541 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26542 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26543 LDKPublicKey counterparty_node_id_ref;
26544 CHECK(counterparty_node_id->arr_len == 33);
26545 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26546 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26547 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26548 return (uint32_t)ret_conv;
26551 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) {
26552 LDKChannelManager this_arg_conv;
26553 this_arg_conv.inner = (void*)(this_arg & (~1));
26554 this_arg_conv.is_owned = false;
26555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26556 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26557 CHECK_ACCESS(min_value_msat_ptr);
26558 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26559 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26560 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26561 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26562 return (uint32_t)ret_conv;
26565 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) {
26566 LDKChannelManager this_arg_conv;
26567 this_arg_conv.inner = (void*)(this_arg & (~1));
26568 this_arg_conv.is_owned = false;
26569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26570 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26571 CHECK_ACCESS(min_value_msat_ptr);
26572 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26573 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26574 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
26575 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26576 return (uint32_t)ret_conv;
26579 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) {
26580 LDKChannelManager this_arg_conv;
26581 this_arg_conv.inner = (void*)(this_arg & (~1));
26582 this_arg_conv.is_owned = false;
26583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26584 LDKThirtyTwoBytes payment_hash_ref;
26585 CHECK(payment_hash->arr_len == 32);
26586 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26587 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26588 CHECK_ACCESS(min_value_msat_ptr);
26589 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26590 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26591 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26592 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26593 return (uint32_t)ret_conv;
26596 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) {
26597 LDKChannelManager this_arg_conv;
26598 this_arg_conv.inner = (void*)(this_arg & (~1));
26599 this_arg_conv.is_owned = false;
26600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26601 LDKThirtyTwoBytes payment_hash_ref;
26602 CHECK(payment_hash->arr_len == 32);
26603 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26604 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26605 CHECK_ACCESS(min_value_msat_ptr);
26606 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26607 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26608 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
26609 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26610 return (uint32_t)ret_conv;
26613 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) {
26614 LDKChannelManager this_arg_conv;
26615 this_arg_conv.inner = (void*)(this_arg & (~1));
26616 this_arg_conv.is_owned = false;
26617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26618 LDKThirtyTwoBytes payment_hash_ref;
26619 CHECK(payment_hash->arr_len == 32);
26620 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26621 LDKThirtyTwoBytes payment_secret_ref;
26622 CHECK(payment_secret->arr_len == 32);
26623 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26624 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
26625 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
26626 return (uint32_t)ret_conv;
26629 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
26630 LDKChannelManager this_arg_conv;
26631 this_arg_conv.inner = (void*)(this_arg & (~1));
26632 this_arg_conv.is_owned = false;
26633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26634 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
26638 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
26639 LDKChannelManager this_arg_conv;
26640 this_arg_conv.inner = (void*)(this_arg & (~1));
26641 this_arg_conv.is_owned = false;
26642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26643 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
26644 uint32_t ret_ref = 0;
26645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26648 ret_ref = (uintptr_t)ret_var.inner;
26649 if (ret_var.is_owned) {
26655 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
26656 LDKChannelManager this_arg_conv;
26657 this_arg_conv.inner = (void*)(this_arg & (~1));
26658 this_arg_conv.is_owned = false;
26659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26660 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26661 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
26662 return (uint32_t)ret_ret;
26665 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
26666 LDKChannelManager this_arg_conv;
26667 this_arg_conv.inner = (void*)(this_arg & (~1));
26668 this_arg_conv.is_owned = false;
26669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26670 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26671 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
26672 return (uint32_t)ret_ret;
26675 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
26676 LDKChannelManager this_arg_conv;
26677 this_arg_conv.inner = (void*)(this_arg & (~1));
26678 this_arg_conv.is_owned = false;
26679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26680 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26681 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
26682 return (uint32_t)ret_ret;
26685 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
26686 LDKChannelManager this_arg_conv;
26687 this_arg_conv.inner = (void*)(this_arg & (~1));
26688 this_arg_conv.is_owned = false;
26689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26690 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26691 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
26692 return (uint32_t)ret_ret;
26695 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
26696 LDKChannelManager this_arg_conv;
26697 this_arg_conv.inner = (void*)(this_arg & (~1));
26698 this_arg_conv.is_owned = false;
26699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26700 ChannelManager_await_persistable_update(&this_arg_conv);
26703 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
26704 LDKChannelManager this_arg_conv;
26705 this_arg_conv.inner = (void*)(this_arg & (~1));
26706 this_arg_conv.is_owned = false;
26707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26708 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
26709 uint32_t ret_ref = 0;
26710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26713 ret_ref = (uintptr_t)ret_var.inner;
26714 if (ret_var.is_owned) {
26720 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
26721 LDKChannelManager this_arg_conv;
26722 this_arg_conv.inner = (void*)(this_arg & (~1));
26723 this_arg_conv.is_owned = false;
26724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26725 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26726 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
26727 return (uint32_t)ret_ret;
26730 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
26731 LDKCounterpartyForwardingInfo obj_conv;
26732 obj_conv.inner = (void*)(obj & (~1));
26733 obj_conv.is_owned = false;
26734 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26735 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
26736 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26737 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26738 CVec_u8Z_free(ret_var);
26742 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
26743 LDKu8slice ser_ref;
26744 ser_ref.datalen = ser->arr_len;
26745 ser_ref.data = ser->elems;
26746 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26747 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
26749 return (uint32_t)ret_conv;
26752 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
26753 LDKChannelCounterparty obj_conv;
26754 obj_conv.inner = (void*)(obj & (~1));
26755 obj_conv.is_owned = false;
26756 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26757 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
26758 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26759 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26760 CVec_u8Z_free(ret_var);
26764 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
26765 LDKu8slice ser_ref;
26766 ser_ref.datalen = ser->arr_len;
26767 ser_ref.data = ser->elems;
26768 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26769 *ret_conv = ChannelCounterparty_read(ser_ref);
26771 return (uint32_t)ret_conv;
26774 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
26775 LDKChannelDetails obj_conv;
26776 obj_conv.inner = (void*)(obj & (~1));
26777 obj_conv.is_owned = false;
26778 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26779 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
26780 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26781 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26782 CVec_u8Z_free(ret_var);
26786 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
26787 LDKu8slice ser_ref;
26788 ser_ref.datalen = ser->arr_len;
26789 ser_ref.data = ser->elems;
26790 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26791 *ret_conv = ChannelDetails_read(ser_ref);
26793 return (uint32_t)ret_conv;
26796 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
26797 LDKPhantomRouteHints obj_conv;
26798 obj_conv.inner = (void*)(obj & (~1));
26799 obj_conv.is_owned = false;
26800 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26801 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
26802 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26803 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26804 CVec_u8Z_free(ret_var);
26808 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
26809 LDKu8slice ser_ref;
26810 ser_ref.datalen = ser->arr_len;
26811 ser_ref.data = ser->elems;
26812 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26813 *ret_conv = PhantomRouteHints_read(ser_ref);
26815 return (uint32_t)ret_conv;
26818 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
26819 LDKChannelManager obj_conv;
26820 obj_conv.inner = (void*)(obj & (~1));
26821 obj_conv.is_owned = false;
26822 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26823 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
26824 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26825 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26826 CVec_u8Z_free(ret_var);
26830 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
26831 LDKChannelManagerReadArgs this_obj_conv;
26832 this_obj_conv.inner = (void*)(this_obj & (~1));
26833 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26835 ChannelManagerReadArgs_free(this_obj_conv);
26838 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
26839 LDKChannelManagerReadArgs this_ptr_conv;
26840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26841 this_ptr_conv.is_owned = false;
26842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26843 // WARNING: This object doesn't live past this scope, needs clone!
26844 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
26848 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
26849 LDKChannelManagerReadArgs this_ptr_conv;
26850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26851 this_ptr_conv.is_owned = false;
26852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26853 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26854 CHECK_ACCESS(val_ptr);
26855 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
26856 if (val_conv.free == LDKKeysInterface_JCalls_free) {
26857 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26858 LDKKeysInterface_JCalls_cloned(&val_conv);
26860 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
26863 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
26864 LDKChannelManagerReadArgs this_ptr_conv;
26865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26866 this_ptr_conv.is_owned = false;
26867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26868 // WARNING: This object doesn't live past this scope, needs clone!
26869 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
26873 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
26874 LDKChannelManagerReadArgs this_ptr_conv;
26875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26876 this_ptr_conv.is_owned = false;
26877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26878 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26879 CHECK_ACCESS(val_ptr);
26880 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
26881 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
26882 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26883 LDKFeeEstimator_JCalls_cloned(&val_conv);
26885 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
26888 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
26889 LDKChannelManagerReadArgs this_ptr_conv;
26890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26891 this_ptr_conv.is_owned = false;
26892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26893 // WARNING: This object doesn't live past this scope, needs clone!
26894 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
26898 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
26899 LDKChannelManagerReadArgs this_ptr_conv;
26900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26901 this_ptr_conv.is_owned = false;
26902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26903 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26904 CHECK_ACCESS(val_ptr);
26905 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
26906 if (val_conv.free == LDKWatch_JCalls_free) {
26907 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26908 LDKWatch_JCalls_cloned(&val_conv);
26910 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
26913 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
26914 LDKChannelManagerReadArgs this_ptr_conv;
26915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26916 this_ptr_conv.is_owned = false;
26917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26918 // WARNING: This object doesn't live past this scope, needs clone!
26919 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
26923 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
26924 LDKChannelManagerReadArgs 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26929 CHECK_ACCESS(val_ptr);
26930 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
26931 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
26932 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26933 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
26935 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
26938 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
26939 LDKChannelManagerReadArgs this_ptr_conv;
26940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26941 this_ptr_conv.is_owned = false;
26942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26943 // WARNING: This object doesn't live past this scope, needs clone!
26944 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
26948 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
26949 LDKChannelManagerReadArgs this_ptr_conv;
26950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26951 this_ptr_conv.is_owned = false;
26952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26953 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26954 CHECK_ACCESS(val_ptr);
26955 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
26956 if (val_conv.free == LDKLogger_JCalls_free) {
26957 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26958 LDKLogger_JCalls_cloned(&val_conv);
26960 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
26963 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
26964 LDKChannelManagerReadArgs this_ptr_conv;
26965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26966 this_ptr_conv.is_owned = false;
26967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26968 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
26969 uint32_t ret_ref = 0;
26970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26973 ret_ref = (uintptr_t)ret_var.inner;
26974 if (ret_var.is_owned) {
26980 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
26981 LDKChannelManagerReadArgs this_ptr_conv;
26982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26983 this_ptr_conv.is_owned = false;
26984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26985 LDKUserConfig val_conv;
26986 val_conv.inner = (void*)(val & (~1));
26987 val_conv.is_owned = (val & 1) || (val == 0);
26988 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26989 val_conv = UserConfig_clone(&val_conv);
26990 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
26993 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) {
26994 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26995 CHECK_ACCESS(keys_manager_ptr);
26996 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26997 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26998 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26999 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27001 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27002 CHECK_ACCESS(fee_estimator_ptr);
27003 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27004 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27005 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27006 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27008 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
27009 CHECK_ACCESS(chain_monitor_ptr);
27010 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27011 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27012 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27013 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27015 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
27016 CHECK_ACCESS(tx_broadcaster_ptr);
27017 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27018 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27019 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27020 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27022 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27023 CHECK_ACCESS(logger_ptr);
27024 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27025 if (logger_conv.free == LDKLogger_JCalls_free) {
27026 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27027 LDKLogger_JCalls_cloned(&logger_conv);
27029 LDKUserConfig default_config_conv;
27030 default_config_conv.inner = (void*)(default_config & (~1));
27031 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
27032 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
27033 default_config_conv = UserConfig_clone(&default_config_conv);
27034 LDKCVec_ChannelMonitorZ channel_monitors_constr;
27035 channel_monitors_constr.datalen = channel_monitors->arr_len;
27036 if (channel_monitors_constr.datalen > 0)
27037 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
27039 channel_monitors_constr.data = NULL;
27040 uint32_t* channel_monitors_vals = channel_monitors->elems;
27041 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
27042 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
27043 LDKChannelMonitor channel_monitors_conv_16_conv;
27044 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
27045 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
27046 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
27047 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
27049 FREE(channel_monitors);
27050 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);
27051 uint32_t ret_ref = 0;
27052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27055 ret_ref = (uintptr_t)ret_var.inner;
27056 if (ret_var.is_owned) {
27062 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
27063 LDKu8slice ser_ref;
27064 ser_ref.datalen = ser->arr_len;
27065 ser_ref.data = ser->elems;
27066 LDKChannelManagerReadArgs arg_conv;
27067 arg_conv.inner = (void*)(arg & (~1));
27068 arg_conv.is_owned = (arg & 1) || (arg == 0);
27069 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27070 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
27071 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
27072 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
27074 return (uint32_t)ret_conv;
27077 void __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint32_t this_obj) {
27078 LDKExpandedKey this_obj_conv;
27079 this_obj_conv.inner = (void*)(this_obj & (~1));
27080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27082 ExpandedKey_free(this_obj_conv);
27085 uint32_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
27086 unsigned char key_material_arr[32];
27087 CHECK(key_material->arr_len == 32);
27088 memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
27089 unsigned char (*key_material_ref)[32] = &key_material_arr;
27090 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
27091 uint32_t ret_ref = 0;
27092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27095 ret_ref = (uintptr_t)ret_var.inner;
27096 if (ret_var.is_owned) {
27102 uint32_t __attribute__((export_name("TS_create"))) TS_create(uint32_t keys, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, uint32_t keys_manager, int64_t current_time) {
27103 LDKExpandedKey keys_conv;
27104 keys_conv.inner = (void*)(keys & (~1));
27105 keys_conv.is_owned = false;
27106 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27107 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27108 CHECK_ACCESS(min_value_msat_ptr);
27109 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27110 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27111 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
27112 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
27113 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
27114 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27115 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
27116 return (uint32_t)ret_conv;
27119 uint32_t __attribute__((export_name("TS_create_from_hash"))) TS_create_from_hash(uint32_t keys, uint32_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) {
27120 LDKExpandedKey keys_conv;
27121 keys_conv.inner = (void*)(keys & (~1));
27122 keys_conv.is_owned = false;
27123 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27124 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27125 CHECK_ACCESS(min_value_msat_ptr);
27126 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27127 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27128 LDKThirtyTwoBytes payment_hash_ref;
27129 CHECK(payment_hash->arr_len == 32);
27130 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27131 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27132 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
27133 return (uint32_t)ret_conv;
27136 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
27137 LDKDecodeError this_obj_conv;
27138 this_obj_conv.inner = (void*)(this_obj & (~1));
27139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27141 DecodeError_free(this_obj_conv);
27144 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
27145 LDKDecodeError ret_var = DecodeError_clone(arg);
27146 uint32_t ret_ref = 0;
27147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27150 ret_ref = (uintptr_t)ret_var.inner;
27151 if (ret_var.is_owned) {
27156 uint32_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
27157 LDKDecodeError arg_conv;
27158 arg_conv.inner = (void*)(arg & (~1));
27159 arg_conv.is_owned = false;
27160 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27161 uint32_t ret_conv = DecodeError_clone_ptr(&arg_conv);
27165 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
27166 LDKDecodeError orig_conv;
27167 orig_conv.inner = (void*)(orig & (~1));
27168 orig_conv.is_owned = false;
27169 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27170 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
27171 uint32_t ret_ref = 0;
27172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27175 ret_ref = (uintptr_t)ret_var.inner;
27176 if (ret_var.is_owned) {
27182 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
27183 LDKInit this_obj_conv;
27184 this_obj_conv.inner = (void*)(this_obj & (~1));
27185 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27187 Init_free(this_obj_conv);
27190 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
27191 LDKInit this_ptr_conv;
27192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27193 this_ptr_conv.is_owned = false;
27194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27195 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
27196 uint32_t ret_ref = 0;
27197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27200 ret_ref = (uintptr_t)ret_var.inner;
27201 if (ret_var.is_owned) {
27207 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
27208 LDKInit this_ptr_conv;
27209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27210 this_ptr_conv.is_owned = false;
27211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27212 LDKInitFeatures val_conv;
27213 val_conv.inner = (void*)(val & (~1));
27214 val_conv.is_owned = (val & 1) || (val == 0);
27215 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27216 val_conv = InitFeatures_clone(&val_conv);
27217 Init_set_features(&this_ptr_conv, val_conv);
27220 uint32_t __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint32_t this_ptr) {
27221 LDKInit this_ptr_conv;
27222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27223 this_ptr_conv.is_owned = false;
27224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27225 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
27226 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
27227 uint32_t ret_ref = (uintptr_t)ret_copy;
27231 void __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint32_t this_ptr, uint32_t val) {
27232 LDKInit this_ptr_conv;
27233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27234 this_ptr_conv.is_owned = false;
27235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27236 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27237 CHECK_ACCESS(val_ptr);
27238 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
27239 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
27240 Init_set_remote_network_address(&this_ptr_conv, val_conv);
27243 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg, uint32_t remote_network_address_arg) {
27244 LDKInitFeatures features_arg_conv;
27245 features_arg_conv.inner = (void*)(features_arg & (~1));
27246 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27247 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27248 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27249 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
27250 CHECK_ACCESS(remote_network_address_arg_ptr);
27251 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
27252 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
27253 uint32_t ret_ref = 0;
27254 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27255 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27257 ret_ref = (uintptr_t)ret_var.inner;
27258 if (ret_var.is_owned) {
27264 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
27265 LDKInit ret_var = Init_clone(arg);
27266 uint32_t ret_ref = 0;
27267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27270 ret_ref = (uintptr_t)ret_var.inner;
27271 if (ret_var.is_owned) {
27276 uint32_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
27278 arg_conv.inner = (void*)(arg & (~1));
27279 arg_conv.is_owned = false;
27280 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27281 uint32_t ret_conv = Init_clone_ptr(&arg_conv);
27285 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
27287 orig_conv.inner = (void*)(orig & (~1));
27288 orig_conv.is_owned = false;
27289 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27290 LDKInit ret_var = Init_clone(&orig_conv);
27291 uint32_t ret_ref = 0;
27292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27295 ret_ref = (uintptr_t)ret_var.inner;
27296 if (ret_var.is_owned) {
27302 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
27303 LDKErrorMessage this_obj_conv;
27304 this_obj_conv.inner = (void*)(this_obj & (~1));
27305 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27307 ErrorMessage_free(this_obj_conv);
27310 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
27311 LDKErrorMessage this_ptr_conv;
27312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27313 this_ptr_conv.is_owned = false;
27314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27315 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27316 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
27320 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27321 LDKErrorMessage this_ptr_conv;
27322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27323 this_ptr_conv.is_owned = false;
27324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27325 LDKThirtyTwoBytes val_ref;
27326 CHECK(val->arr_len == 32);
27327 memcpy(val_ref.data, val->elems, 32); FREE(val);
27328 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
27331 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
27332 LDKErrorMessage this_ptr_conv;
27333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27334 this_ptr_conv.is_owned = false;
27335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27336 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
27337 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27342 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
27343 LDKErrorMessage this_ptr_conv;
27344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27345 this_ptr_conv.is_owned = false;
27346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27347 LDKStr val_conv = str_ref_to_owned_c(val);
27348 ErrorMessage_set_data(&this_ptr_conv, val_conv);
27351 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27352 LDKThirtyTwoBytes channel_id_arg_ref;
27353 CHECK(channel_id_arg->arr_len == 32);
27354 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27355 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27356 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
27357 uint32_t ret_ref = 0;
27358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27361 ret_ref = (uintptr_t)ret_var.inner;
27362 if (ret_var.is_owned) {
27368 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
27369 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
27370 uint32_t ret_ref = 0;
27371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27374 ret_ref = (uintptr_t)ret_var.inner;
27375 if (ret_var.is_owned) {
27380 uint32_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
27381 LDKErrorMessage arg_conv;
27382 arg_conv.inner = (void*)(arg & (~1));
27383 arg_conv.is_owned = false;
27384 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27385 uint32_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
27389 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
27390 LDKErrorMessage orig_conv;
27391 orig_conv.inner = (void*)(orig & (~1));
27392 orig_conv.is_owned = false;
27393 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27394 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
27395 uint32_t ret_ref = 0;
27396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27399 ret_ref = (uintptr_t)ret_var.inner;
27400 if (ret_var.is_owned) {
27406 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
27407 LDKWarningMessage this_obj_conv;
27408 this_obj_conv.inner = (void*)(this_obj & (~1));
27409 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27411 WarningMessage_free(this_obj_conv);
27414 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
27415 LDKWarningMessage this_ptr_conv;
27416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27417 this_ptr_conv.is_owned = false;
27418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27419 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27420 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
27424 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27425 LDKWarningMessage this_ptr_conv;
27426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27427 this_ptr_conv.is_owned = false;
27428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27429 LDKThirtyTwoBytes val_ref;
27430 CHECK(val->arr_len == 32);
27431 memcpy(val_ref.data, val->elems, 32); FREE(val);
27432 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
27435 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
27436 LDKWarningMessage this_ptr_conv;
27437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27438 this_ptr_conv.is_owned = false;
27439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27440 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
27441 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27446 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
27447 LDKWarningMessage this_ptr_conv;
27448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27449 this_ptr_conv.is_owned = false;
27450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27451 LDKStr val_conv = str_ref_to_owned_c(val);
27452 WarningMessage_set_data(&this_ptr_conv, val_conv);
27455 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27456 LDKThirtyTwoBytes channel_id_arg_ref;
27457 CHECK(channel_id_arg->arr_len == 32);
27458 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27459 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27460 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
27461 uint32_t ret_ref = 0;
27462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27465 ret_ref = (uintptr_t)ret_var.inner;
27466 if (ret_var.is_owned) {
27472 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
27473 LDKWarningMessage ret_var = WarningMessage_clone(arg);
27474 uint32_t ret_ref = 0;
27475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27478 ret_ref = (uintptr_t)ret_var.inner;
27479 if (ret_var.is_owned) {
27484 uint32_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
27485 LDKWarningMessage arg_conv;
27486 arg_conv.inner = (void*)(arg & (~1));
27487 arg_conv.is_owned = false;
27488 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27489 uint32_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
27493 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
27494 LDKWarningMessage orig_conv;
27495 orig_conv.inner = (void*)(orig & (~1));
27496 orig_conv.is_owned = false;
27497 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27498 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
27499 uint32_t ret_ref = 0;
27500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27503 ret_ref = (uintptr_t)ret_var.inner;
27504 if (ret_var.is_owned) {
27510 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
27511 LDKPing this_obj_conv;
27512 this_obj_conv.inner = (void*)(this_obj & (~1));
27513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27515 Ping_free(this_obj_conv);
27518 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
27519 LDKPing this_ptr_conv;
27520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27521 this_ptr_conv.is_owned = false;
27522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27523 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
27527 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
27528 LDKPing this_ptr_conv;
27529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27530 this_ptr_conv.is_owned = false;
27531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27532 Ping_set_ponglen(&this_ptr_conv, val);
27535 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
27536 LDKPing this_ptr_conv;
27537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27538 this_ptr_conv.is_owned = false;
27539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27540 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
27544 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
27545 LDKPing this_ptr_conv;
27546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27547 this_ptr_conv.is_owned = false;
27548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27549 Ping_set_byteslen(&this_ptr_conv, val);
27552 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
27553 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27554 uint32_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) {
27565 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27566 LDKPing ret_var = Ping_clone(arg);
27567 uint32_t ret_ref = 0;
27568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27571 ret_ref = (uintptr_t)ret_var.inner;
27572 if (ret_var.is_owned) {
27577 uint32_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
27579 arg_conv.inner = (void*)(arg & (~1));
27580 arg_conv.is_owned = false;
27581 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27582 uint32_t ret_conv = Ping_clone_ptr(&arg_conv);
27586 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
27588 orig_conv.inner = (void*)(orig & (~1));
27589 orig_conv.is_owned = false;
27590 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27591 LDKPing ret_var = Ping_clone(&orig_conv);
27592 uint32_t ret_ref = 0;
27593 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27594 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27596 ret_ref = (uintptr_t)ret_var.inner;
27597 if (ret_var.is_owned) {
27603 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
27604 LDKPong this_obj_conv;
27605 this_obj_conv.inner = (void*)(this_obj & (~1));
27606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27608 Pong_free(this_obj_conv);
27611 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
27612 LDKPong this_ptr_conv;
27613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27614 this_ptr_conv.is_owned = false;
27615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27616 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
27620 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
27621 LDKPong this_ptr_conv;
27622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27623 this_ptr_conv.is_owned = false;
27624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27625 Pong_set_byteslen(&this_ptr_conv, val);
27628 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
27629 LDKPong ret_var = Pong_new(byteslen_arg);
27630 uint32_t ret_ref = 0;
27631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27634 ret_ref = (uintptr_t)ret_var.inner;
27635 if (ret_var.is_owned) {
27641 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27642 LDKPong ret_var = Pong_clone(arg);
27643 uint32_t ret_ref = 0;
27644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27647 ret_ref = (uintptr_t)ret_var.inner;
27648 if (ret_var.is_owned) {
27653 uint32_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
27655 arg_conv.inner = (void*)(arg & (~1));
27656 arg_conv.is_owned = false;
27657 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27658 uint32_t ret_conv = Pong_clone_ptr(&arg_conv);
27662 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
27664 orig_conv.inner = (void*)(orig & (~1));
27665 orig_conv.is_owned = false;
27666 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27667 LDKPong ret_var = Pong_clone(&orig_conv);
27668 uint32_t ret_ref = 0;
27669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27672 ret_ref = (uintptr_t)ret_var.inner;
27673 if (ret_var.is_owned) {
27679 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
27680 LDKOpenChannel this_obj_conv;
27681 this_obj_conv.inner = (void*)(this_obj & (~1));
27682 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27684 OpenChannel_free(this_obj_conv);
27687 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
27688 LDKOpenChannel this_ptr_conv;
27689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27690 this_ptr_conv.is_owned = false;
27691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27692 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27693 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
27697 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
27698 LDKOpenChannel this_ptr_conv;
27699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27700 this_ptr_conv.is_owned = false;
27701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27702 LDKThirtyTwoBytes val_ref;
27703 CHECK(val->arr_len == 32);
27704 memcpy(val_ref.data, val->elems, 32); FREE(val);
27705 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
27708 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
27709 LDKOpenChannel this_ptr_conv;
27710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27711 this_ptr_conv.is_owned = false;
27712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27713 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27714 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27718 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
27719 LDKOpenChannel this_ptr_conv;
27720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27721 this_ptr_conv.is_owned = false;
27722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27723 LDKThirtyTwoBytes val_ref;
27724 CHECK(val->arr_len == 32);
27725 memcpy(val_ref.data, val->elems, 32); FREE(val);
27726 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27729 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
27730 LDKOpenChannel this_ptr_conv;
27731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27732 this_ptr_conv.is_owned = false;
27733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27734 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
27738 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
27739 LDKOpenChannel this_ptr_conv;
27740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27741 this_ptr_conv.is_owned = false;
27742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27743 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
27746 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
27747 LDKOpenChannel this_ptr_conv;
27748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27749 this_ptr_conv.is_owned = false;
27750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27751 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
27755 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
27756 LDKOpenChannel this_ptr_conv;
27757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27758 this_ptr_conv.is_owned = false;
27759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27760 OpenChannel_set_push_msat(&this_ptr_conv, val);
27763 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
27764 LDKOpenChannel this_ptr_conv;
27765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27766 this_ptr_conv.is_owned = false;
27767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27768 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
27772 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
27773 LDKOpenChannel this_ptr_conv;
27774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27775 this_ptr_conv.is_owned = false;
27776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27777 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27780 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) {
27781 LDKOpenChannel this_ptr_conv;
27782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27783 this_ptr_conv.is_owned = false;
27784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27785 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27789 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) {
27790 LDKOpenChannel this_ptr_conv;
27791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27792 this_ptr_conv.is_owned = false;
27793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27794 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27797 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
27798 LDKOpenChannel this_ptr_conv;
27799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27800 this_ptr_conv.is_owned = false;
27801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27802 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27806 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
27807 LDKOpenChannel this_ptr_conv;
27808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27809 this_ptr_conv.is_owned = false;
27810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27811 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27814 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
27815 LDKOpenChannel this_ptr_conv;
27816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27817 this_ptr_conv.is_owned = false;
27818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27819 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
27823 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
27824 LDKOpenChannel this_ptr_conv;
27825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27826 this_ptr_conv.is_owned = false;
27827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27828 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27831 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
27832 LDKOpenChannel this_ptr_conv;
27833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27834 this_ptr_conv.is_owned = false;
27835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27836 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
27840 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
27841 LDKOpenChannel this_ptr_conv;
27842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27843 this_ptr_conv.is_owned = false;
27844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27845 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
27848 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
27849 LDKOpenChannel this_ptr_conv;
27850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27851 this_ptr_conv.is_owned = false;
27852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27853 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
27857 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
27858 LDKOpenChannel this_ptr_conv;
27859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27860 this_ptr_conv.is_owned = false;
27861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27862 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
27865 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
27866 LDKOpenChannel this_ptr_conv;
27867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27868 this_ptr_conv.is_owned = false;
27869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27870 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
27874 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
27875 LDKOpenChannel this_ptr_conv;
27876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27877 this_ptr_conv.is_owned = false;
27878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27879 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27882 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
27883 LDKOpenChannel 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27888 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27892 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
27893 LDKOpenChannel this_ptr_conv;
27894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27895 this_ptr_conv.is_owned = false;
27896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27897 LDKPublicKey val_ref;
27898 CHECK(val->arr_len == 33);
27899 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27900 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27903 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
27904 LDKOpenChannel this_ptr_conv;
27905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27906 this_ptr_conv.is_owned = false;
27907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27908 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27909 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27913 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
27914 LDKOpenChannel this_ptr_conv;
27915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27916 this_ptr_conv.is_owned = false;
27917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27918 LDKPublicKey val_ref;
27919 CHECK(val->arr_len == 33);
27920 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27921 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27924 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
27925 LDKOpenChannel this_ptr_conv;
27926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27927 this_ptr_conv.is_owned = false;
27928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27929 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27930 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27934 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
27935 LDKOpenChannel this_ptr_conv;
27936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27937 this_ptr_conv.is_owned = false;
27938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27939 LDKPublicKey val_ref;
27940 CHECK(val->arr_len == 33);
27941 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27942 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
27945 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
27946 LDKOpenChannel 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(33, __LINE__);
27951 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27955 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
27956 LDKOpenChannel 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 LDKPublicKey val_ref;
27961 CHECK(val->arr_len == 33);
27962 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27963 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27966 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
27967 LDKOpenChannel 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27972 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27976 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
27977 LDKOpenChannel this_ptr_conv;
27978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27979 this_ptr_conv.is_owned = false;
27980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27981 LDKPublicKey val_ref;
27982 CHECK(val->arr_len == 33);
27983 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27984 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27987 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
27988 LDKOpenChannel this_ptr_conv;
27989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27990 this_ptr_conv.is_owned = false;
27991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27992 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27993 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27997 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) {
27998 LDKOpenChannel this_ptr_conv;
27999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28000 this_ptr_conv.is_owned = false;
28001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28002 LDKPublicKey val_ref;
28003 CHECK(val->arr_len == 33);
28004 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28005 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28008 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
28009 LDKOpenChannel this_ptr_conv;
28010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28011 this_ptr_conv.is_owned = false;
28012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28013 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
28017 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
28018 LDKOpenChannel this_ptr_conv;
28019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28020 this_ptr_conv.is_owned = false;
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022 OpenChannel_set_channel_flags(&this_ptr_conv, val);
28025 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
28026 LDKOpenChannel this_ptr_conv;
28027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28028 this_ptr_conv.is_owned = false;
28029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28030 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
28031 uint32_t ret_ref = 0;
28032 if ((uintptr_t)ret_var.inner > 4096) {
28033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28036 ret_ref = (uintptr_t)ret_var.inner;
28037 if (ret_var.is_owned) {
28044 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
28045 LDKOpenChannel this_ptr_conv;
28046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28047 this_ptr_conv.is_owned = false;
28048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28049 LDKChannelTypeFeatures val_conv;
28050 val_conv.inner = (void*)(val & (~1));
28051 val_conv.is_owned = (val & 1) || (val == 0);
28052 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28053 val_conv = ChannelTypeFeatures_clone(&val_conv);
28054 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
28057 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
28058 LDKOpenChannel ret_var = OpenChannel_clone(arg);
28059 uint32_t ret_ref = 0;
28060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28063 ret_ref = (uintptr_t)ret_var.inner;
28064 if (ret_var.is_owned) {
28069 uint32_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
28070 LDKOpenChannel arg_conv;
28071 arg_conv.inner = (void*)(arg & (~1));
28072 arg_conv.is_owned = false;
28073 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28074 uint32_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
28078 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
28079 LDKOpenChannel orig_conv;
28080 orig_conv.inner = (void*)(orig & (~1));
28081 orig_conv.is_owned = false;
28082 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28083 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
28084 uint32_t ret_ref = 0;
28085 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28086 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28088 ret_ref = (uintptr_t)ret_var.inner;
28089 if (ret_var.is_owned) {
28095 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
28096 LDKAcceptChannel this_obj_conv;
28097 this_obj_conv.inner = (void*)(this_obj & (~1));
28098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28100 AcceptChannel_free(this_obj_conv);
28103 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
28104 LDKAcceptChannel this_ptr_conv;
28105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28106 this_ptr_conv.is_owned = false;
28107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28108 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28109 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28113 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28114 LDKAcceptChannel this_ptr_conv;
28115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28116 this_ptr_conv.is_owned = false;
28117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28118 LDKThirtyTwoBytes val_ref;
28119 CHECK(val->arr_len == 32);
28120 memcpy(val_ref.data, val->elems, 32); FREE(val);
28121 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28124 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
28125 LDKAcceptChannel this_ptr_conv;
28126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28127 this_ptr_conv.is_owned = false;
28128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28129 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
28133 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
28134 LDKAcceptChannel this_ptr_conv;
28135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28136 this_ptr_conv.is_owned = false;
28137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28138 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28141 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) {
28142 LDKAcceptChannel this_ptr_conv;
28143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28144 this_ptr_conv.is_owned = false;
28145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28146 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28150 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) {
28151 LDKAcceptChannel this_ptr_conv;
28152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28153 this_ptr_conv.is_owned = false;
28154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28155 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28158 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
28159 LDKAcceptChannel this_ptr_conv;
28160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28161 this_ptr_conv.is_owned = false;
28162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28163 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28167 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
28168 LDKAcceptChannel this_ptr_conv;
28169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28170 this_ptr_conv.is_owned = false;
28171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28172 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28175 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
28176 LDKAcceptChannel this_ptr_conv;
28177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28178 this_ptr_conv.is_owned = false;
28179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28180 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
28184 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
28185 LDKAcceptChannel this_ptr_conv;
28186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28187 this_ptr_conv.is_owned = false;
28188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28189 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28192 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
28193 LDKAcceptChannel this_ptr_conv;
28194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28195 this_ptr_conv.is_owned = false;
28196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28197 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
28201 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
28202 LDKAcceptChannel this_ptr_conv;
28203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28204 this_ptr_conv.is_owned = false;
28205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28206 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
28209 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
28210 LDKAcceptChannel this_ptr_conv;
28211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28212 this_ptr_conv.is_owned = false;
28213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28214 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
28218 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
28219 LDKAcceptChannel this_ptr_conv;
28220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28221 this_ptr_conv.is_owned = false;
28222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28223 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
28226 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
28227 LDKAcceptChannel this_ptr_conv;
28228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28229 this_ptr_conv.is_owned = false;
28230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28231 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
28235 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
28236 LDKAcceptChannel this_ptr_conv;
28237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28238 this_ptr_conv.is_owned = false;
28239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28240 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28243 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
28244 LDKAcceptChannel this_ptr_conv;
28245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28246 this_ptr_conv.is_owned = false;
28247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28248 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28249 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28253 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28254 LDKAcceptChannel this_ptr_conv;
28255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28256 this_ptr_conv.is_owned = false;
28257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28258 LDKPublicKey val_ref;
28259 CHECK(val->arr_len == 33);
28260 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28261 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28264 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
28265 LDKAcceptChannel this_ptr_conv;
28266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28267 this_ptr_conv.is_owned = false;
28268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28269 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28270 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28274 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28275 LDKAcceptChannel this_ptr_conv;
28276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28277 this_ptr_conv.is_owned = false;
28278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28279 LDKPublicKey val_ref;
28280 CHECK(val->arr_len == 33);
28281 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28282 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28285 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
28286 LDKAcceptChannel this_ptr_conv;
28287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28288 this_ptr_conv.is_owned = false;
28289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28290 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28291 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28295 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28296 LDKAcceptChannel this_ptr_conv;
28297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28298 this_ptr_conv.is_owned = false;
28299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28300 LDKPublicKey val_ref;
28301 CHECK(val->arr_len == 33);
28302 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28303 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
28306 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
28307 LDKAcceptChannel this_ptr_conv;
28308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28309 this_ptr_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28311 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28312 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28316 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28317 LDKAcceptChannel this_ptr_conv;
28318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28319 this_ptr_conv.is_owned = false;
28320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28321 LDKPublicKey val_ref;
28322 CHECK(val->arr_len == 33);
28323 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28324 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28327 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
28328 LDKAcceptChannel this_ptr_conv;
28329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28330 this_ptr_conv.is_owned = false;
28331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28332 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28333 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28337 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28338 LDKAcceptChannel this_ptr_conv;
28339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28340 this_ptr_conv.is_owned = false;
28341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28342 LDKPublicKey val_ref;
28343 CHECK(val->arr_len == 33);
28344 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28345 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28348 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
28349 LDKAcceptChannel this_ptr_conv;
28350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28351 this_ptr_conv.is_owned = false;
28352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28353 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28354 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28358 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) {
28359 LDKAcceptChannel this_ptr_conv;
28360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28361 this_ptr_conv.is_owned = false;
28362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28363 LDKPublicKey val_ref;
28364 CHECK(val->arr_len == 33);
28365 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28366 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28369 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
28370 LDKAcceptChannel this_ptr_conv;
28371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28372 this_ptr_conv.is_owned = false;
28373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28374 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
28375 uint32_t ret_ref = 0;
28376 if ((uintptr_t)ret_var.inner > 4096) {
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) {
28388 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
28389 LDKAcceptChannel this_ptr_conv;
28390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28391 this_ptr_conv.is_owned = false;
28392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28393 LDKChannelTypeFeatures val_conv;
28394 val_conv.inner = (void*)(val & (~1));
28395 val_conv.is_owned = (val & 1) || (val == 0);
28396 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28397 val_conv = ChannelTypeFeatures_clone(&val_conv);
28398 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
28401 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28402 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
28403 uint32_t ret_ref = 0;
28404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28407 ret_ref = (uintptr_t)ret_var.inner;
28408 if (ret_var.is_owned) {
28413 uint32_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
28414 LDKAcceptChannel arg_conv;
28415 arg_conv.inner = (void*)(arg & (~1));
28416 arg_conv.is_owned = false;
28417 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28418 uint32_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
28422 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
28423 LDKAcceptChannel orig_conv;
28424 orig_conv.inner = (void*)(orig & (~1));
28425 orig_conv.is_owned = false;
28426 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28427 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28428 uint32_t ret_ref = 0;
28429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28432 ret_ref = (uintptr_t)ret_var.inner;
28433 if (ret_var.is_owned) {
28439 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
28440 LDKFundingCreated this_obj_conv;
28441 this_obj_conv.inner = (void*)(this_obj & (~1));
28442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28444 FundingCreated_free(this_obj_conv);
28447 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
28448 LDKFundingCreated this_ptr_conv;
28449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28450 this_ptr_conv.is_owned = false;
28451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28452 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28453 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
28457 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28458 LDKFundingCreated this_ptr_conv;
28459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28460 this_ptr_conv.is_owned = false;
28461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28462 LDKThirtyTwoBytes val_ref;
28463 CHECK(val->arr_len == 32);
28464 memcpy(val_ref.data, val->elems, 32); FREE(val);
28465 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28468 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
28469 LDKFundingCreated this_ptr_conv;
28470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28471 this_ptr_conv.is_owned = false;
28472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28473 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28474 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
28478 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
28479 LDKFundingCreated this_ptr_conv;
28480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28481 this_ptr_conv.is_owned = false;
28482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28483 LDKThirtyTwoBytes val_ref;
28484 CHECK(val->arr_len == 32);
28485 memcpy(val_ref.data, val->elems, 32); FREE(val);
28486 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28489 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
28490 LDKFundingCreated this_ptr_conv;
28491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28492 this_ptr_conv.is_owned = false;
28493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28494 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
28498 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
28499 LDKFundingCreated this_ptr_conv;
28500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28501 this_ptr_conv.is_owned = false;
28502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28503 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28506 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
28507 LDKFundingCreated this_ptr_conv;
28508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28509 this_ptr_conv.is_owned = false;
28510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28511 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28512 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
28516 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
28517 LDKFundingCreated this_ptr_conv;
28518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28519 this_ptr_conv.is_owned = false;
28520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28521 LDKSignature val_ref;
28522 CHECK(val->arr_len == 64);
28523 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28524 FundingCreated_set_signature(&this_ptr_conv, val_ref);
28527 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) {
28528 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28529 CHECK(temporary_channel_id_arg->arr_len == 32);
28530 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
28531 LDKThirtyTwoBytes funding_txid_arg_ref;
28532 CHECK(funding_txid_arg->arr_len == 32);
28533 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
28534 LDKSignature signature_arg_ref;
28535 CHECK(signature_arg->arr_len == 64);
28536 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28537 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28538 uint32_t ret_ref = 0;
28539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28542 ret_ref = (uintptr_t)ret_var.inner;
28543 if (ret_var.is_owned) {
28549 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28550 LDKFundingCreated ret_var = FundingCreated_clone(arg);
28551 uint32_t ret_ref = 0;
28552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28555 ret_ref = (uintptr_t)ret_var.inner;
28556 if (ret_var.is_owned) {
28561 uint32_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
28562 LDKFundingCreated arg_conv;
28563 arg_conv.inner = (void*)(arg & (~1));
28564 arg_conv.is_owned = false;
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28566 uint32_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
28570 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
28571 LDKFundingCreated orig_conv;
28572 orig_conv.inner = (void*)(orig & (~1));
28573 orig_conv.is_owned = false;
28574 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28575 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28576 uint32_t ret_ref = 0;
28577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28580 ret_ref = (uintptr_t)ret_var.inner;
28581 if (ret_var.is_owned) {
28587 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
28588 LDKFundingSigned this_obj_conv;
28589 this_obj_conv.inner = (void*)(this_obj & (~1));
28590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28592 FundingSigned_free(this_obj_conv);
28595 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
28596 LDKFundingSigned this_ptr_conv;
28597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28598 this_ptr_conv.is_owned = false;
28599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28600 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28601 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
28605 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28606 LDKFundingSigned this_ptr_conv;
28607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28608 this_ptr_conv.is_owned = false;
28609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610 LDKThirtyTwoBytes val_ref;
28611 CHECK(val->arr_len == 32);
28612 memcpy(val_ref.data, val->elems, 32); FREE(val);
28613 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28616 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
28617 LDKFundingSigned this_ptr_conv;
28618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28619 this_ptr_conv.is_owned = false;
28620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28622 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28626 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28627 LDKFundingSigned this_ptr_conv;
28628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28629 this_ptr_conv.is_owned = false;
28630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28631 LDKSignature val_ref;
28632 CHECK(val->arr_len == 64);
28633 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28634 FundingSigned_set_signature(&this_ptr_conv, val_ref);
28637 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
28638 LDKThirtyTwoBytes channel_id_arg_ref;
28639 CHECK(channel_id_arg->arr_len == 32);
28640 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28641 LDKSignature signature_arg_ref;
28642 CHECK(signature_arg->arr_len == 64);
28643 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28644 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28645 uint32_t ret_ref = 0;
28646 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28647 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28649 ret_ref = (uintptr_t)ret_var.inner;
28650 if (ret_var.is_owned) {
28656 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28657 LDKFundingSigned ret_var = FundingSigned_clone(arg);
28658 uint32_t ret_ref = 0;
28659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28662 ret_ref = (uintptr_t)ret_var.inner;
28663 if (ret_var.is_owned) {
28668 uint32_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
28669 LDKFundingSigned arg_conv;
28670 arg_conv.inner = (void*)(arg & (~1));
28671 arg_conv.is_owned = false;
28672 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28673 uint32_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
28677 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
28678 LDKFundingSigned orig_conv;
28679 orig_conv.inner = (void*)(orig & (~1));
28680 orig_conv.is_owned = false;
28681 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28682 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28683 uint32_t ret_ref = 0;
28684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28687 ret_ref = (uintptr_t)ret_var.inner;
28688 if (ret_var.is_owned) {
28694 void __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint32_t this_obj) {
28695 LDKChannelReady this_obj_conv;
28696 this_obj_conv.inner = (void*)(this_obj & (~1));
28697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28699 ChannelReady_free(this_obj_conv);
28702 int8_tArray __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint32_t this_ptr) {
28703 LDKChannelReady this_ptr_conv;
28704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28705 this_ptr_conv.is_owned = false;
28706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28707 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28708 memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
28712 void __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28713 LDKChannelReady this_ptr_conv;
28714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28715 this_ptr_conv.is_owned = false;
28716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28717 LDKThirtyTwoBytes val_ref;
28718 CHECK(val->arr_len == 32);
28719 memcpy(val_ref.data, val->elems, 32); FREE(val);
28720 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
28723 int8_tArray __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint32_t this_ptr) {
28724 LDKChannelReady this_ptr_conv;
28725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28726 this_ptr_conv.is_owned = false;
28727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28728 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28729 memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28733 void __attribute__((export_name("TS_ChannelReady_set_next_per_commitment_point"))) TS_ChannelReady_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28734 LDKChannelReady this_ptr_conv;
28735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28736 this_ptr_conv.is_owned = false;
28737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28738 LDKPublicKey val_ref;
28739 CHECK(val->arr_len == 33);
28740 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28741 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28744 uint32_t __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint32_t this_ptr) {
28745 LDKChannelReady this_ptr_conv;
28746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28747 this_ptr_conv.is_owned = false;
28748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28749 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28750 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
28751 uint32_t ret_ref = (uintptr_t)ret_copy;
28755 void __attribute__((export_name("TS_ChannelReady_set_short_channel_id_alias"))) TS_ChannelReady_set_short_channel_id_alias(uint32_t this_ptr, uint32_t val) {
28756 LDKChannelReady this_ptr_conv;
28757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28758 this_ptr_conv.is_owned = false;
28759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28760 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28761 CHECK_ACCESS(val_ptr);
28762 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28763 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28764 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
28767 uint32_t __attribute__((export_name("TS_ChannelReady_new"))) TS_ChannelReady_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, uint32_t short_channel_id_alias_arg) {
28768 LDKThirtyTwoBytes channel_id_arg_ref;
28769 CHECK(channel_id_arg->arr_len == 32);
28770 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28771 LDKPublicKey next_per_commitment_point_arg_ref;
28772 CHECK(next_per_commitment_point_arg->arr_len == 33);
28773 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28774 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
28775 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
28776 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
28777 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
28778 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
28779 uint32_t ret_ref = 0;
28780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28783 ret_ref = (uintptr_t)ret_var.inner;
28784 if (ret_var.is_owned) {
28790 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
28791 LDKChannelReady ret_var = ChannelReady_clone(arg);
28792 uint32_t ret_ref = 0;
28793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28796 ret_ref = (uintptr_t)ret_var.inner;
28797 if (ret_var.is_owned) {
28802 uint32_t __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint32_t arg) {
28803 LDKChannelReady arg_conv;
28804 arg_conv.inner = (void*)(arg & (~1));
28805 arg_conv.is_owned = false;
28806 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28807 uint32_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
28811 uint32_t __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint32_t orig) {
28812 LDKChannelReady orig_conv;
28813 orig_conv.inner = (void*)(orig & (~1));
28814 orig_conv.is_owned = false;
28815 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28816 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
28817 uint32_t ret_ref = 0;
28818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28821 ret_ref = (uintptr_t)ret_var.inner;
28822 if (ret_var.is_owned) {
28828 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
28829 LDKShutdown this_obj_conv;
28830 this_obj_conv.inner = (void*)(this_obj & (~1));
28831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28833 Shutdown_free(this_obj_conv);
28836 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
28837 LDKShutdown this_ptr_conv;
28838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28839 this_ptr_conv.is_owned = false;
28840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28841 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28842 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
28846 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28847 LDKShutdown this_ptr_conv;
28848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28849 this_ptr_conv.is_owned = false;
28850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28851 LDKThirtyTwoBytes val_ref;
28852 CHECK(val->arr_len == 32);
28853 memcpy(val_ref.data, val->elems, 32); FREE(val);
28854 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
28857 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
28858 LDKShutdown this_ptr_conv;
28859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28860 this_ptr_conv.is_owned = false;
28861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28862 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
28863 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28864 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28868 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
28869 LDKShutdown this_ptr_conv;
28870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28871 this_ptr_conv.is_owned = false;
28872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28873 LDKCVec_u8Z val_ref;
28874 val_ref.datalen = val->arr_len;
28875 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
28876 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
28877 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
28880 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
28881 LDKThirtyTwoBytes channel_id_arg_ref;
28882 CHECK(channel_id_arg->arr_len == 32);
28883 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28884 LDKCVec_u8Z scriptpubkey_arg_ref;
28885 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
28886 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
28887 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
28888 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
28889 uint32_t ret_ref = 0;
28890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28893 ret_ref = (uintptr_t)ret_var.inner;
28894 if (ret_var.is_owned) {
28900 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
28901 LDKShutdown ret_var = Shutdown_clone(arg);
28902 uint32_t ret_ref = 0;
28903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28906 ret_ref = (uintptr_t)ret_var.inner;
28907 if (ret_var.is_owned) {
28912 uint32_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
28913 LDKShutdown arg_conv;
28914 arg_conv.inner = (void*)(arg & (~1));
28915 arg_conv.is_owned = false;
28916 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28917 uint32_t ret_conv = Shutdown_clone_ptr(&arg_conv);
28921 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
28922 LDKShutdown orig_conv;
28923 orig_conv.inner = (void*)(orig & (~1));
28924 orig_conv.is_owned = false;
28925 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28926 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
28927 uint32_t ret_ref = 0;
28928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28931 ret_ref = (uintptr_t)ret_var.inner;
28932 if (ret_var.is_owned) {
28938 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
28939 LDKClosingSignedFeeRange this_obj_conv;
28940 this_obj_conv.inner = (void*)(this_obj & (~1));
28941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28943 ClosingSignedFeeRange_free(this_obj_conv);
28946 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
28947 LDKClosingSignedFeeRange this_ptr_conv;
28948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28949 this_ptr_conv.is_owned = false;
28950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28951 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
28955 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
28956 LDKClosingSignedFeeRange this_ptr_conv;
28957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28958 this_ptr_conv.is_owned = false;
28959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28960 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
28963 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
28964 LDKClosingSignedFeeRange this_ptr_conv;
28965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28966 this_ptr_conv.is_owned = false;
28967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28968 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
28972 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
28973 LDKClosingSignedFeeRange this_ptr_conv;
28974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28975 this_ptr_conv.is_owned = false;
28976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28977 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
28980 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
28981 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
28982 uint32_t ret_ref = 0;
28983 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28984 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28986 ret_ref = (uintptr_t)ret_var.inner;
28987 if (ret_var.is_owned) {
28993 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
28994 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
28995 uint32_t ret_ref = 0;
28996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28999 ret_ref = (uintptr_t)ret_var.inner;
29000 if (ret_var.is_owned) {
29005 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
29006 LDKClosingSignedFeeRange arg_conv;
29007 arg_conv.inner = (void*)(arg & (~1));
29008 arg_conv.is_owned = false;
29009 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29010 uint32_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
29014 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
29015 LDKClosingSignedFeeRange orig_conv;
29016 orig_conv.inner = (void*)(orig & (~1));
29017 orig_conv.is_owned = false;
29018 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29019 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
29020 uint32_t ret_ref = 0;
29021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29024 ret_ref = (uintptr_t)ret_var.inner;
29025 if (ret_var.is_owned) {
29031 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
29032 LDKClosingSigned this_obj_conv;
29033 this_obj_conv.inner = (void*)(this_obj & (~1));
29034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29036 ClosingSigned_free(this_obj_conv);
29039 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
29040 LDKClosingSigned this_ptr_conv;
29041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29042 this_ptr_conv.is_owned = false;
29043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29044 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29045 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
29049 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29050 LDKClosingSigned this_ptr_conv;
29051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29052 this_ptr_conv.is_owned = false;
29053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29054 LDKThirtyTwoBytes val_ref;
29055 CHECK(val->arr_len == 32);
29056 memcpy(val_ref.data, val->elems, 32); FREE(val);
29057 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
29060 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
29061 LDKClosingSigned this_ptr_conv;
29062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29063 this_ptr_conv.is_owned = false;
29064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29065 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
29069 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
29070 LDKClosingSigned this_ptr_conv;
29071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29072 this_ptr_conv.is_owned = false;
29073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29074 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
29077 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
29078 LDKClosingSigned this_ptr_conv;
29079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29080 this_ptr_conv.is_owned = false;
29081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29082 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29083 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
29087 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29088 LDKClosingSigned this_ptr_conv;
29089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29090 this_ptr_conv.is_owned = false;
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092 LDKSignature val_ref;
29093 CHECK(val->arr_len == 64);
29094 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29095 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
29098 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
29099 LDKClosingSigned this_ptr_conv;
29100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29101 this_ptr_conv.is_owned = false;
29102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29103 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
29104 uint32_t ret_ref = 0;
29105 if ((uintptr_t)ret_var.inner > 4096) {
29106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29109 ret_ref = (uintptr_t)ret_var.inner;
29110 if (ret_var.is_owned) {
29117 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
29118 LDKClosingSigned this_ptr_conv;
29119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29120 this_ptr_conv.is_owned = false;
29121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29122 LDKClosingSignedFeeRange val_conv;
29123 val_conv.inner = (void*)(val & (~1));
29124 val_conv.is_owned = (val & 1) || (val == 0);
29125 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29126 val_conv = ClosingSignedFeeRange_clone(&val_conv);
29127 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
29130 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) {
29131 LDKThirtyTwoBytes channel_id_arg_ref;
29132 CHECK(channel_id_arg->arr_len == 32);
29133 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29134 LDKSignature signature_arg_ref;
29135 CHECK(signature_arg->arr_len == 64);
29136 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29137 LDKClosingSignedFeeRange fee_range_arg_conv;
29138 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
29139 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
29140 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
29141 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
29142 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
29143 uint32_t ret_ref = 0;
29144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29147 ret_ref = (uintptr_t)ret_var.inner;
29148 if (ret_var.is_owned) {
29154 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
29155 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
29156 uint32_t ret_ref = 0;
29157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29160 ret_ref = (uintptr_t)ret_var.inner;
29161 if (ret_var.is_owned) {
29166 uint32_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
29167 LDKClosingSigned arg_conv;
29168 arg_conv.inner = (void*)(arg & (~1));
29169 arg_conv.is_owned = false;
29170 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29171 uint32_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
29175 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
29176 LDKClosingSigned orig_conv;
29177 orig_conv.inner = (void*)(orig & (~1));
29178 orig_conv.is_owned = false;
29179 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29180 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
29181 uint32_t ret_ref = 0;
29182 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29183 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29184 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29185 ret_ref = (uintptr_t)ret_var.inner;
29186 if (ret_var.is_owned) {
29192 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
29193 LDKUpdateAddHTLC this_obj_conv;
29194 this_obj_conv.inner = (void*)(this_obj & (~1));
29195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29197 UpdateAddHTLC_free(this_obj_conv);
29200 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
29201 LDKUpdateAddHTLC 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29206 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
29210 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29211 LDKUpdateAddHTLC this_ptr_conv;
29212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29213 this_ptr_conv.is_owned = false;
29214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29215 LDKThirtyTwoBytes val_ref;
29216 CHECK(val->arr_len == 32);
29217 memcpy(val_ref.data, val->elems, 32); FREE(val);
29218 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
29221 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
29222 LDKUpdateAddHTLC this_ptr_conv;
29223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29224 this_ptr_conv.is_owned = false;
29225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29226 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
29230 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29231 LDKUpdateAddHTLC this_ptr_conv;
29232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29233 this_ptr_conv.is_owned = false;
29234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29235 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
29238 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
29239 LDKUpdateAddHTLC 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 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
29247 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
29248 LDKUpdateAddHTLC this_ptr_conv;
29249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29250 this_ptr_conv.is_owned = false;
29251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29252 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
29255 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
29256 LDKUpdateAddHTLC this_ptr_conv;
29257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29258 this_ptr_conv.is_owned = false;
29259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29260 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29261 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
29265 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29266 LDKUpdateAddHTLC this_ptr_conv;
29267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29268 this_ptr_conv.is_owned = false;
29269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29270 LDKThirtyTwoBytes val_ref;
29271 CHECK(val->arr_len == 32);
29272 memcpy(val_ref.data, val->elems, 32); FREE(val);
29273 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
29276 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
29277 LDKUpdateAddHTLC this_ptr_conv;
29278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29279 this_ptr_conv.is_owned = false;
29280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29281 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
29285 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29286 LDKUpdateAddHTLC this_ptr_conv;
29287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29288 this_ptr_conv.is_owned = false;
29289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29290 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
29293 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
29294 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
29295 uint32_t ret_ref = 0;
29296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29299 ret_ref = (uintptr_t)ret_var.inner;
29300 if (ret_var.is_owned) {
29305 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
29306 LDKUpdateAddHTLC arg_conv;
29307 arg_conv.inner = (void*)(arg & (~1));
29308 arg_conv.is_owned = false;
29309 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29310 uint32_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
29314 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
29315 LDKUpdateAddHTLC orig_conv;
29316 orig_conv.inner = (void*)(orig & (~1));
29317 orig_conv.is_owned = false;
29318 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29319 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
29320 uint32_t ret_ref = 0;
29321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29324 ret_ref = (uintptr_t)ret_var.inner;
29325 if (ret_var.is_owned) {
29331 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
29332 LDKUpdateFulfillHTLC this_obj_conv;
29333 this_obj_conv.inner = (void*)(this_obj & (~1));
29334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29336 UpdateFulfillHTLC_free(this_obj_conv);
29339 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
29340 LDKUpdateFulfillHTLC this_ptr_conv;
29341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29342 this_ptr_conv.is_owned = false;
29343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29344 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29345 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
29349 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29350 LDKUpdateFulfillHTLC this_ptr_conv;
29351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29352 this_ptr_conv.is_owned = false;
29353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29354 LDKThirtyTwoBytes val_ref;
29355 CHECK(val->arr_len == 32);
29356 memcpy(val_ref.data, val->elems, 32); FREE(val);
29357 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
29360 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
29361 LDKUpdateFulfillHTLC this_ptr_conv;
29362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29363 this_ptr_conv.is_owned = false;
29364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29365 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
29369 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29370 LDKUpdateFulfillHTLC this_ptr_conv;
29371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29372 this_ptr_conv.is_owned = false;
29373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29374 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
29377 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
29378 LDKUpdateFulfillHTLC this_ptr_conv;
29379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29380 this_ptr_conv.is_owned = false;
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29382 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29383 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
29387 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
29388 LDKUpdateFulfillHTLC this_ptr_conv;
29389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29390 this_ptr_conv.is_owned = false;
29391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29392 LDKThirtyTwoBytes val_ref;
29393 CHECK(val->arr_len == 32);
29394 memcpy(val_ref.data, val->elems, 32); FREE(val);
29395 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
29398 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) {
29399 LDKThirtyTwoBytes channel_id_arg_ref;
29400 CHECK(channel_id_arg->arr_len == 32);
29401 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29402 LDKThirtyTwoBytes payment_preimage_arg_ref;
29403 CHECK(payment_preimage_arg->arr_len == 32);
29404 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
29405 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
29406 uint32_t ret_ref = 0;
29407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29410 ret_ref = (uintptr_t)ret_var.inner;
29411 if (ret_var.is_owned) {
29417 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
29418 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
29419 uint32_t ret_ref = 0;
29420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29423 ret_ref = (uintptr_t)ret_var.inner;
29424 if (ret_var.is_owned) {
29429 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
29430 LDKUpdateFulfillHTLC arg_conv;
29431 arg_conv.inner = (void*)(arg & (~1));
29432 arg_conv.is_owned = false;
29433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29434 uint32_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
29438 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
29439 LDKUpdateFulfillHTLC orig_conv;
29440 orig_conv.inner = (void*)(orig & (~1));
29441 orig_conv.is_owned = false;
29442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29443 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
29444 uint32_t ret_ref = 0;
29445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29448 ret_ref = (uintptr_t)ret_var.inner;
29449 if (ret_var.is_owned) {
29455 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
29456 LDKUpdateFailHTLC this_obj_conv;
29457 this_obj_conv.inner = (void*)(this_obj & (~1));
29458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29460 UpdateFailHTLC_free(this_obj_conv);
29463 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
29464 LDKUpdateFailHTLC this_ptr_conv;
29465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29466 this_ptr_conv.is_owned = false;
29467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29468 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29469 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
29473 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29474 LDKUpdateFailHTLC this_ptr_conv;
29475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29476 this_ptr_conv.is_owned = false;
29477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29478 LDKThirtyTwoBytes val_ref;
29479 CHECK(val->arr_len == 32);
29480 memcpy(val_ref.data, val->elems, 32); FREE(val);
29481 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29484 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
29485 LDKUpdateFailHTLC this_ptr_conv;
29486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29487 this_ptr_conv.is_owned = false;
29488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29489 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29493 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29494 LDKUpdateFailHTLC this_ptr_conv;
29495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29496 this_ptr_conv.is_owned = false;
29497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29498 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29501 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29502 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29503 uint32_t ret_ref = 0;
29504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29507 ret_ref = (uintptr_t)ret_var.inner;
29508 if (ret_var.is_owned) {
29513 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
29514 LDKUpdateFailHTLC arg_conv;
29515 arg_conv.inner = (void*)(arg & (~1));
29516 arg_conv.is_owned = false;
29517 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29518 uint32_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
29522 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
29523 LDKUpdateFailHTLC orig_conv;
29524 orig_conv.inner = (void*)(orig & (~1));
29525 orig_conv.is_owned = false;
29526 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29527 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29528 uint32_t ret_ref = 0;
29529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29532 ret_ref = (uintptr_t)ret_var.inner;
29533 if (ret_var.is_owned) {
29539 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
29540 LDKUpdateFailMalformedHTLC this_obj_conv;
29541 this_obj_conv.inner = (void*)(this_obj & (~1));
29542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29544 UpdateFailMalformedHTLC_free(this_obj_conv);
29547 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
29548 LDKUpdateFailMalformedHTLC this_ptr_conv;
29549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29550 this_ptr_conv.is_owned = false;
29551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29552 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29553 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
29557 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29558 LDKUpdateFailMalformedHTLC this_ptr_conv;
29559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29560 this_ptr_conv.is_owned = false;
29561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29562 LDKThirtyTwoBytes val_ref;
29563 CHECK(val->arr_len == 32);
29564 memcpy(val_ref.data, val->elems, 32); FREE(val);
29565 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29568 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
29569 LDKUpdateFailMalformedHTLC this_ptr_conv;
29570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29571 this_ptr_conv.is_owned = false;
29572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29573 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29577 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29578 LDKUpdateFailMalformedHTLC this_ptr_conv;
29579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29580 this_ptr_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29582 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29585 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
29586 LDKUpdateFailMalformedHTLC this_ptr_conv;
29587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29588 this_ptr_conv.is_owned = false;
29589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29590 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29594 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
29595 LDKUpdateFailMalformedHTLC this_ptr_conv;
29596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29597 this_ptr_conv.is_owned = false;
29598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29599 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29602 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29603 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29604 uint32_t ret_ref = 0;
29605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29608 ret_ref = (uintptr_t)ret_var.inner;
29609 if (ret_var.is_owned) {
29614 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
29615 LDKUpdateFailMalformedHTLC arg_conv;
29616 arg_conv.inner = (void*)(arg & (~1));
29617 arg_conv.is_owned = false;
29618 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29619 uint32_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29623 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
29624 LDKUpdateFailMalformedHTLC orig_conv;
29625 orig_conv.inner = (void*)(orig & (~1));
29626 orig_conv.is_owned = false;
29627 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29628 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
29629 uint32_t ret_ref = 0;
29630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29633 ret_ref = (uintptr_t)ret_var.inner;
29634 if (ret_var.is_owned) {
29640 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
29641 LDKCommitmentSigned this_obj_conv;
29642 this_obj_conv.inner = (void*)(this_obj & (~1));
29643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29645 CommitmentSigned_free(this_obj_conv);
29648 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
29649 LDKCommitmentSigned this_ptr_conv;
29650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29651 this_ptr_conv.is_owned = false;
29652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29653 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29654 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
29658 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29659 LDKCommitmentSigned this_ptr_conv;
29660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29661 this_ptr_conv.is_owned = false;
29662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29663 LDKThirtyTwoBytes val_ref;
29664 CHECK(val->arr_len == 32);
29665 memcpy(val_ref.data, val->elems, 32); FREE(val);
29666 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29669 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
29670 LDKCommitmentSigned this_ptr_conv;
29671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29672 this_ptr_conv.is_owned = false;
29673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29674 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29675 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
29679 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29680 LDKCommitmentSigned this_ptr_conv;
29681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29682 this_ptr_conv.is_owned = false;
29683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29684 LDKSignature val_ref;
29685 CHECK(val->arr_len == 64);
29686 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29687 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29690 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
29691 LDKCommitmentSigned this_ptr_conv;
29692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29693 this_ptr_conv.is_owned = false;
29694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29695 LDKCVec_SignatureZ val_constr;
29696 val_constr.datalen = val->arr_len;
29697 if (val_constr.datalen > 0)
29698 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29700 val_constr.data = NULL;
29701 int8_tArray* val_vals = (void*) val->elems;
29702 for (size_t m = 0; m < val_constr.datalen; m++) {
29703 int8_tArray val_conv_12 = val_vals[m];
29704 LDKSignature val_conv_12_ref;
29705 CHECK(val_conv_12->arr_len == 64);
29706 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
29707 val_constr.data[m] = val_conv_12_ref;
29710 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29713 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
29714 LDKThirtyTwoBytes channel_id_arg_ref;
29715 CHECK(channel_id_arg->arr_len == 32);
29716 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29717 LDKSignature signature_arg_ref;
29718 CHECK(signature_arg->arr_len == 64);
29719 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29720 LDKCVec_SignatureZ htlc_signatures_arg_constr;
29721 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
29722 if (htlc_signatures_arg_constr.datalen > 0)
29723 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29725 htlc_signatures_arg_constr.data = NULL;
29726 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
29727 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
29728 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
29729 LDKSignature htlc_signatures_arg_conv_12_ref;
29730 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
29731 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
29732 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
29734 FREE(htlc_signatures_arg);
29735 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
29736 uint32_t ret_ref = 0;
29737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29740 ret_ref = (uintptr_t)ret_var.inner;
29741 if (ret_var.is_owned) {
29747 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
29748 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
29749 uint32_t ret_ref = 0;
29750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29753 ret_ref = (uintptr_t)ret_var.inner;
29754 if (ret_var.is_owned) {
29759 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
29760 LDKCommitmentSigned arg_conv;
29761 arg_conv.inner = (void*)(arg & (~1));
29762 arg_conv.is_owned = false;
29763 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29764 uint32_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
29768 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
29769 LDKCommitmentSigned orig_conv;
29770 orig_conv.inner = (void*)(orig & (~1));
29771 orig_conv.is_owned = false;
29772 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29773 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
29774 uint32_t ret_ref = 0;
29775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29778 ret_ref = (uintptr_t)ret_var.inner;
29779 if (ret_var.is_owned) {
29785 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
29786 LDKRevokeAndACK this_obj_conv;
29787 this_obj_conv.inner = (void*)(this_obj & (~1));
29788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29790 RevokeAndACK_free(this_obj_conv);
29793 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
29794 LDKRevokeAndACK this_ptr_conv;
29795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29796 this_ptr_conv.is_owned = false;
29797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29798 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29799 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
29803 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29804 LDKRevokeAndACK this_ptr_conv;
29805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29806 this_ptr_conv.is_owned = false;
29807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29808 LDKThirtyTwoBytes val_ref;
29809 CHECK(val->arr_len == 32);
29810 memcpy(val_ref.data, val->elems, 32); FREE(val);
29811 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
29814 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
29815 LDKRevokeAndACK this_ptr_conv;
29816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29817 this_ptr_conv.is_owned = false;
29818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29819 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29820 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
29824 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
29825 LDKRevokeAndACK this_ptr_conv;
29826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29827 this_ptr_conv.is_owned = false;
29828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29829 LDKThirtyTwoBytes val_ref;
29830 CHECK(val->arr_len == 32);
29831 memcpy(val_ref.data, val->elems, 32); FREE(val);
29832 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
29835 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
29836 LDKRevokeAndACK this_ptr_conv;
29837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29838 this_ptr_conv.is_owned = false;
29839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29840 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29841 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29845 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) {
29846 LDKRevokeAndACK this_ptr_conv;
29847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29848 this_ptr_conv.is_owned = false;
29849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29850 LDKPublicKey val_ref;
29851 CHECK(val->arr_len == 33);
29852 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29853 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29856 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) {
29857 LDKThirtyTwoBytes channel_id_arg_ref;
29858 CHECK(channel_id_arg->arr_len == 32);
29859 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29860 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
29861 CHECK(per_commitment_secret_arg->arr_len == 32);
29862 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
29863 LDKPublicKey next_per_commitment_point_arg_ref;
29864 CHECK(next_per_commitment_point_arg->arr_len == 33);
29865 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29866 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
29867 uint32_t ret_ref = 0;
29868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29871 ret_ref = (uintptr_t)ret_var.inner;
29872 if (ret_var.is_owned) {
29878 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
29879 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
29880 uint32_t ret_ref = 0;
29881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29884 ret_ref = (uintptr_t)ret_var.inner;
29885 if (ret_var.is_owned) {
29890 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
29891 LDKRevokeAndACK arg_conv;
29892 arg_conv.inner = (void*)(arg & (~1));
29893 arg_conv.is_owned = false;
29894 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29895 uint32_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
29899 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
29900 LDKRevokeAndACK orig_conv;
29901 orig_conv.inner = (void*)(orig & (~1));
29902 orig_conv.is_owned = false;
29903 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29904 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
29905 uint32_t ret_ref = 0;
29906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29909 ret_ref = (uintptr_t)ret_var.inner;
29910 if (ret_var.is_owned) {
29916 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
29917 LDKUpdateFee this_obj_conv;
29918 this_obj_conv.inner = (void*)(this_obj & (~1));
29919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29921 UpdateFee_free(this_obj_conv);
29924 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
29925 LDKUpdateFee this_ptr_conv;
29926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29927 this_ptr_conv.is_owned = false;
29928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29929 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29930 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
29934 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29935 LDKUpdateFee this_ptr_conv;
29936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29937 this_ptr_conv.is_owned = false;
29938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29939 LDKThirtyTwoBytes val_ref;
29940 CHECK(val->arr_len == 32);
29941 memcpy(val_ref.data, val->elems, 32); FREE(val);
29942 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
29945 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
29946 LDKUpdateFee this_ptr_conv;
29947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29948 this_ptr_conv.is_owned = false;
29949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29950 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
29954 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
29955 LDKUpdateFee this_ptr_conv;
29956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29957 this_ptr_conv.is_owned = false;
29958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29959 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
29962 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
29963 LDKThirtyTwoBytes channel_id_arg_ref;
29964 CHECK(channel_id_arg->arr_len == 32);
29965 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29966 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
29967 uint32_t ret_ref = 0;
29968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29971 ret_ref = (uintptr_t)ret_var.inner;
29972 if (ret_var.is_owned) {
29978 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
29979 LDKUpdateFee ret_var = UpdateFee_clone(arg);
29980 uint32_t ret_ref = 0;
29981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29984 ret_ref = (uintptr_t)ret_var.inner;
29985 if (ret_var.is_owned) {
29990 uint32_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
29991 LDKUpdateFee arg_conv;
29992 arg_conv.inner = (void*)(arg & (~1));
29993 arg_conv.is_owned = false;
29994 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29995 uint32_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
29999 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
30000 LDKUpdateFee orig_conv;
30001 orig_conv.inner = (void*)(orig & (~1));
30002 orig_conv.is_owned = false;
30003 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30004 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
30005 uint32_t ret_ref = 0;
30006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30009 ret_ref = (uintptr_t)ret_var.inner;
30010 if (ret_var.is_owned) {
30016 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
30017 LDKDataLossProtect this_obj_conv;
30018 this_obj_conv.inner = (void*)(this_obj & (~1));
30019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30021 DataLossProtect_free(this_obj_conv);
30024 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) {
30025 LDKDataLossProtect 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30030 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
30034 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) {
30035 LDKDataLossProtect this_ptr_conv;
30036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30037 this_ptr_conv.is_owned = false;
30038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30039 LDKThirtyTwoBytes val_ref;
30040 CHECK(val->arr_len == 32);
30041 memcpy(val_ref.data, val->elems, 32); FREE(val);
30042 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
30045 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) {
30046 LDKDataLossProtect this_ptr_conv;
30047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30048 this_ptr_conv.is_owned = false;
30049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30050 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30051 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30055 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) {
30056 LDKDataLossProtect this_ptr_conv;
30057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30058 this_ptr_conv.is_owned = false;
30059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30060 LDKPublicKey val_ref;
30061 CHECK(val->arr_len == 33);
30062 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30063 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
30066 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) {
30067 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
30068 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
30069 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
30070 LDKPublicKey my_current_per_commitment_point_arg_ref;
30071 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
30072 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);
30073 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
30074 uint32_t ret_ref = 0;
30075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30078 ret_ref = (uintptr_t)ret_var.inner;
30079 if (ret_var.is_owned) {
30085 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
30086 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
30087 uint32_t ret_ref = 0;
30088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30091 ret_ref = (uintptr_t)ret_var.inner;
30092 if (ret_var.is_owned) {
30097 uint32_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
30098 LDKDataLossProtect arg_conv;
30099 arg_conv.inner = (void*)(arg & (~1));
30100 arg_conv.is_owned = false;
30101 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30102 uint32_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
30106 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
30107 LDKDataLossProtect orig_conv;
30108 orig_conv.inner = (void*)(orig & (~1));
30109 orig_conv.is_owned = false;
30110 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30111 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
30112 uint32_t ret_ref = 0;
30113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30116 ret_ref = (uintptr_t)ret_var.inner;
30117 if (ret_var.is_owned) {
30123 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
30124 LDKChannelReestablish this_obj_conv;
30125 this_obj_conv.inner = (void*)(this_obj & (~1));
30126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30128 ChannelReestablish_free(this_obj_conv);
30131 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
30132 LDKChannelReestablish this_ptr_conv;
30133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30134 this_ptr_conv.is_owned = false;
30135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30136 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30137 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
30141 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30142 LDKChannelReestablish this_ptr_conv;
30143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30144 this_ptr_conv.is_owned = false;
30145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30146 LDKThirtyTwoBytes val_ref;
30147 CHECK(val->arr_len == 32);
30148 memcpy(val_ref.data, val->elems, 32); FREE(val);
30149 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
30152 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
30153 LDKChannelReestablish this_ptr_conv;
30154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30155 this_ptr_conv.is_owned = false;
30156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30157 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
30161 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) {
30162 LDKChannelReestablish this_ptr_conv;
30163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30164 this_ptr_conv.is_owned = false;
30165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30166 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
30169 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
30170 LDKChannelReestablish this_ptr_conv;
30171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30172 this_ptr_conv.is_owned = false;
30173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30174 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
30178 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) {
30179 LDKChannelReestablish this_ptr_conv;
30180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30181 this_ptr_conv.is_owned = false;
30182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30183 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
30186 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
30187 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
30188 uint32_t ret_ref = 0;
30189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30192 ret_ref = (uintptr_t)ret_var.inner;
30193 if (ret_var.is_owned) {
30198 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
30199 LDKChannelReestablish arg_conv;
30200 arg_conv.inner = (void*)(arg & (~1));
30201 arg_conv.is_owned = false;
30202 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30203 uint32_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
30207 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
30208 LDKChannelReestablish orig_conv;
30209 orig_conv.inner = (void*)(orig & (~1));
30210 orig_conv.is_owned = false;
30211 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30212 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
30213 uint32_t ret_ref = 0;
30214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30217 ret_ref = (uintptr_t)ret_var.inner;
30218 if (ret_var.is_owned) {
30224 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
30225 LDKAnnouncementSignatures this_obj_conv;
30226 this_obj_conv.inner = (void*)(this_obj & (~1));
30227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30229 AnnouncementSignatures_free(this_obj_conv);
30232 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
30233 LDKAnnouncementSignatures this_ptr_conv;
30234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30235 this_ptr_conv.is_owned = false;
30236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30237 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30238 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
30242 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30243 LDKAnnouncementSignatures this_ptr_conv;
30244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30245 this_ptr_conv.is_owned = false;
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30247 LDKThirtyTwoBytes val_ref;
30248 CHECK(val->arr_len == 32);
30249 memcpy(val_ref.data, val->elems, 32); FREE(val);
30250 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
30253 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
30254 LDKAnnouncementSignatures this_ptr_conv;
30255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30256 this_ptr_conv.is_owned = false;
30257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30258 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
30262 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30263 LDKAnnouncementSignatures this_ptr_conv;
30264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30265 this_ptr_conv.is_owned = false;
30266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30267 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
30270 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
30271 LDKAnnouncementSignatures this_ptr_conv;
30272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30273 this_ptr_conv.is_owned = false;
30274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30275 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30276 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
30280 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
30281 LDKAnnouncementSignatures this_ptr_conv;
30282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30283 this_ptr_conv.is_owned = false;
30284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30285 LDKSignature val_ref;
30286 CHECK(val->arr_len == 64);
30287 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30288 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
30291 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
30292 LDKAnnouncementSignatures this_ptr_conv;
30293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30294 this_ptr_conv.is_owned = false;
30295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30296 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30297 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
30301 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
30302 LDKAnnouncementSignatures this_ptr_conv;
30303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30304 this_ptr_conv.is_owned = false;
30305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30306 LDKSignature val_ref;
30307 CHECK(val->arr_len == 64);
30308 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30309 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
30312 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) {
30313 LDKThirtyTwoBytes channel_id_arg_ref;
30314 CHECK(channel_id_arg->arr_len == 32);
30315 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30316 LDKSignature node_signature_arg_ref;
30317 CHECK(node_signature_arg->arr_len == 64);
30318 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
30319 LDKSignature bitcoin_signature_arg_ref;
30320 CHECK(bitcoin_signature_arg->arr_len == 64);
30321 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
30322 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
30323 uint32_t ret_ref = 0;
30324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30327 ret_ref = (uintptr_t)ret_var.inner;
30328 if (ret_var.is_owned) {
30334 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
30335 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
30336 uint32_t ret_ref = 0;
30337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30340 ret_ref = (uintptr_t)ret_var.inner;
30341 if (ret_var.is_owned) {
30346 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
30347 LDKAnnouncementSignatures arg_conv;
30348 arg_conv.inner = (void*)(arg & (~1));
30349 arg_conv.is_owned = false;
30350 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30351 uint32_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
30355 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
30356 LDKAnnouncementSignatures orig_conv;
30357 orig_conv.inner = (void*)(orig & (~1));
30358 orig_conv.is_owned = false;
30359 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30360 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
30361 uint32_t ret_ref = 0;
30362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30365 ret_ref = (uintptr_t)ret_var.inner;
30366 if (ret_var.is_owned) {
30372 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
30373 if ((this_ptr & 1) != 0) return;
30374 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30375 CHECK_ACCESS(this_ptr_ptr);
30376 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
30377 FREE((void*)this_ptr);
30378 NetAddress_free(this_ptr_conv);
30381 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
30382 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30383 *ret_copy = NetAddress_clone(arg);
30384 uint32_t ret_ref = (uintptr_t)ret_copy;
30387 uint32_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
30388 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
30389 uint32_t ret_conv = NetAddress_clone_ptr(arg_conv);
30393 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
30394 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
30395 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30396 *ret_copy = NetAddress_clone(orig_conv);
30397 uint32_t ret_ref = (uintptr_t)ret_copy;
30401 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
30402 LDKFourBytes addr_ref;
30403 CHECK(addr->arr_len == 4);
30404 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
30405 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30406 *ret_copy = NetAddress_ipv4(addr_ref, port);
30407 uint32_t ret_ref = (uintptr_t)ret_copy;
30411 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
30412 LDKSixteenBytes addr_ref;
30413 CHECK(addr->arr_len == 16);
30414 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
30415 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30416 *ret_copy = NetAddress_ipv6(addr_ref, port);
30417 uint32_t ret_ref = (uintptr_t)ret_copy;
30421 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
30422 LDKTwelveBytes a_ref;
30423 CHECK(a->arr_len == 12);
30424 memcpy(a_ref.data, a->elems, 12); FREE(a);
30425 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30426 *ret_copy = NetAddress_onion_v2(a_ref);
30427 uint32_t ret_ref = (uintptr_t)ret_copy;
30431 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) {
30432 LDKThirtyTwoBytes ed25519_pubkey_ref;
30433 CHECK(ed25519_pubkey->arr_len == 32);
30434 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
30435 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30436 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
30437 uint32_t ret_ref = (uintptr_t)ret_copy;
30441 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
30442 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
30443 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
30444 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30445 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30446 CVec_u8Z_free(ret_var);
30450 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
30451 LDKu8slice ser_ref;
30452 ser_ref.datalen = ser->arr_len;
30453 ser_ref.data = ser->elems;
30454 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
30455 *ret_conv = NetAddress_read(ser_ref);
30457 return (uint32_t)ret_conv;
30460 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
30461 LDKUnsignedNodeAnnouncement this_obj_conv;
30462 this_obj_conv.inner = (void*)(this_obj & (~1));
30463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30465 UnsignedNodeAnnouncement_free(this_obj_conv);
30468 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
30469 LDKUnsignedNodeAnnouncement this_ptr_conv;
30470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30471 this_ptr_conv.is_owned = false;
30472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30473 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30474 uint32_t ret_ref = 0;
30475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30478 ret_ref = (uintptr_t)ret_var.inner;
30479 if (ret_var.is_owned) {
30485 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30486 LDKUnsignedNodeAnnouncement this_ptr_conv;
30487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30488 this_ptr_conv.is_owned = false;
30489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30490 LDKNodeFeatures val_conv;
30491 val_conv.inner = (void*)(val & (~1));
30492 val_conv.is_owned = (val & 1) || (val == 0);
30493 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30494 val_conv = NodeFeatures_clone(&val_conv);
30495 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30498 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
30499 LDKUnsignedNodeAnnouncement this_ptr_conv;
30500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30501 this_ptr_conv.is_owned = false;
30502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30503 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30507 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
30508 LDKUnsignedNodeAnnouncement this_ptr_conv;
30509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30510 this_ptr_conv.is_owned = false;
30511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30512 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30515 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
30516 LDKUnsignedNodeAnnouncement this_ptr_conv;
30517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30518 this_ptr_conv.is_owned = false;
30519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30520 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30521 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
30525 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
30526 LDKUnsignedNodeAnnouncement this_ptr_conv;
30527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30528 this_ptr_conv.is_owned = false;
30529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30530 LDKPublicKey val_ref;
30531 CHECK(val->arr_len == 33);
30532 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30533 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30536 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
30537 LDKUnsignedNodeAnnouncement this_ptr_conv;
30538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30539 this_ptr_conv.is_owned = false;
30540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30541 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
30542 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
30546 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
30547 LDKUnsignedNodeAnnouncement this_ptr_conv;
30548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30549 this_ptr_conv.is_owned = false;
30550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30551 LDKThreeBytes val_ref;
30552 CHECK(val->arr_len == 3);
30553 memcpy(val_ref.data, val->elems, 3); FREE(val);
30554 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30557 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
30558 LDKUnsignedNodeAnnouncement this_ptr_conv;
30559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30560 this_ptr_conv.is_owned = false;
30561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30562 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30563 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
30567 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
30568 LDKUnsignedNodeAnnouncement this_ptr_conv;
30569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30570 this_ptr_conv.is_owned = false;
30571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30572 LDKThirtyTwoBytes val_ref;
30573 CHECK(val->arr_len == 32);
30574 memcpy(val_ref.data, val->elems, 32); FREE(val);
30575 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30578 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
30579 LDKUnsignedNodeAnnouncement this_ptr_conv;
30580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30581 this_ptr_conv.is_owned = false;
30582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30583 LDKCVec_NetAddressZ val_constr;
30584 val_constr.datalen = val->arr_len;
30585 if (val_constr.datalen > 0)
30586 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30588 val_constr.data = NULL;
30589 uint32_t* val_vals = val->elems;
30590 for (size_t m = 0; m < val_constr.datalen; m++) {
30591 uint32_t val_conv_12 = val_vals[m];
30592 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
30593 CHECK_ACCESS(val_conv_12_ptr);
30594 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30595 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
30596 val_constr.data[m] = val_conv_12_conv;
30599 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30602 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30603 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30604 uint32_t ret_ref = 0;
30605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30608 ret_ref = (uintptr_t)ret_var.inner;
30609 if (ret_var.is_owned) {
30614 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
30615 LDKUnsignedNodeAnnouncement arg_conv;
30616 arg_conv.inner = (void*)(arg & (~1));
30617 arg_conv.is_owned = false;
30618 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30619 uint32_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30623 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
30624 LDKUnsignedNodeAnnouncement orig_conv;
30625 orig_conv.inner = (void*)(orig & (~1));
30626 orig_conv.is_owned = false;
30627 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30628 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30629 uint32_t ret_ref = 0;
30630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30633 ret_ref = (uintptr_t)ret_var.inner;
30634 if (ret_var.is_owned) {
30640 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
30641 LDKNodeAnnouncement this_obj_conv;
30642 this_obj_conv.inner = (void*)(this_obj & (~1));
30643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30645 NodeAnnouncement_free(this_obj_conv);
30648 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
30649 LDKNodeAnnouncement this_ptr_conv;
30650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30651 this_ptr_conv.is_owned = false;
30652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30653 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30654 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
30658 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
30659 LDKNodeAnnouncement 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 LDKSignature val_ref;
30664 CHECK(val->arr_len == 64);
30665 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30666 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30669 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
30670 LDKNodeAnnouncement this_ptr_conv;
30671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30672 this_ptr_conv.is_owned = false;
30673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30674 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30675 uint32_t ret_ref = 0;
30676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30679 ret_ref = (uintptr_t)ret_var.inner;
30680 if (ret_var.is_owned) {
30686 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
30687 LDKNodeAnnouncement this_ptr_conv;
30688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30689 this_ptr_conv.is_owned = false;
30690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30691 LDKUnsignedNodeAnnouncement val_conv;
30692 val_conv.inner = (void*)(val & (~1));
30693 val_conv.is_owned = (val & 1) || (val == 0);
30694 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30695 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30696 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30699 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
30700 LDKSignature signature_arg_ref;
30701 CHECK(signature_arg->arr_len == 64);
30702 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30703 LDKUnsignedNodeAnnouncement contents_arg_conv;
30704 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30705 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30706 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30707 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30708 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30709 uint32_t ret_ref = 0;
30710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30713 ret_ref = (uintptr_t)ret_var.inner;
30714 if (ret_var.is_owned) {
30720 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30721 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30722 uint32_t ret_ref = 0;
30723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30726 ret_ref = (uintptr_t)ret_var.inner;
30727 if (ret_var.is_owned) {
30732 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
30733 LDKNodeAnnouncement arg_conv;
30734 arg_conv.inner = (void*)(arg & (~1));
30735 arg_conv.is_owned = false;
30736 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30737 uint32_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
30741 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
30742 LDKNodeAnnouncement orig_conv;
30743 orig_conv.inner = (void*)(orig & (~1));
30744 orig_conv.is_owned = false;
30745 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30746 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
30747 uint32_t ret_ref = 0;
30748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30751 ret_ref = (uintptr_t)ret_var.inner;
30752 if (ret_var.is_owned) {
30758 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
30759 LDKUnsignedChannelAnnouncement this_obj_conv;
30760 this_obj_conv.inner = (void*)(this_obj & (~1));
30761 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30763 UnsignedChannelAnnouncement_free(this_obj_conv);
30766 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
30767 LDKUnsignedChannelAnnouncement this_ptr_conv;
30768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30769 this_ptr_conv.is_owned = false;
30770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30771 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
30772 uint32_t ret_ref = 0;
30773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30776 ret_ref = (uintptr_t)ret_var.inner;
30777 if (ret_var.is_owned) {
30783 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30784 LDKUnsignedChannelAnnouncement this_ptr_conv;
30785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30786 this_ptr_conv.is_owned = false;
30787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30788 LDKChannelFeatures val_conv;
30789 val_conv.inner = (void*)(val & (~1));
30790 val_conv.is_owned = (val & 1) || (val == 0);
30791 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30792 val_conv = ChannelFeatures_clone(&val_conv);
30793 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
30796 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
30797 LDKUnsignedChannelAnnouncement this_ptr_conv;
30798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30799 this_ptr_conv.is_owned = false;
30800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30801 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30802 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
30806 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30807 LDKUnsignedChannelAnnouncement this_ptr_conv;
30808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30809 this_ptr_conv.is_owned = false;
30810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30811 LDKThirtyTwoBytes val_ref;
30812 CHECK(val->arr_len == 32);
30813 memcpy(val_ref.data, val->elems, 32); FREE(val);
30814 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
30817 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
30818 LDKUnsignedChannelAnnouncement this_ptr_conv;
30819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30820 this_ptr_conv.is_owned = false;
30821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30822 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
30826 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30827 LDKUnsignedChannelAnnouncement this_ptr_conv;
30828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30829 this_ptr_conv.is_owned = false;
30830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30831 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
30834 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
30835 LDKUnsignedChannelAnnouncement 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30840 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
30844 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
30845 LDKUnsignedChannelAnnouncement this_ptr_conv;
30846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30847 this_ptr_conv.is_owned = false;
30848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30849 LDKPublicKey val_ref;
30850 CHECK(val->arr_len == 33);
30851 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30852 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
30855 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
30856 LDKUnsignedChannelAnnouncement this_ptr_conv;
30857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30858 this_ptr_conv.is_owned = false;
30859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30860 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30861 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
30865 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
30866 LDKUnsignedChannelAnnouncement this_ptr_conv;
30867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30868 this_ptr_conv.is_owned = false;
30869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30870 LDKPublicKey val_ref;
30871 CHECK(val->arr_len == 33);
30872 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30873 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
30876 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
30877 LDKUnsignedChannelAnnouncement this_ptr_conv;
30878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30879 this_ptr_conv.is_owned = false;
30880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30881 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30882 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
30886 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
30887 LDKUnsignedChannelAnnouncement this_ptr_conv;
30888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30889 this_ptr_conv.is_owned = false;
30890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30891 LDKPublicKey val_ref;
30892 CHECK(val->arr_len == 33);
30893 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30894 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
30897 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
30898 LDKUnsignedChannelAnnouncement this_ptr_conv;
30899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30900 this_ptr_conv.is_owned = false;
30901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30902 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30903 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
30907 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
30908 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
30913 CHECK(val->arr_len == 33);
30914 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30915 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
30918 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
30919 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
30920 uint32_t ret_ref = 0;
30921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30924 ret_ref = (uintptr_t)ret_var.inner;
30925 if (ret_var.is_owned) {
30930 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
30931 LDKUnsignedChannelAnnouncement arg_conv;
30932 arg_conv.inner = (void*)(arg & (~1));
30933 arg_conv.is_owned = false;
30934 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30935 uint32_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
30939 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
30940 LDKUnsignedChannelAnnouncement orig_conv;
30941 orig_conv.inner = (void*)(orig & (~1));
30942 orig_conv.is_owned = false;
30943 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30944 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
30945 uint32_t ret_ref = 0;
30946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30949 ret_ref = (uintptr_t)ret_var.inner;
30950 if (ret_var.is_owned) {
30956 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
30957 LDKChannelAnnouncement this_obj_conv;
30958 this_obj_conv.inner = (void*)(this_obj & (~1));
30959 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30961 ChannelAnnouncement_free(this_obj_conv);
30964 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
30965 LDKChannelAnnouncement this_ptr_conv;
30966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30967 this_ptr_conv.is_owned = false;
30968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30969 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30970 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
30974 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
30975 LDKChannelAnnouncement this_ptr_conv;
30976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30977 this_ptr_conv.is_owned = false;
30978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30979 LDKSignature val_ref;
30980 CHECK(val->arr_len == 64);
30981 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30982 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
30985 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
30986 LDKChannelAnnouncement this_ptr_conv;
30987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30988 this_ptr_conv.is_owned = false;
30989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30990 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30991 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
30995 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
30996 LDKChannelAnnouncement this_ptr_conv;
30997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30998 this_ptr_conv.is_owned = false;
30999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31000 LDKSignature val_ref;
31001 CHECK(val->arr_len == 64);
31002 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31003 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
31006 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
31007 LDKChannelAnnouncement this_ptr_conv;
31008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31009 this_ptr_conv.is_owned = false;
31010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31011 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31012 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
31016 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
31017 LDKChannelAnnouncement this_ptr_conv;
31018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31019 this_ptr_conv.is_owned = false;
31020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31021 LDKSignature val_ref;
31022 CHECK(val->arr_len == 64);
31023 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31024 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
31027 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
31028 LDKChannelAnnouncement this_ptr_conv;
31029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31030 this_ptr_conv.is_owned = false;
31031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31032 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31033 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
31037 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
31038 LDKChannelAnnouncement this_ptr_conv;
31039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31040 this_ptr_conv.is_owned = false;
31041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31042 LDKSignature val_ref;
31043 CHECK(val->arr_len == 64);
31044 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31045 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
31048 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
31049 LDKChannelAnnouncement this_ptr_conv;
31050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31051 this_ptr_conv.is_owned = false;
31052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31053 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
31054 uint32_t ret_ref = 0;
31055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31058 ret_ref = (uintptr_t)ret_var.inner;
31059 if (ret_var.is_owned) {
31065 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
31066 LDKChannelAnnouncement this_ptr_conv;
31067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31068 this_ptr_conv.is_owned = false;
31069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31070 LDKUnsignedChannelAnnouncement val_conv;
31071 val_conv.inner = (void*)(val & (~1));
31072 val_conv.is_owned = (val & 1) || (val == 0);
31073 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31074 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
31075 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
31078 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) {
31079 LDKSignature node_signature_1_arg_ref;
31080 CHECK(node_signature_1_arg->arr_len == 64);
31081 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
31082 LDKSignature node_signature_2_arg_ref;
31083 CHECK(node_signature_2_arg->arr_len == 64);
31084 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
31085 LDKSignature bitcoin_signature_1_arg_ref;
31086 CHECK(bitcoin_signature_1_arg->arr_len == 64);
31087 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
31088 LDKSignature bitcoin_signature_2_arg_ref;
31089 CHECK(bitcoin_signature_2_arg->arr_len == 64);
31090 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
31091 LDKUnsignedChannelAnnouncement contents_arg_conv;
31092 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31093 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31094 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31095 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
31096 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);
31097 uint32_t ret_ref = 0;
31098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31101 ret_ref = (uintptr_t)ret_var.inner;
31102 if (ret_var.is_owned) {
31108 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
31109 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
31110 uint32_t ret_ref = 0;
31111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31114 ret_ref = (uintptr_t)ret_var.inner;
31115 if (ret_var.is_owned) {
31120 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
31121 LDKChannelAnnouncement arg_conv;
31122 arg_conv.inner = (void*)(arg & (~1));
31123 arg_conv.is_owned = false;
31124 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31125 uint32_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
31129 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
31130 LDKChannelAnnouncement orig_conv;
31131 orig_conv.inner = (void*)(orig & (~1));
31132 orig_conv.is_owned = false;
31133 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31134 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
31135 uint32_t ret_ref = 0;
31136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31139 ret_ref = (uintptr_t)ret_var.inner;
31140 if (ret_var.is_owned) {
31146 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
31147 LDKUnsignedChannelUpdate this_obj_conv;
31148 this_obj_conv.inner = (void*)(this_obj & (~1));
31149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31151 UnsignedChannelUpdate_free(this_obj_conv);
31154 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
31155 LDKUnsignedChannelUpdate this_ptr_conv;
31156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31157 this_ptr_conv.is_owned = false;
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31159 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31160 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
31164 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31165 LDKUnsignedChannelUpdate this_ptr_conv;
31166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31167 this_ptr_conv.is_owned = false;
31168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31169 LDKThirtyTwoBytes val_ref;
31170 CHECK(val->arr_len == 32);
31171 memcpy(val_ref.data, val->elems, 32); FREE(val);
31172 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
31175 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
31176 LDKUnsignedChannelUpdate this_ptr_conv;
31177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31178 this_ptr_conv.is_owned = false;
31179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31180 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
31184 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
31185 LDKUnsignedChannelUpdate this_ptr_conv;
31186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31187 this_ptr_conv.is_owned = false;
31188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31189 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
31192 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
31193 LDKUnsignedChannelUpdate this_ptr_conv;
31194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31195 this_ptr_conv.is_owned = false;
31196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31197 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
31201 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
31202 LDKUnsignedChannelUpdate this_ptr_conv;
31203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31204 this_ptr_conv.is_owned = false;
31205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31206 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
31209 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
31210 LDKUnsignedChannelUpdate this_ptr_conv;
31211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31212 this_ptr_conv.is_owned = false;
31213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31214 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
31218 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
31219 LDKUnsignedChannelUpdate this_ptr_conv;
31220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31221 this_ptr_conv.is_owned = false;
31222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31223 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
31226 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
31227 LDKUnsignedChannelUpdate this_ptr_conv;
31228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31229 this_ptr_conv.is_owned = false;
31230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31231 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31235 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31236 LDKUnsignedChannelUpdate this_ptr_conv;
31237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31238 this_ptr_conv.is_owned = false;
31239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31240 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
31243 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
31244 LDKUnsignedChannelUpdate this_ptr_conv;
31245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31246 this_ptr_conv.is_owned = false;
31247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31248 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
31252 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31253 LDKUnsignedChannelUpdate this_ptr_conv;
31254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31255 this_ptr_conv.is_owned = false;
31256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31257 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
31260 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
31261 LDKUnsignedChannelUpdate this_ptr_conv;
31262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31263 this_ptr_conv.is_owned = false;
31264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31265 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
31269 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
31270 LDKUnsignedChannelUpdate this_ptr_conv;
31271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31272 this_ptr_conv.is_owned = false;
31273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31274 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
31277 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
31278 LDKUnsignedChannelUpdate this_ptr_conv;
31279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31280 this_ptr_conv.is_owned = false;
31281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31282 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
31286 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
31287 LDKUnsignedChannelUpdate this_ptr_conv;
31288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31289 this_ptr_conv.is_owned = false;
31290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31291 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
31294 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint32_t this_ptr, int8_tArray val) {
31295 LDKUnsignedChannelUpdate this_ptr_conv;
31296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31297 this_ptr_conv.is_owned = false;
31298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31299 LDKCVec_u8Z val_ref;
31300 val_ref.datalen = val->arr_len;
31301 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31302 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31303 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
31306 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
31307 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
31308 uint32_t ret_ref = 0;
31309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31312 ret_ref = (uintptr_t)ret_var.inner;
31313 if (ret_var.is_owned) {
31318 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
31319 LDKUnsignedChannelUpdate arg_conv;
31320 arg_conv.inner = (void*)(arg & (~1));
31321 arg_conv.is_owned = false;
31322 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31323 uint32_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
31327 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
31328 LDKUnsignedChannelUpdate orig_conv;
31329 orig_conv.inner = (void*)(orig & (~1));
31330 orig_conv.is_owned = false;
31331 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31332 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
31333 uint32_t ret_ref = 0;
31334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31337 ret_ref = (uintptr_t)ret_var.inner;
31338 if (ret_var.is_owned) {
31344 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
31345 LDKChannelUpdate this_obj_conv;
31346 this_obj_conv.inner = (void*)(this_obj & (~1));
31347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31349 ChannelUpdate_free(this_obj_conv);
31352 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
31353 LDKChannelUpdate this_ptr_conv;
31354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31355 this_ptr_conv.is_owned = false;
31356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31357 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31358 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
31362 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
31363 LDKChannelUpdate this_ptr_conv;
31364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31365 this_ptr_conv.is_owned = false;
31366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31367 LDKSignature val_ref;
31368 CHECK(val->arr_len == 64);
31369 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31370 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
31373 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
31374 LDKChannelUpdate this_ptr_conv;
31375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31376 this_ptr_conv.is_owned = false;
31377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31378 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
31379 uint32_t ret_ref = 0;
31380 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31381 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31383 ret_ref = (uintptr_t)ret_var.inner;
31384 if (ret_var.is_owned) {
31390 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
31391 LDKChannelUpdate this_ptr_conv;
31392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31393 this_ptr_conv.is_owned = false;
31394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31395 LDKUnsignedChannelUpdate val_conv;
31396 val_conv.inner = (void*)(val & (~1));
31397 val_conv.is_owned = (val & 1) || (val == 0);
31398 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31399 val_conv = UnsignedChannelUpdate_clone(&val_conv);
31400 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
31403 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
31404 LDKSignature signature_arg_ref;
31405 CHECK(signature_arg->arr_len == 64);
31406 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31407 LDKUnsignedChannelUpdate contents_arg_conv;
31408 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31409 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31410 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31411 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
31412 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
31413 uint32_t ret_ref = 0;
31414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31417 ret_ref = (uintptr_t)ret_var.inner;
31418 if (ret_var.is_owned) {
31424 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31425 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31426 uint32_t ret_ref = 0;
31427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31430 ret_ref = (uintptr_t)ret_var.inner;
31431 if (ret_var.is_owned) {
31436 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
31437 LDKChannelUpdate arg_conv;
31438 arg_conv.inner = (void*)(arg & (~1));
31439 arg_conv.is_owned = false;
31440 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31441 uint32_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
31445 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
31446 LDKChannelUpdate orig_conv;
31447 orig_conv.inner = (void*)(orig & (~1));
31448 orig_conv.is_owned = false;
31449 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31450 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31451 uint32_t ret_ref = 0;
31452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31455 ret_ref = (uintptr_t)ret_var.inner;
31456 if (ret_var.is_owned) {
31462 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
31463 LDKQueryChannelRange this_obj_conv;
31464 this_obj_conv.inner = (void*)(this_obj & (~1));
31465 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31467 QueryChannelRange_free(this_obj_conv);
31470 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
31471 LDKQueryChannelRange this_ptr_conv;
31472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31473 this_ptr_conv.is_owned = false;
31474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31475 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31476 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
31480 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31481 LDKQueryChannelRange this_ptr_conv;
31482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31483 this_ptr_conv.is_owned = false;
31484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31485 LDKThirtyTwoBytes val_ref;
31486 CHECK(val->arr_len == 32);
31487 memcpy(val_ref.data, val->elems, 32); FREE(val);
31488 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31491 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
31492 LDKQueryChannelRange this_ptr_conv;
31493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31494 this_ptr_conv.is_owned = false;
31495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31496 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31500 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31501 LDKQueryChannelRange this_ptr_conv;
31502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31503 this_ptr_conv.is_owned = false;
31504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31505 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31508 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31509 LDKQueryChannelRange this_ptr_conv;
31510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31511 this_ptr_conv.is_owned = false;
31512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31513 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31517 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31518 LDKQueryChannelRange this_ptr_conv;
31519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31520 this_ptr_conv.is_owned = false;
31521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31522 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31525 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) {
31526 LDKThirtyTwoBytes chain_hash_arg_ref;
31527 CHECK(chain_hash_arg->arr_len == 32);
31528 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31529 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31530 uint32_t ret_ref = 0;
31531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31534 ret_ref = (uintptr_t)ret_var.inner;
31535 if (ret_var.is_owned) {
31541 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31542 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31543 uint32_t ret_ref = 0;
31544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31547 ret_ref = (uintptr_t)ret_var.inner;
31548 if (ret_var.is_owned) {
31553 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
31554 LDKQueryChannelRange arg_conv;
31555 arg_conv.inner = (void*)(arg & (~1));
31556 arg_conv.is_owned = false;
31557 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31558 uint32_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
31562 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
31563 LDKQueryChannelRange orig_conv;
31564 orig_conv.inner = (void*)(orig & (~1));
31565 orig_conv.is_owned = false;
31566 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31567 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31568 uint32_t ret_ref = 0;
31569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31572 ret_ref = (uintptr_t)ret_var.inner;
31573 if (ret_var.is_owned) {
31579 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
31580 LDKReplyChannelRange this_obj_conv;
31581 this_obj_conv.inner = (void*)(this_obj & (~1));
31582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31584 ReplyChannelRange_free(this_obj_conv);
31587 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
31588 LDKReplyChannelRange this_ptr_conv;
31589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31590 this_ptr_conv.is_owned = false;
31591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31592 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31593 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
31597 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31598 LDKReplyChannelRange this_ptr_conv;
31599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31600 this_ptr_conv.is_owned = false;
31601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31602 LDKThirtyTwoBytes val_ref;
31603 CHECK(val->arr_len == 32);
31604 memcpy(val_ref.data, val->elems, 32); FREE(val);
31605 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31608 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
31609 LDKReplyChannelRange this_ptr_conv;
31610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31611 this_ptr_conv.is_owned = false;
31612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31613 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31617 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31618 LDKReplyChannelRange this_ptr_conv;
31619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31620 this_ptr_conv.is_owned = false;
31621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31622 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31625 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31626 LDKReplyChannelRange this_ptr_conv;
31627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31628 this_ptr_conv.is_owned = false;
31629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31630 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31634 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31635 LDKReplyChannelRange this_ptr_conv;
31636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31637 this_ptr_conv.is_owned = false;
31638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31639 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31642 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
31643 LDKReplyChannelRange this_ptr_conv;
31644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31645 this_ptr_conv.is_owned = false;
31646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31647 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31651 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
31652 LDKReplyChannelRange this_ptr_conv;
31653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31654 this_ptr_conv.is_owned = false;
31655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31656 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31659 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31660 LDKReplyChannelRange this_ptr_conv;
31661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31662 this_ptr_conv.is_owned = false;
31663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31664 LDKCVec_u64Z val_constr;
31665 val_constr.datalen = val->arr_len;
31666 if (val_constr.datalen > 0)
31667 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31669 val_constr.data = NULL;
31670 int64_t* val_vals = val->elems;
31671 for (size_t i = 0; i < val_constr.datalen; i++) {
31672 int64_t val_conv_8 = val_vals[i];
31673 val_constr.data[i] = val_conv_8;
31676 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31679 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) {
31680 LDKThirtyTwoBytes chain_hash_arg_ref;
31681 CHECK(chain_hash_arg->arr_len == 32);
31682 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31683 LDKCVec_u64Z short_channel_ids_arg_constr;
31684 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31685 if (short_channel_ids_arg_constr.datalen > 0)
31686 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31688 short_channel_ids_arg_constr.data = NULL;
31689 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31690 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31691 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31692 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31694 FREE(short_channel_ids_arg);
31695 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31696 uint32_t ret_ref = 0;
31697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31700 ret_ref = (uintptr_t)ret_var.inner;
31701 if (ret_var.is_owned) {
31707 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31708 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31709 uint32_t ret_ref = 0;
31710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31713 ret_ref = (uintptr_t)ret_var.inner;
31714 if (ret_var.is_owned) {
31719 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
31720 LDKReplyChannelRange arg_conv;
31721 arg_conv.inner = (void*)(arg & (~1));
31722 arg_conv.is_owned = false;
31723 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31724 uint32_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
31728 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
31729 LDKReplyChannelRange orig_conv;
31730 orig_conv.inner = (void*)(orig & (~1));
31731 orig_conv.is_owned = false;
31732 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31733 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
31734 uint32_t ret_ref = 0;
31735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31738 ret_ref = (uintptr_t)ret_var.inner;
31739 if (ret_var.is_owned) {
31745 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
31746 LDKQueryShortChannelIds this_obj_conv;
31747 this_obj_conv.inner = (void*)(this_obj & (~1));
31748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31750 QueryShortChannelIds_free(this_obj_conv);
31753 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
31754 LDKQueryShortChannelIds this_ptr_conv;
31755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31756 this_ptr_conv.is_owned = false;
31757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31758 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31759 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
31763 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31764 LDKQueryShortChannelIds this_ptr_conv;
31765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31766 this_ptr_conv.is_owned = false;
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31768 LDKThirtyTwoBytes val_ref;
31769 CHECK(val->arr_len == 32);
31770 memcpy(val_ref.data, val->elems, 32); FREE(val);
31771 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
31774 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31775 LDKQueryShortChannelIds this_ptr_conv;
31776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31777 this_ptr_conv.is_owned = false;
31778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31779 LDKCVec_u64Z val_constr;
31780 val_constr.datalen = val->arr_len;
31781 if (val_constr.datalen > 0)
31782 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31784 val_constr.data = NULL;
31785 int64_t* val_vals = val->elems;
31786 for (size_t i = 0; i < val_constr.datalen; i++) {
31787 int64_t val_conv_8 = val_vals[i];
31788 val_constr.data[i] = val_conv_8;
31791 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
31794 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
31795 LDKThirtyTwoBytes chain_hash_arg_ref;
31796 CHECK(chain_hash_arg->arr_len == 32);
31797 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31798 LDKCVec_u64Z short_channel_ids_arg_constr;
31799 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31800 if (short_channel_ids_arg_constr.datalen > 0)
31801 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31803 short_channel_ids_arg_constr.data = NULL;
31804 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31805 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31806 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31807 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31809 FREE(short_channel_ids_arg);
31810 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
31811 uint32_t ret_ref = 0;
31812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31815 ret_ref = (uintptr_t)ret_var.inner;
31816 if (ret_var.is_owned) {
31822 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
31823 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
31824 uint32_t ret_ref = 0;
31825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31828 ret_ref = (uintptr_t)ret_var.inner;
31829 if (ret_var.is_owned) {
31834 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
31835 LDKQueryShortChannelIds arg_conv;
31836 arg_conv.inner = (void*)(arg & (~1));
31837 arg_conv.is_owned = false;
31838 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31839 uint32_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
31843 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
31844 LDKQueryShortChannelIds orig_conv;
31845 orig_conv.inner = (void*)(orig & (~1));
31846 orig_conv.is_owned = false;
31847 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31848 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
31849 uint32_t ret_ref = 0;
31850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31853 ret_ref = (uintptr_t)ret_var.inner;
31854 if (ret_var.is_owned) {
31860 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
31861 LDKReplyShortChannelIdsEnd this_obj_conv;
31862 this_obj_conv.inner = (void*)(this_obj & (~1));
31863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31865 ReplyShortChannelIdsEnd_free(this_obj_conv);
31868 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
31869 LDKReplyShortChannelIdsEnd this_ptr_conv;
31870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31871 this_ptr_conv.is_owned = false;
31872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31873 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31874 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
31878 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31879 LDKReplyShortChannelIdsEnd this_ptr_conv;
31880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31881 this_ptr_conv.is_owned = false;
31882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31883 LDKThirtyTwoBytes val_ref;
31884 CHECK(val->arr_len == 32);
31885 memcpy(val_ref.data, val->elems, 32); FREE(val);
31886 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
31889 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
31890 LDKReplyShortChannelIdsEnd this_ptr_conv;
31891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31892 this_ptr_conv.is_owned = false;
31893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31894 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
31898 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
31899 LDKReplyShortChannelIdsEnd this_ptr_conv;
31900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31901 this_ptr_conv.is_owned = false;
31902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31903 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
31906 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
31907 LDKThirtyTwoBytes chain_hash_arg_ref;
31908 CHECK(chain_hash_arg->arr_len == 32);
31909 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31910 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
31911 uint32_t ret_ref = 0;
31912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31915 ret_ref = (uintptr_t)ret_var.inner;
31916 if (ret_var.is_owned) {
31922 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
31923 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
31924 uint32_t ret_ref = 0;
31925 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31926 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31927 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31928 ret_ref = (uintptr_t)ret_var.inner;
31929 if (ret_var.is_owned) {
31934 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
31935 LDKReplyShortChannelIdsEnd arg_conv;
31936 arg_conv.inner = (void*)(arg & (~1));
31937 arg_conv.is_owned = false;
31938 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31939 uint32_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
31943 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
31944 LDKReplyShortChannelIdsEnd orig_conv;
31945 orig_conv.inner = (void*)(orig & (~1));
31946 orig_conv.is_owned = false;
31947 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31948 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
31949 uint32_t ret_ref = 0;
31950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31953 ret_ref = (uintptr_t)ret_var.inner;
31954 if (ret_var.is_owned) {
31960 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
31961 LDKGossipTimestampFilter this_obj_conv;
31962 this_obj_conv.inner = (void*)(this_obj & (~1));
31963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31965 GossipTimestampFilter_free(this_obj_conv);
31968 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
31969 LDKGossipTimestampFilter this_ptr_conv;
31970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31971 this_ptr_conv.is_owned = false;
31972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31973 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31974 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
31978 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31979 LDKGossipTimestampFilter this_ptr_conv;
31980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31981 this_ptr_conv.is_owned = false;
31982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31983 LDKThirtyTwoBytes val_ref;
31984 CHECK(val->arr_len == 32);
31985 memcpy(val_ref.data, val->elems, 32); FREE(val);
31986 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
31989 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
31990 LDKGossipTimestampFilter this_ptr_conv;
31991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31992 this_ptr_conv.is_owned = false;
31993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31994 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
31998 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
31999 LDKGossipTimestampFilter this_ptr_conv;
32000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32001 this_ptr_conv.is_owned = false;
32002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32003 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
32006 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
32007 LDKGossipTimestampFilter this_ptr_conv;
32008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32009 this_ptr_conv.is_owned = false;
32010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32011 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
32015 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
32016 LDKGossipTimestampFilter this_ptr_conv;
32017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32018 this_ptr_conv.is_owned = false;
32019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32020 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
32023 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) {
32024 LDKThirtyTwoBytes chain_hash_arg_ref;
32025 CHECK(chain_hash_arg->arr_len == 32);
32026 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32027 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
32028 uint32_t ret_ref = 0;
32029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32032 ret_ref = (uintptr_t)ret_var.inner;
32033 if (ret_var.is_owned) {
32039 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
32040 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
32041 uint32_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) {
32051 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
32052 LDKGossipTimestampFilter arg_conv;
32053 arg_conv.inner = (void*)(arg & (~1));
32054 arg_conv.is_owned = false;
32055 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32056 uint32_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
32060 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
32061 LDKGossipTimestampFilter orig_conv;
32062 orig_conv.inner = (void*)(orig & (~1));
32063 orig_conv.is_owned = false;
32064 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32065 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
32066 uint32_t ret_ref = 0;
32067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32070 ret_ref = (uintptr_t)ret_var.inner;
32071 if (ret_var.is_owned) {
32077 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
32078 if ((this_ptr & 1) != 0) return;
32079 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32080 CHECK_ACCESS(this_ptr_ptr);
32081 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
32082 FREE((void*)this_ptr);
32083 ErrorAction_free(this_ptr_conv);
32086 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
32087 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32088 *ret_copy = ErrorAction_clone(arg);
32089 uint32_t ret_ref = (uintptr_t)ret_copy;
32092 uint32_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
32093 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
32094 uint32_t ret_conv = ErrorAction_clone_ptr(arg_conv);
32098 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
32099 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
32100 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32101 *ret_copy = ErrorAction_clone(orig_conv);
32102 uint32_t ret_ref = (uintptr_t)ret_copy;
32106 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
32107 LDKErrorMessage msg_conv;
32108 msg_conv.inner = (void*)(msg & (~1));
32109 msg_conv.is_owned = (msg & 1) || (msg == 0);
32110 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32111 msg_conv = ErrorMessage_clone(&msg_conv);
32112 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32113 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
32114 uint32_t ret_ref = (uintptr_t)ret_copy;
32118 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
32119 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32120 *ret_copy = ErrorAction_ignore_error();
32121 uint32_t ret_ref = (uintptr_t)ret_copy;
32125 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
32126 LDKLevel a_conv = LDKLevel_from_js(a);
32127 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32128 *ret_copy = ErrorAction_ignore_and_log(a_conv);
32129 uint32_t ret_ref = (uintptr_t)ret_copy;
32133 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
32134 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32135 *ret_copy = ErrorAction_ignore_duplicate_gossip();
32136 uint32_t ret_ref = (uintptr_t)ret_copy;
32140 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
32141 LDKErrorMessage msg_conv;
32142 msg_conv.inner = (void*)(msg & (~1));
32143 msg_conv.is_owned = (msg & 1) || (msg == 0);
32144 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32145 msg_conv = ErrorMessage_clone(&msg_conv);
32146 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32147 *ret_copy = ErrorAction_send_error_message(msg_conv);
32148 uint32_t ret_ref = (uintptr_t)ret_copy;
32152 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
32153 LDKWarningMessage msg_conv;
32154 msg_conv.inner = (void*)(msg & (~1));
32155 msg_conv.is_owned = (msg & 1) || (msg == 0);
32156 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32157 msg_conv = WarningMessage_clone(&msg_conv);
32158 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
32159 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32160 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
32161 uint32_t ret_ref = (uintptr_t)ret_copy;
32165 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
32166 LDKLightningError this_obj_conv;
32167 this_obj_conv.inner = (void*)(this_obj & (~1));
32168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32170 LightningError_free(this_obj_conv);
32173 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
32174 LDKLightningError this_ptr_conv;
32175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32176 this_ptr_conv.is_owned = false;
32177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32178 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
32179 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32184 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
32185 LDKLightningError this_ptr_conv;
32186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32187 this_ptr_conv.is_owned = false;
32188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32189 LDKStr val_conv = str_ref_to_owned_c(val);
32190 LightningError_set_err(&this_ptr_conv, val_conv);
32193 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
32194 LDKLightningError this_ptr_conv;
32195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32196 this_ptr_conv.is_owned = false;
32197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32198 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32199 *ret_copy = LightningError_get_action(&this_ptr_conv);
32200 uint32_t ret_ref = (uintptr_t)ret_copy;
32204 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
32205 LDKLightningError this_ptr_conv;
32206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32207 this_ptr_conv.is_owned = false;
32208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32209 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32210 CHECK_ACCESS(val_ptr);
32211 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
32212 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
32213 LightningError_set_action(&this_ptr_conv, val_conv);
32216 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
32217 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
32218 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
32219 CHECK_ACCESS(action_arg_ptr);
32220 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
32221 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
32222 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
32223 uint32_t ret_ref = 0;
32224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32227 ret_ref = (uintptr_t)ret_var.inner;
32228 if (ret_var.is_owned) {
32234 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
32235 LDKLightningError ret_var = LightningError_clone(arg);
32236 uint32_t ret_ref = 0;
32237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32240 ret_ref = (uintptr_t)ret_var.inner;
32241 if (ret_var.is_owned) {
32246 uint32_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
32247 LDKLightningError arg_conv;
32248 arg_conv.inner = (void*)(arg & (~1));
32249 arg_conv.is_owned = false;
32250 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32251 uint32_t ret_conv = LightningError_clone_ptr(&arg_conv);
32255 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
32256 LDKLightningError orig_conv;
32257 orig_conv.inner = (void*)(orig & (~1));
32258 orig_conv.is_owned = false;
32259 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32260 LDKLightningError ret_var = LightningError_clone(&orig_conv);
32261 uint32_t ret_ref = 0;
32262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32265 ret_ref = (uintptr_t)ret_var.inner;
32266 if (ret_var.is_owned) {
32272 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
32273 LDKCommitmentUpdate this_obj_conv;
32274 this_obj_conv.inner = (void*)(this_obj & (~1));
32275 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32277 CommitmentUpdate_free(this_obj_conv);
32280 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
32281 LDKCommitmentUpdate this_ptr_conv;
32282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32283 this_ptr_conv.is_owned = false;
32284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32285 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
32286 uint32_tArray ret_arr = NULL;
32287 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32288 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32289 for (size_t p = 0; p < ret_var.datalen; p++) {
32290 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
32291 uint32_t ret_conv_15_ref = 0;
32292 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32293 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
32295 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
32296 if (ret_conv_15_var.is_owned) {
32297 ret_conv_15_ref |= 1;
32299 ret_arr_ptr[p] = ret_conv_15_ref;
32302 FREE(ret_var.data);
32306 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
32307 LDKCommitmentUpdate this_ptr_conv;
32308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32309 this_ptr_conv.is_owned = false;
32310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32311 LDKCVec_UpdateAddHTLCZ val_constr;
32312 val_constr.datalen = val->arr_len;
32313 if (val_constr.datalen > 0)
32314 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32316 val_constr.data = NULL;
32317 uint32_t* val_vals = val->elems;
32318 for (size_t p = 0; p < val_constr.datalen; p++) {
32319 uint32_t val_conv_15 = val_vals[p];
32320 LDKUpdateAddHTLC val_conv_15_conv;
32321 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
32322 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
32323 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
32324 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
32325 val_constr.data[p] = val_conv_15_conv;
32328 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
32331 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
32332 LDKCommitmentUpdate this_ptr_conv;
32333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32334 this_ptr_conv.is_owned = false;
32335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32336 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
32337 uint32_tArray ret_arr = NULL;
32338 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32339 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32340 for (size_t t = 0; t < ret_var.datalen; t++) {
32341 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
32342 uint32_t ret_conv_19_ref = 0;
32343 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32344 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
32346 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
32347 if (ret_conv_19_var.is_owned) {
32348 ret_conv_19_ref |= 1;
32350 ret_arr_ptr[t] = ret_conv_19_ref;
32353 FREE(ret_var.data);
32357 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
32358 LDKCommitmentUpdate this_ptr_conv;
32359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32360 this_ptr_conv.is_owned = false;
32361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32362 LDKCVec_UpdateFulfillHTLCZ val_constr;
32363 val_constr.datalen = val->arr_len;
32364 if (val_constr.datalen > 0)
32365 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32367 val_constr.data = NULL;
32368 uint32_t* val_vals = val->elems;
32369 for (size_t t = 0; t < val_constr.datalen; t++) {
32370 uint32_t val_conv_19 = val_vals[t];
32371 LDKUpdateFulfillHTLC val_conv_19_conv;
32372 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
32373 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
32374 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
32375 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
32376 val_constr.data[t] = val_conv_19_conv;
32379 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
32382 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
32383 LDKCommitmentUpdate this_ptr_conv;
32384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32385 this_ptr_conv.is_owned = false;
32386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32387 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
32388 uint32_tArray ret_arr = NULL;
32389 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32390 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32391 for (size_t q = 0; q < ret_var.datalen; q++) {
32392 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
32393 uint32_t ret_conv_16_ref = 0;
32394 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32395 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32397 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
32398 if (ret_conv_16_var.is_owned) {
32399 ret_conv_16_ref |= 1;
32401 ret_arr_ptr[q] = ret_conv_16_ref;
32404 FREE(ret_var.data);
32408 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
32409 LDKCommitmentUpdate this_ptr_conv;
32410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32411 this_ptr_conv.is_owned = false;
32412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32413 LDKCVec_UpdateFailHTLCZ val_constr;
32414 val_constr.datalen = val->arr_len;
32415 if (val_constr.datalen > 0)
32416 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32418 val_constr.data = NULL;
32419 uint32_t* val_vals = val->elems;
32420 for (size_t q = 0; q < val_constr.datalen; q++) {
32421 uint32_t val_conv_16 = val_vals[q];
32422 LDKUpdateFailHTLC val_conv_16_conv;
32423 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
32424 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
32425 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32426 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
32427 val_constr.data[q] = val_conv_16_conv;
32430 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
32433 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
32434 LDKCommitmentUpdate this_ptr_conv;
32435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32436 this_ptr_conv.is_owned = false;
32437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32438 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
32439 uint32_tArray ret_arr = NULL;
32440 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32441 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32442 for (size_t z = 0; z < ret_var.datalen; z++) {
32443 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
32444 uint32_t ret_conv_25_ref = 0;
32445 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32446 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32448 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
32449 if (ret_conv_25_var.is_owned) {
32450 ret_conv_25_ref |= 1;
32452 ret_arr_ptr[z] = ret_conv_25_ref;
32455 FREE(ret_var.data);
32459 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) {
32460 LDKCommitmentUpdate this_ptr_conv;
32461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32462 this_ptr_conv.is_owned = false;
32463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32464 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32465 val_constr.datalen = val->arr_len;
32466 if (val_constr.datalen > 0)
32467 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32469 val_constr.data = NULL;
32470 uint32_t* val_vals = val->elems;
32471 for (size_t z = 0; z < val_constr.datalen; z++) {
32472 uint32_t val_conv_25 = val_vals[z];
32473 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32474 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
32475 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
32476 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32477 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32478 val_constr.data[z] = val_conv_25_conv;
32481 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32484 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
32485 LDKCommitmentUpdate this_ptr_conv;
32486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32487 this_ptr_conv.is_owned = false;
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32489 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32490 uint32_t ret_ref = 0;
32491 if ((uintptr_t)ret_var.inner > 4096) {
32492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32495 ret_ref = (uintptr_t)ret_var.inner;
32496 if (ret_var.is_owned) {
32503 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
32504 LDKCommitmentUpdate this_ptr_conv;
32505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32506 this_ptr_conv.is_owned = false;
32507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32508 LDKUpdateFee val_conv;
32509 val_conv.inner = (void*)(val & (~1));
32510 val_conv.is_owned = (val & 1) || (val == 0);
32511 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32512 val_conv = UpdateFee_clone(&val_conv);
32513 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32516 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
32517 LDKCommitmentUpdate this_ptr_conv;
32518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32519 this_ptr_conv.is_owned = false;
32520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32521 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32522 uint32_t ret_ref = 0;
32523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32526 ret_ref = (uintptr_t)ret_var.inner;
32527 if (ret_var.is_owned) {
32533 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
32534 LDKCommitmentUpdate this_ptr_conv;
32535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32536 this_ptr_conv.is_owned = false;
32537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32538 LDKCommitmentSigned val_conv;
32539 val_conv.inner = (void*)(val & (~1));
32540 val_conv.is_owned = (val & 1) || (val == 0);
32541 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32542 val_conv = CommitmentSigned_clone(&val_conv);
32543 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32546 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) {
32547 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32548 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
32549 if (update_add_htlcs_arg_constr.datalen > 0)
32550 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32552 update_add_htlcs_arg_constr.data = NULL;
32553 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
32554 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32555 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32556 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32557 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
32558 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
32559 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32560 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32561 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32563 FREE(update_add_htlcs_arg);
32564 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32565 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
32566 if (update_fulfill_htlcs_arg_constr.datalen > 0)
32567 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32569 update_fulfill_htlcs_arg_constr.data = NULL;
32570 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
32571 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32572 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32573 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32574 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
32575 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
32576 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32577 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32578 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32580 FREE(update_fulfill_htlcs_arg);
32581 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32582 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
32583 if (update_fail_htlcs_arg_constr.datalen > 0)
32584 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32586 update_fail_htlcs_arg_constr.data = NULL;
32587 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
32588 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32589 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32590 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32591 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
32592 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
32593 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32594 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32595 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32597 FREE(update_fail_htlcs_arg);
32598 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32599 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
32600 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32601 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32603 update_fail_malformed_htlcs_arg_constr.data = NULL;
32604 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
32605 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32606 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32607 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32608 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
32609 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);
32610 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32611 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32612 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32614 FREE(update_fail_malformed_htlcs_arg);
32615 LDKUpdateFee update_fee_arg_conv;
32616 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
32617 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
32618 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32619 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32620 LDKCommitmentSigned commitment_signed_arg_conv;
32621 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
32622 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
32623 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32624 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32625 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);
32626 uint32_t ret_ref = 0;
32627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32630 ret_ref = (uintptr_t)ret_var.inner;
32631 if (ret_var.is_owned) {
32637 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32638 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32639 uint32_t ret_ref = 0;
32640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32643 ret_ref = (uintptr_t)ret_var.inner;
32644 if (ret_var.is_owned) {
32649 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
32650 LDKCommitmentUpdate arg_conv;
32651 arg_conv.inner = (void*)(arg & (~1));
32652 arg_conv.is_owned = false;
32653 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32654 uint32_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
32658 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
32659 LDKCommitmentUpdate orig_conv;
32660 orig_conv.inner = (void*)(orig & (~1));
32661 orig_conv.is_owned = false;
32662 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32663 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32664 uint32_t ret_ref = 0;
32665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32668 ret_ref = (uintptr_t)ret_var.inner;
32669 if (ret_var.is_owned) {
32675 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
32676 if ((this_ptr & 1) != 0) return;
32677 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32678 CHECK_ACCESS(this_ptr_ptr);
32679 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32680 FREE((void*)this_ptr);
32681 ChannelMessageHandler_free(this_ptr_conv);
32684 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
32685 if ((this_ptr & 1) != 0) return;
32686 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32687 CHECK_ACCESS(this_ptr_ptr);
32688 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32689 FREE((void*)this_ptr);
32690 RoutingMessageHandler_free(this_ptr_conv);
32693 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
32694 LDKAcceptChannel obj_conv;
32695 obj_conv.inner = (void*)(obj & (~1));
32696 obj_conv.is_owned = false;
32697 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32698 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32699 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32700 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32701 CVec_u8Z_free(ret_var);
32705 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
32706 LDKu8slice ser_ref;
32707 ser_ref.datalen = ser->arr_len;
32708 ser_ref.data = ser->elems;
32709 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32710 *ret_conv = AcceptChannel_read(ser_ref);
32712 return (uint32_t)ret_conv;
32715 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
32716 LDKAnnouncementSignatures obj_conv;
32717 obj_conv.inner = (void*)(obj & (~1));
32718 obj_conv.is_owned = false;
32719 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32720 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32721 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32722 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32723 CVec_u8Z_free(ret_var);
32727 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
32728 LDKu8slice ser_ref;
32729 ser_ref.datalen = ser->arr_len;
32730 ser_ref.data = ser->elems;
32731 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32732 *ret_conv = AnnouncementSignatures_read(ser_ref);
32734 return (uint32_t)ret_conv;
32737 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
32738 LDKChannelReestablish obj_conv;
32739 obj_conv.inner = (void*)(obj & (~1));
32740 obj_conv.is_owned = false;
32741 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32742 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32743 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32744 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32745 CVec_u8Z_free(ret_var);
32749 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
32750 LDKu8slice ser_ref;
32751 ser_ref.datalen = ser->arr_len;
32752 ser_ref.data = ser->elems;
32753 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
32754 *ret_conv = ChannelReestablish_read(ser_ref);
32756 return (uint32_t)ret_conv;
32759 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
32760 LDKClosingSigned obj_conv;
32761 obj_conv.inner = (void*)(obj & (~1));
32762 obj_conv.is_owned = false;
32763 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32764 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
32765 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32766 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32767 CVec_u8Z_free(ret_var);
32771 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
32772 LDKu8slice ser_ref;
32773 ser_ref.datalen = ser->arr_len;
32774 ser_ref.data = ser->elems;
32775 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
32776 *ret_conv = ClosingSigned_read(ser_ref);
32778 return (uint32_t)ret_conv;
32781 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
32782 LDKClosingSignedFeeRange obj_conv;
32783 obj_conv.inner = (void*)(obj & (~1));
32784 obj_conv.is_owned = false;
32785 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32786 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
32787 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32788 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32789 CVec_u8Z_free(ret_var);
32793 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
32794 LDKu8slice ser_ref;
32795 ser_ref.datalen = ser->arr_len;
32796 ser_ref.data = ser->elems;
32797 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
32798 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
32800 return (uint32_t)ret_conv;
32803 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
32804 LDKCommitmentSigned obj_conv;
32805 obj_conv.inner = (void*)(obj & (~1));
32806 obj_conv.is_owned = false;
32807 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32808 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
32809 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32810 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32811 CVec_u8Z_free(ret_var);
32815 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
32816 LDKu8slice ser_ref;
32817 ser_ref.datalen = ser->arr_len;
32818 ser_ref.data = ser->elems;
32819 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
32820 *ret_conv = CommitmentSigned_read(ser_ref);
32822 return (uint32_t)ret_conv;
32825 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
32826 LDKFundingCreated obj_conv;
32827 obj_conv.inner = (void*)(obj & (~1));
32828 obj_conv.is_owned = false;
32829 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32830 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
32831 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32832 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32833 CVec_u8Z_free(ret_var);
32837 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
32838 LDKu8slice ser_ref;
32839 ser_ref.datalen = ser->arr_len;
32840 ser_ref.data = ser->elems;
32841 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
32842 *ret_conv = FundingCreated_read(ser_ref);
32844 return (uint32_t)ret_conv;
32847 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
32848 LDKFundingSigned obj_conv;
32849 obj_conv.inner = (void*)(obj & (~1));
32850 obj_conv.is_owned = false;
32851 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32852 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
32853 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32854 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32855 CVec_u8Z_free(ret_var);
32859 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
32860 LDKu8slice ser_ref;
32861 ser_ref.datalen = ser->arr_len;
32862 ser_ref.data = ser->elems;
32863 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32864 *ret_conv = FundingSigned_read(ser_ref);
32866 return (uint32_t)ret_conv;
32869 int8_tArray __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint32_t obj) {
32870 LDKChannelReady obj_conv;
32871 obj_conv.inner = (void*)(obj & (~1));
32872 obj_conv.is_owned = false;
32873 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32874 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
32875 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32876 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32877 CVec_u8Z_free(ret_var);
32881 uint32_t __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
32882 LDKu8slice ser_ref;
32883 ser_ref.datalen = ser->arr_len;
32884 ser_ref.data = ser->elems;
32885 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32886 *ret_conv = ChannelReady_read(ser_ref);
32888 return (uint32_t)ret_conv;
32891 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
32893 obj_conv.inner = (void*)(obj & (~1));
32894 obj_conv.is_owned = false;
32895 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32896 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
32897 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32898 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32899 CVec_u8Z_free(ret_var);
32903 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
32904 LDKu8slice ser_ref;
32905 ser_ref.datalen = ser->arr_len;
32906 ser_ref.data = ser->elems;
32907 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32908 *ret_conv = Init_read(ser_ref);
32910 return (uint32_t)ret_conv;
32913 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
32914 LDKOpenChannel obj_conv;
32915 obj_conv.inner = (void*)(obj & (~1));
32916 obj_conv.is_owned = false;
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32918 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
32919 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32920 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32921 CVec_u8Z_free(ret_var);
32925 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
32926 LDKu8slice ser_ref;
32927 ser_ref.datalen = ser->arr_len;
32928 ser_ref.data = ser->elems;
32929 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32930 *ret_conv = OpenChannel_read(ser_ref);
32932 return (uint32_t)ret_conv;
32935 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
32936 LDKRevokeAndACK obj_conv;
32937 obj_conv.inner = (void*)(obj & (~1));
32938 obj_conv.is_owned = false;
32939 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32940 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
32941 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32942 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32943 CVec_u8Z_free(ret_var);
32947 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
32948 LDKu8slice ser_ref;
32949 ser_ref.datalen = ser->arr_len;
32950 ser_ref.data = ser->elems;
32951 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32952 *ret_conv = RevokeAndACK_read(ser_ref);
32954 return (uint32_t)ret_conv;
32957 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
32958 LDKShutdown obj_conv;
32959 obj_conv.inner = (void*)(obj & (~1));
32960 obj_conv.is_owned = false;
32961 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32962 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
32963 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32964 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32965 CVec_u8Z_free(ret_var);
32969 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
32970 LDKu8slice ser_ref;
32971 ser_ref.datalen = ser->arr_len;
32972 ser_ref.data = ser->elems;
32973 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32974 *ret_conv = Shutdown_read(ser_ref);
32976 return (uint32_t)ret_conv;
32979 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
32980 LDKUpdateFailHTLC obj_conv;
32981 obj_conv.inner = (void*)(obj & (~1));
32982 obj_conv.is_owned = false;
32983 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32984 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
32985 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32986 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32987 CVec_u8Z_free(ret_var);
32991 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
32992 LDKu8slice ser_ref;
32993 ser_ref.datalen = ser->arr_len;
32994 ser_ref.data = ser->elems;
32995 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32996 *ret_conv = UpdateFailHTLC_read(ser_ref);
32998 return (uint32_t)ret_conv;
33001 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
33002 LDKUpdateFailMalformedHTLC obj_conv;
33003 obj_conv.inner = (void*)(obj & (~1));
33004 obj_conv.is_owned = false;
33005 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33006 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
33007 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33008 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33009 CVec_u8Z_free(ret_var);
33013 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
33014 LDKu8slice ser_ref;
33015 ser_ref.datalen = ser->arr_len;
33016 ser_ref.data = ser->elems;
33017 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
33018 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
33020 return (uint32_t)ret_conv;
33023 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
33024 LDKUpdateFee obj_conv;
33025 obj_conv.inner = (void*)(obj & (~1));
33026 obj_conv.is_owned = false;
33027 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33028 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
33029 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33030 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33031 CVec_u8Z_free(ret_var);
33035 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
33036 LDKu8slice ser_ref;
33037 ser_ref.datalen = ser->arr_len;
33038 ser_ref.data = ser->elems;
33039 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
33040 *ret_conv = UpdateFee_read(ser_ref);
33042 return (uint32_t)ret_conv;
33045 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
33046 LDKUpdateFulfillHTLC obj_conv;
33047 obj_conv.inner = (void*)(obj & (~1));
33048 obj_conv.is_owned = false;
33049 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33050 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
33051 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33052 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33053 CVec_u8Z_free(ret_var);
33057 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
33058 LDKu8slice ser_ref;
33059 ser_ref.datalen = ser->arr_len;
33060 ser_ref.data = ser->elems;
33061 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
33062 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
33064 return (uint32_t)ret_conv;
33067 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
33068 LDKUpdateAddHTLC obj_conv;
33069 obj_conv.inner = (void*)(obj & (~1));
33070 obj_conv.is_owned = false;
33071 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33072 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
33073 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33074 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33075 CVec_u8Z_free(ret_var);
33079 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
33080 LDKu8slice ser_ref;
33081 ser_ref.datalen = ser->arr_len;
33082 ser_ref.data = ser->elems;
33083 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
33084 *ret_conv = UpdateAddHTLC_read(ser_ref);
33086 return (uint32_t)ret_conv;
33089 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
33091 obj_conv.inner = (void*)(obj & (~1));
33092 obj_conv.is_owned = false;
33093 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33094 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
33095 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33096 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33097 CVec_u8Z_free(ret_var);
33101 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
33102 LDKu8slice ser_ref;
33103 ser_ref.datalen = ser->arr_len;
33104 ser_ref.data = ser->elems;
33105 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
33106 *ret_conv = Ping_read(ser_ref);
33108 return (uint32_t)ret_conv;
33111 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
33113 obj_conv.inner = (void*)(obj & (~1));
33114 obj_conv.is_owned = false;
33115 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33116 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
33117 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33118 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33119 CVec_u8Z_free(ret_var);
33123 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
33124 LDKu8slice ser_ref;
33125 ser_ref.datalen = ser->arr_len;
33126 ser_ref.data = ser->elems;
33127 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
33128 *ret_conv = Pong_read(ser_ref);
33130 return (uint32_t)ret_conv;
33133 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
33134 LDKUnsignedChannelAnnouncement obj_conv;
33135 obj_conv.inner = (void*)(obj & (~1));
33136 obj_conv.is_owned = false;
33137 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33138 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
33139 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33140 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33141 CVec_u8Z_free(ret_var);
33145 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
33146 LDKu8slice ser_ref;
33147 ser_ref.datalen = ser->arr_len;
33148 ser_ref.data = ser->elems;
33149 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
33150 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
33152 return (uint32_t)ret_conv;
33155 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
33156 LDKChannelAnnouncement obj_conv;
33157 obj_conv.inner = (void*)(obj & (~1));
33158 obj_conv.is_owned = false;
33159 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33160 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
33161 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33162 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33163 CVec_u8Z_free(ret_var);
33167 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
33168 LDKu8slice ser_ref;
33169 ser_ref.datalen = ser->arr_len;
33170 ser_ref.data = ser->elems;
33171 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
33172 *ret_conv = ChannelAnnouncement_read(ser_ref);
33174 return (uint32_t)ret_conv;
33177 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
33178 LDKUnsignedChannelUpdate obj_conv;
33179 obj_conv.inner = (void*)(obj & (~1));
33180 obj_conv.is_owned = false;
33181 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33182 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
33183 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33184 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33185 CVec_u8Z_free(ret_var);
33189 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
33190 LDKu8slice ser_ref;
33191 ser_ref.datalen = ser->arr_len;
33192 ser_ref.data = ser->elems;
33193 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33194 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
33196 return (uint32_t)ret_conv;
33199 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
33200 LDKChannelUpdate obj_conv;
33201 obj_conv.inner = (void*)(obj & (~1));
33202 obj_conv.is_owned = false;
33203 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33204 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
33205 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33206 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33207 CVec_u8Z_free(ret_var);
33211 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
33212 LDKu8slice ser_ref;
33213 ser_ref.datalen = ser->arr_len;
33214 ser_ref.data = ser->elems;
33215 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33216 *ret_conv = ChannelUpdate_read(ser_ref);
33218 return (uint32_t)ret_conv;
33221 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
33222 LDKErrorMessage obj_conv;
33223 obj_conv.inner = (void*)(obj & (~1));
33224 obj_conv.is_owned = false;
33225 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33226 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
33227 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33228 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33229 CVec_u8Z_free(ret_var);
33233 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
33234 LDKu8slice ser_ref;
33235 ser_ref.datalen = ser->arr_len;
33236 ser_ref.data = ser->elems;
33237 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33238 *ret_conv = ErrorMessage_read(ser_ref);
33240 return (uint32_t)ret_conv;
33243 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
33244 LDKWarningMessage obj_conv;
33245 obj_conv.inner = (void*)(obj & (~1));
33246 obj_conv.is_owned = false;
33247 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33248 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
33249 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33250 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33251 CVec_u8Z_free(ret_var);
33255 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
33256 LDKu8slice ser_ref;
33257 ser_ref.datalen = ser->arr_len;
33258 ser_ref.data = ser->elems;
33259 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33260 *ret_conv = WarningMessage_read(ser_ref);
33262 return (uint32_t)ret_conv;
33265 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
33266 LDKUnsignedNodeAnnouncement obj_conv;
33267 obj_conv.inner = (void*)(obj & (~1));
33268 obj_conv.is_owned = false;
33269 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33270 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
33271 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33272 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33273 CVec_u8Z_free(ret_var);
33277 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
33278 LDKu8slice ser_ref;
33279 ser_ref.datalen = ser->arr_len;
33280 ser_ref.data = ser->elems;
33281 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33282 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
33284 return (uint32_t)ret_conv;
33287 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
33288 LDKNodeAnnouncement obj_conv;
33289 obj_conv.inner = (void*)(obj & (~1));
33290 obj_conv.is_owned = false;
33291 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33292 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
33293 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33294 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33295 CVec_u8Z_free(ret_var);
33299 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
33300 LDKu8slice ser_ref;
33301 ser_ref.datalen = ser->arr_len;
33302 ser_ref.data = ser->elems;
33303 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33304 *ret_conv = NodeAnnouncement_read(ser_ref);
33306 return (uint32_t)ret_conv;
33309 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
33310 LDKu8slice ser_ref;
33311 ser_ref.datalen = ser->arr_len;
33312 ser_ref.data = ser->elems;
33313 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33314 *ret_conv = QueryShortChannelIds_read(ser_ref);
33316 return (uint32_t)ret_conv;
33319 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
33320 LDKQueryShortChannelIds obj_conv;
33321 obj_conv.inner = (void*)(obj & (~1));
33322 obj_conv.is_owned = false;
33323 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33324 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
33325 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33326 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33327 CVec_u8Z_free(ret_var);
33331 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
33332 LDKReplyShortChannelIdsEnd obj_conv;
33333 obj_conv.inner = (void*)(obj & (~1));
33334 obj_conv.is_owned = false;
33335 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33336 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
33337 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33338 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33339 CVec_u8Z_free(ret_var);
33343 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
33344 LDKu8slice ser_ref;
33345 ser_ref.datalen = ser->arr_len;
33346 ser_ref.data = ser->elems;
33347 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33348 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
33350 return (uint32_t)ret_conv;
33353 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
33354 LDKQueryChannelRange this_arg_conv;
33355 this_arg_conv.inner = (void*)(this_arg & (~1));
33356 this_arg_conv.is_owned = false;
33357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33358 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
33362 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
33363 LDKQueryChannelRange obj_conv;
33364 obj_conv.inner = (void*)(obj & (~1));
33365 obj_conv.is_owned = false;
33366 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33367 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
33368 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33369 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33370 CVec_u8Z_free(ret_var);
33374 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
33375 LDKu8slice ser_ref;
33376 ser_ref.datalen = ser->arr_len;
33377 ser_ref.data = ser->elems;
33378 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33379 *ret_conv = QueryChannelRange_read(ser_ref);
33381 return (uint32_t)ret_conv;
33384 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
33385 LDKu8slice ser_ref;
33386 ser_ref.datalen = ser->arr_len;
33387 ser_ref.data = ser->elems;
33388 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33389 *ret_conv = ReplyChannelRange_read(ser_ref);
33391 return (uint32_t)ret_conv;
33394 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
33395 LDKReplyChannelRange obj_conv;
33396 obj_conv.inner = (void*)(obj & (~1));
33397 obj_conv.is_owned = false;
33398 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33399 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
33400 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33401 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33402 CVec_u8Z_free(ret_var);
33406 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
33407 LDKGossipTimestampFilter obj_conv;
33408 obj_conv.inner = (void*)(obj & (~1));
33409 obj_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33411 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
33412 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33413 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33414 CVec_u8Z_free(ret_var);
33418 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
33419 LDKu8slice ser_ref;
33420 ser_ref.datalen = ser->arr_len;
33421 ser_ref.data = ser->elems;
33422 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33423 *ret_conv = GossipTimestampFilter_read(ser_ref);
33425 return (uint32_t)ret_conv;
33428 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
33429 if ((this_ptr & 1) != 0) return;
33430 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33431 CHECK_ACCESS(this_ptr_ptr);
33432 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
33433 FREE((void*)this_ptr);
33434 CustomMessageHandler_free(this_ptr_conv);
33437 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
33438 LDKIgnoringMessageHandler this_obj_conv;
33439 this_obj_conv.inner = (void*)(this_obj & (~1));
33440 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33442 IgnoringMessageHandler_free(this_obj_conv);
33445 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
33446 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33447 uint32_t ret_ref = 0;
33448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33451 ret_ref = (uintptr_t)ret_var.inner;
33452 if (ret_var.is_owned) {
33458 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33459 LDKIgnoringMessageHandler this_arg_conv;
33460 this_arg_conv.inner = (void*)(this_arg & (~1));
33461 this_arg_conv.is_owned = false;
33462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33463 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33464 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33465 return (uint32_t)ret_ret;
33468 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
33469 LDKIgnoringMessageHandler this_arg_conv;
33470 this_arg_conv.inner = (void*)(this_arg & (~1));
33471 this_arg_conv.is_owned = false;
33472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33473 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33474 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33475 return (uint32_t)ret_ret;
33478 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
33479 LDKIgnoringMessageHandler this_arg_conv;
33480 this_arg_conv.inner = (void*)(this_arg & (~1));
33481 this_arg_conv.is_owned = false;
33482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33483 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33484 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33485 return (uint32_t)ret_ret;
33488 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
33489 LDKIgnoringMessageHandler this_arg_conv;
33490 this_arg_conv.inner = (void*)(this_arg & (~1));
33491 this_arg_conv.is_owned = false;
33492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33493 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33494 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33495 return (uint32_t)ret_ret;
33498 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
33499 LDKErroringMessageHandler this_obj_conv;
33500 this_obj_conv.inner = (void*)(this_obj & (~1));
33501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33503 ErroringMessageHandler_free(this_obj_conv);
33506 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
33507 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33508 uint32_t ret_ref = 0;
33509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33512 ret_ref = (uintptr_t)ret_var.inner;
33513 if (ret_var.is_owned) {
33519 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33520 LDKErroringMessageHandler this_arg_conv;
33521 this_arg_conv.inner = (void*)(this_arg & (~1));
33522 this_arg_conv.is_owned = false;
33523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33524 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33525 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33526 return (uint32_t)ret_ret;
33529 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
33530 LDKErroringMessageHandler this_arg_conv;
33531 this_arg_conv.inner = (void*)(this_arg & (~1));
33532 this_arg_conv.is_owned = false;
33533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33534 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33535 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33536 return (uint32_t)ret_ret;
33539 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
33540 LDKMessageHandler this_obj_conv;
33541 this_obj_conv.inner = (void*)(this_obj & (~1));
33542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33544 MessageHandler_free(this_obj_conv);
33547 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
33548 LDKMessageHandler this_ptr_conv;
33549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33550 this_ptr_conv.is_owned = false;
33551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33552 // WARNING: This object doesn't live past this scope, needs clone!
33553 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
33557 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
33558 LDKMessageHandler this_ptr_conv;
33559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33560 this_ptr_conv.is_owned = false;
33561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33562 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33563 CHECK_ACCESS(val_ptr);
33564 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33565 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33566 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33567 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33569 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33572 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
33573 LDKMessageHandler this_ptr_conv;
33574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33575 this_ptr_conv.is_owned = false;
33576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33577 // WARNING: This object doesn't live past this scope, needs clone!
33578 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
33582 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
33583 LDKMessageHandler this_ptr_conv;
33584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33585 this_ptr_conv.is_owned = false;
33586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33587 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33588 CHECK_ACCESS(val_ptr);
33589 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33590 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33591 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33592 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33594 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33597 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
33598 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
33599 CHECK_ACCESS(chan_handler_arg_ptr);
33600 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33601 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33603 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33605 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
33606 CHECK_ACCESS(route_handler_arg_ptr);
33607 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33608 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33610 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33612 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
33613 uint32_t ret_ref = 0;
33614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33617 ret_ref = (uintptr_t)ret_var.inner;
33618 if (ret_var.is_owned) {
33624 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33625 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33626 *ret_ret = SocketDescriptor_clone(arg);
33627 return (uint32_t)ret_ret;
33629 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
33630 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
33631 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
33632 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33633 uint32_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
33637 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
33638 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
33639 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
33640 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33641 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33642 *ret_ret = SocketDescriptor_clone(orig_conv);
33643 return (uint32_t)ret_ret;
33646 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
33647 if ((this_ptr & 1) != 0) return;
33648 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33649 CHECK_ACCESS(this_ptr_ptr);
33650 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33651 FREE((void*)this_ptr);
33652 SocketDescriptor_free(this_ptr_conv);
33655 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
33656 LDKPeerHandleError this_obj_conv;
33657 this_obj_conv.inner = (void*)(this_obj & (~1));
33658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33660 PeerHandleError_free(this_obj_conv);
33663 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
33664 LDKPeerHandleError this_ptr_conv;
33665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33666 this_ptr_conv.is_owned = false;
33667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33668 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33672 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
33673 LDKPeerHandleError this_ptr_conv;
33674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33675 this_ptr_conv.is_owned = false;
33676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33677 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33680 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
33681 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33682 uint32_t ret_ref = 0;
33683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33686 ret_ref = (uintptr_t)ret_var.inner;
33687 if (ret_var.is_owned) {
33693 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33694 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33695 uint32_t ret_ref = 0;
33696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33699 ret_ref = (uintptr_t)ret_var.inner;
33700 if (ret_var.is_owned) {
33705 uint32_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
33706 LDKPeerHandleError arg_conv;
33707 arg_conv.inner = (void*)(arg & (~1));
33708 arg_conv.is_owned = false;
33709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33710 uint32_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
33714 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
33715 LDKPeerHandleError orig_conv;
33716 orig_conv.inner = (void*)(orig & (~1));
33717 orig_conv.is_owned = false;
33718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33719 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33720 uint32_t ret_ref = 0;
33721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33724 ret_ref = (uintptr_t)ret_var.inner;
33725 if (ret_var.is_owned) {
33731 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
33732 LDKPeerManager this_obj_conv;
33733 this_obj_conv.inner = (void*)(this_obj & (~1));
33734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33736 PeerManager_free(this_obj_conv);
33739 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) {
33740 LDKMessageHandler message_handler_conv;
33741 message_handler_conv.inner = (void*)(message_handler & (~1));
33742 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
33743 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33744 // WARNING: we need a move here but no clone is available for LDKMessageHandler
33745 LDKSecretKey our_node_secret_ref;
33746 CHECK(our_node_secret->arr_len == 32);
33747 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
33748 unsigned char ephemeral_random_data_arr[32];
33749 CHECK(ephemeral_random_data->arr_len == 32);
33750 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
33751 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33752 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
33753 CHECK_ACCESS(logger_ptr);
33754 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33755 if (logger_conv.free == LDKLogger_JCalls_free) {
33756 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33757 LDKLogger_JCalls_cloned(&logger_conv);
33759 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
33760 CHECK_ACCESS(custom_message_handler_ptr);
33761 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33762 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33763 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33764 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33766 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33767 uint32_t ret_ref = 0;
33768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33771 ret_ref = (uintptr_t)ret_var.inner;
33772 if (ret_var.is_owned) {
33778 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
33779 LDKPeerManager this_arg_conv;
33780 this_arg_conv.inner = (void*)(this_arg & (~1));
33781 this_arg_conv.is_owned = false;
33782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33783 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
33784 ptrArray ret_arr = NULL;
33785 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33786 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
33787 for (size_t m = 0; m < ret_var.datalen; m++) {
33788 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
33789 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
33790 ret_arr_ptr[m] = ret_conv_12_arr;
33793 FREE(ret_var.data);
33797 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, uint32_t remote_network_address) {
33798 LDKPeerManager this_arg_conv;
33799 this_arg_conv.inner = (void*)(this_arg & (~1));
33800 this_arg_conv.is_owned = false;
33801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33802 LDKPublicKey their_node_id_ref;
33803 CHECK(their_node_id->arr_len == 33);
33804 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
33805 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33806 CHECK_ACCESS(descriptor_ptr);
33807 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33808 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33810 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33812 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33813 CHECK_ACCESS(remote_network_address_ptr);
33814 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33815 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
33816 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
33817 return (uint32_t)ret_conv;
33820 uint32_t __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor, uint32_t remote_network_address) {
33821 LDKPeerManager this_arg_conv;
33822 this_arg_conv.inner = (void*)(this_arg & (~1));
33823 this_arg_conv.is_owned = false;
33824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33825 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33826 CHECK_ACCESS(descriptor_ptr);
33827 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33828 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33829 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33830 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33832 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33833 CHECK_ACCESS(remote_network_address_ptr);
33834 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33835 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33836 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
33837 return (uint32_t)ret_conv;
33840 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
33841 LDKPeerManager this_arg_conv;
33842 this_arg_conv.inner = (void*)(this_arg & (~1));
33843 this_arg_conv.is_owned = false;
33844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33845 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33846 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33847 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33848 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33849 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
33850 return (uint32_t)ret_conv;
33853 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
33854 LDKPeerManager this_arg_conv;
33855 this_arg_conv.inner = (void*)(this_arg & (~1));
33856 this_arg_conv.is_owned = false;
33857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33858 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
33859 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
33860 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
33861 LDKu8slice data_ref;
33862 data_ref.datalen = data->arr_len;
33863 data_ref.data = data->elems;
33864 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
33865 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
33867 return (uint32_t)ret_conv;
33870 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
33871 LDKPeerManager this_arg_conv;
33872 this_arg_conv.inner = (void*)(this_arg & (~1));
33873 this_arg_conv.is_owned = false;
33874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33875 PeerManager_process_events(&this_arg_conv);
33878 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
33879 LDKPeerManager this_arg_conv;
33880 this_arg_conv.inner = (void*)(this_arg & (~1));
33881 this_arg_conv.is_owned = false;
33882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33883 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33884 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33885 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33886 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
33889 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) {
33890 LDKPeerManager this_arg_conv;
33891 this_arg_conv.inner = (void*)(this_arg & (~1));
33892 this_arg_conv.is_owned = false;
33893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33894 LDKPublicKey node_id_ref;
33895 CHECK(node_id->arr_len == 33);
33896 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
33897 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
33900 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
33901 LDKPeerManager this_arg_conv;
33902 this_arg_conv.inner = (void*)(this_arg & (~1));
33903 this_arg_conv.is_owned = false;
33904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33905 PeerManager_disconnect_all_peers(&this_arg_conv);
33908 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
33909 LDKPeerManager this_arg_conv;
33910 this_arg_conv.inner = (void*)(this_arg & (~1));
33911 this_arg_conv.is_owned = false;
33912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33913 PeerManager_timer_tick_occurred(&this_arg_conv);
33916 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
33917 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
33921 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
33922 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
33926 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
33927 unsigned char commitment_seed_arr[32];
33928 CHECK(commitment_seed->arr_len == 32);
33929 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
33930 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
33931 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33932 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
33936 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) {
33937 LDKCVec_u8Z to_holder_script_ref;
33938 to_holder_script_ref.datalen = to_holder_script->arr_len;
33939 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33940 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33941 LDKCVec_u8Z to_counterparty_script_ref;
33942 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33943 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33944 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33945 LDKOutPoint funding_outpoint_conv;
33946 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
33947 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
33948 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
33949 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
33950 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);
33951 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33952 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33953 Transaction_free(ret_var);
33957 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
33958 LDKCounterpartyCommitmentSecrets this_obj_conv;
33959 this_obj_conv.inner = (void*)(this_obj & (~1));
33960 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33962 CounterpartyCommitmentSecrets_free(this_obj_conv);
33965 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
33966 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
33967 uint32_t ret_ref = 0;
33968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33971 ret_ref = (uintptr_t)ret_var.inner;
33972 if (ret_var.is_owned) {
33977 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
33978 LDKCounterpartyCommitmentSecrets arg_conv;
33979 arg_conv.inner = (void*)(arg & (~1));
33980 arg_conv.is_owned = false;
33981 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33982 uint32_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
33986 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
33987 LDKCounterpartyCommitmentSecrets orig_conv;
33988 orig_conv.inner = (void*)(orig & (~1));
33989 orig_conv.is_owned = false;
33990 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33991 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
33992 uint32_t ret_ref = 0;
33993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33996 ret_ref = (uintptr_t)ret_var.inner;
33997 if (ret_var.is_owned) {
34003 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
34004 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
34005 uint32_t ret_ref = 0;
34006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34009 ret_ref = (uintptr_t)ret_var.inner;
34010 if (ret_var.is_owned) {
34016 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
34017 LDKCounterpartyCommitmentSecrets this_arg_conv;
34018 this_arg_conv.inner = (void*)(this_arg & (~1));
34019 this_arg_conv.is_owned = false;
34020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34021 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
34025 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
34026 LDKCounterpartyCommitmentSecrets this_arg_conv;
34027 this_arg_conv.inner = (void*)(this_arg & (~1));
34028 this_arg_conv.is_owned = false;
34029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34030 LDKThirtyTwoBytes secret_ref;
34031 CHECK(secret->arr_len == 32);
34032 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
34033 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
34034 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
34035 return (uint32_t)ret_conv;
34038 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
34039 LDKCounterpartyCommitmentSecrets this_arg_conv;
34040 this_arg_conv.inner = (void*)(this_arg & (~1));
34041 this_arg_conv.is_owned = false;
34042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34043 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34044 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
34048 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
34049 LDKCounterpartyCommitmentSecrets obj_conv;
34050 obj_conv.inner = (void*)(obj & (~1));
34051 obj_conv.is_owned = false;
34052 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34053 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
34054 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34055 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34056 CVec_u8Z_free(ret_var);
34060 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
34061 LDKu8slice ser_ref;
34062 ser_ref.datalen = ser->arr_len;
34063 ser_ref.data = ser->elems;
34064 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
34065 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
34067 return (uint32_t)ret_conv;
34070 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
34071 LDKPublicKey per_commitment_point_ref;
34072 CHECK(per_commitment_point->arr_len == 33);
34073 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34074 unsigned char base_secret_arr[32];
34075 CHECK(base_secret->arr_len == 32);
34076 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
34077 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
34078 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34079 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
34080 return (uint32_t)ret_conv;
34083 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
34084 LDKPublicKey per_commitment_point_ref;
34085 CHECK(per_commitment_point->arr_len == 33);
34086 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34087 LDKPublicKey base_point_ref;
34088 CHECK(base_point->arr_len == 33);
34089 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
34090 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34091 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
34092 return (uint32_t)ret_conv;
34095 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) {
34096 unsigned char per_commitment_secret_arr[32];
34097 CHECK(per_commitment_secret->arr_len == 32);
34098 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
34099 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
34100 unsigned char countersignatory_revocation_base_secret_arr[32];
34101 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
34102 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
34103 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
34104 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34105 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
34106 return (uint32_t)ret_conv;
34109 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) {
34110 LDKPublicKey per_commitment_point_ref;
34111 CHECK(per_commitment_point->arr_len == 33);
34112 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34113 LDKPublicKey countersignatory_revocation_base_point_ref;
34114 CHECK(countersignatory_revocation_base_point->arr_len == 33);
34115 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
34116 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34117 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
34118 return (uint32_t)ret_conv;
34121 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
34122 LDKTxCreationKeys this_obj_conv;
34123 this_obj_conv.inner = (void*)(this_obj & (~1));
34124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34126 TxCreationKeys_free(this_obj_conv);
34129 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
34130 LDKTxCreationKeys this_ptr_conv;
34131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34132 this_ptr_conv.is_owned = false;
34133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34134 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34135 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
34139 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
34140 LDKTxCreationKeys this_ptr_conv;
34141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34142 this_ptr_conv.is_owned = false;
34143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34144 LDKPublicKey val_ref;
34145 CHECK(val->arr_len == 33);
34146 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34147 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
34150 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
34151 LDKTxCreationKeys this_ptr_conv;
34152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34153 this_ptr_conv.is_owned = false;
34154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34155 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34156 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
34160 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
34161 LDKTxCreationKeys this_ptr_conv;
34162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34163 this_ptr_conv.is_owned = false;
34164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34165 LDKPublicKey val_ref;
34166 CHECK(val->arr_len == 33);
34167 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34168 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
34171 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
34172 LDKTxCreationKeys this_ptr_conv;
34173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34174 this_ptr_conv.is_owned = false;
34175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34176 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34177 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
34181 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
34182 LDKTxCreationKeys this_ptr_conv;
34183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34184 this_ptr_conv.is_owned = false;
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34186 LDKPublicKey val_ref;
34187 CHECK(val->arr_len == 33);
34188 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34189 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
34192 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
34193 LDKTxCreationKeys this_ptr_conv;
34194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34195 this_ptr_conv.is_owned = false;
34196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34197 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34198 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
34202 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
34203 LDKTxCreationKeys this_ptr_conv;
34204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34205 this_ptr_conv.is_owned = false;
34206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34207 LDKPublicKey val_ref;
34208 CHECK(val->arr_len == 33);
34209 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34210 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
34213 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
34214 LDKTxCreationKeys this_ptr_conv;
34215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34216 this_ptr_conv.is_owned = false;
34217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34218 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34219 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
34223 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) {
34224 LDKTxCreationKeys this_ptr_conv;
34225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34226 this_ptr_conv.is_owned = false;
34227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34228 LDKPublicKey val_ref;
34229 CHECK(val->arr_len == 33);
34230 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34231 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
34234 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) {
34235 LDKPublicKey per_commitment_point_arg_ref;
34236 CHECK(per_commitment_point_arg->arr_len == 33);
34237 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
34238 LDKPublicKey revocation_key_arg_ref;
34239 CHECK(revocation_key_arg->arr_len == 33);
34240 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
34241 LDKPublicKey broadcaster_htlc_key_arg_ref;
34242 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
34243 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
34244 LDKPublicKey countersignatory_htlc_key_arg_ref;
34245 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
34246 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
34247 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
34248 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
34249 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
34250 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);
34251 uint32_t ret_ref = 0;
34252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34255 ret_ref = (uintptr_t)ret_var.inner;
34256 if (ret_var.is_owned) {
34262 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
34263 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
34264 uint32_t ret_ref = 0;
34265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34268 ret_ref = (uintptr_t)ret_var.inner;
34269 if (ret_var.is_owned) {
34274 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
34275 LDKTxCreationKeys arg_conv;
34276 arg_conv.inner = (void*)(arg & (~1));
34277 arg_conv.is_owned = false;
34278 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34279 uint32_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
34283 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
34284 LDKTxCreationKeys orig_conv;
34285 orig_conv.inner = (void*)(orig & (~1));
34286 orig_conv.is_owned = false;
34287 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34288 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
34289 uint32_t ret_ref = 0;
34290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34293 ret_ref = (uintptr_t)ret_var.inner;
34294 if (ret_var.is_owned) {
34300 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
34301 LDKTxCreationKeys obj_conv;
34302 obj_conv.inner = (void*)(obj & (~1));
34303 obj_conv.is_owned = false;
34304 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34305 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
34306 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34307 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34308 CVec_u8Z_free(ret_var);
34312 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
34313 LDKu8slice ser_ref;
34314 ser_ref.datalen = ser->arr_len;
34315 ser_ref.data = ser->elems;
34316 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
34317 *ret_conv = TxCreationKeys_read(ser_ref);
34319 return (uint32_t)ret_conv;
34322 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
34323 LDKChannelPublicKeys this_obj_conv;
34324 this_obj_conv.inner = (void*)(this_obj & (~1));
34325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34327 ChannelPublicKeys_free(this_obj_conv);
34330 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
34331 LDKChannelPublicKeys this_ptr_conv;
34332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34333 this_ptr_conv.is_owned = false;
34334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34335 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34336 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
34340 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
34341 LDKChannelPublicKeys this_ptr_conv;
34342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34343 this_ptr_conv.is_owned = false;
34344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34345 LDKPublicKey val_ref;
34346 CHECK(val->arr_len == 33);
34347 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34348 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
34351 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
34352 LDKChannelPublicKeys this_ptr_conv;
34353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34354 this_ptr_conv.is_owned = false;
34355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34356 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34357 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
34361 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
34362 LDKChannelPublicKeys this_ptr_conv;
34363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34364 this_ptr_conv.is_owned = false;
34365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34366 LDKPublicKey val_ref;
34367 CHECK(val->arr_len == 33);
34368 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34369 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
34372 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
34373 LDKChannelPublicKeys this_ptr_conv;
34374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34375 this_ptr_conv.is_owned = false;
34376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34377 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34378 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
34382 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
34383 LDKChannelPublicKeys this_ptr_conv;
34384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34385 this_ptr_conv.is_owned = false;
34386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34387 LDKPublicKey val_ref;
34388 CHECK(val->arr_len == 33);
34389 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34390 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
34393 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
34394 LDKChannelPublicKeys this_ptr_conv;
34395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34396 this_ptr_conv.is_owned = false;
34397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34398 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34399 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
34403 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
34404 LDKChannelPublicKeys this_ptr_conv;
34405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34406 this_ptr_conv.is_owned = false;
34407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34408 LDKPublicKey val_ref;
34409 CHECK(val->arr_len == 33);
34410 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34411 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
34414 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
34415 LDKChannelPublicKeys this_ptr_conv;
34416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34417 this_ptr_conv.is_owned = false;
34418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34419 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34420 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
34424 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
34425 LDKChannelPublicKeys this_ptr_conv;
34426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34427 this_ptr_conv.is_owned = false;
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34429 LDKPublicKey val_ref;
34430 CHECK(val->arr_len == 33);
34431 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34432 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
34435 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) {
34436 LDKPublicKey funding_pubkey_arg_ref;
34437 CHECK(funding_pubkey_arg->arr_len == 33);
34438 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
34439 LDKPublicKey revocation_basepoint_arg_ref;
34440 CHECK(revocation_basepoint_arg->arr_len == 33);
34441 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
34442 LDKPublicKey payment_point_arg_ref;
34443 CHECK(payment_point_arg->arr_len == 33);
34444 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
34445 LDKPublicKey delayed_payment_basepoint_arg_ref;
34446 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
34447 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
34448 LDKPublicKey htlc_basepoint_arg_ref;
34449 CHECK(htlc_basepoint_arg->arr_len == 33);
34450 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
34451 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);
34452 uint32_t ret_ref = 0;
34453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34456 ret_ref = (uintptr_t)ret_var.inner;
34457 if (ret_var.is_owned) {
34463 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34464 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34465 uint32_t ret_ref = 0;
34466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34469 ret_ref = (uintptr_t)ret_var.inner;
34470 if (ret_var.is_owned) {
34475 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
34476 LDKChannelPublicKeys arg_conv;
34477 arg_conv.inner = (void*)(arg & (~1));
34478 arg_conv.is_owned = false;
34479 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34480 uint32_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
34484 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
34485 LDKChannelPublicKeys orig_conv;
34486 orig_conv.inner = (void*)(orig & (~1));
34487 orig_conv.is_owned = false;
34488 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34489 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34490 uint32_t ret_ref = 0;
34491 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34492 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34494 ret_ref = (uintptr_t)ret_var.inner;
34495 if (ret_var.is_owned) {
34501 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
34502 LDKChannelPublicKeys obj_conv;
34503 obj_conv.inner = (void*)(obj & (~1));
34504 obj_conv.is_owned = false;
34505 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34506 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34507 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34508 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34509 CVec_u8Z_free(ret_var);
34513 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
34514 LDKu8slice ser_ref;
34515 ser_ref.datalen = ser->arr_len;
34516 ser_ref.data = ser->elems;
34517 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34518 *ret_conv = ChannelPublicKeys_read(ser_ref);
34520 return (uint32_t)ret_conv;
34523 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) {
34524 LDKPublicKey per_commitment_point_ref;
34525 CHECK(per_commitment_point->arr_len == 33);
34526 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34527 LDKPublicKey broadcaster_delayed_payment_base_ref;
34528 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
34529 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
34530 LDKPublicKey broadcaster_htlc_base_ref;
34531 CHECK(broadcaster_htlc_base->arr_len == 33);
34532 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
34533 LDKPublicKey countersignatory_revocation_base_ref;
34534 CHECK(countersignatory_revocation_base->arr_len == 33);
34535 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
34536 LDKPublicKey countersignatory_htlc_base_ref;
34537 CHECK(countersignatory_htlc_base->arr_len == 33);
34538 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
34539 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34540 *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);
34541 return (uint32_t)ret_conv;
34544 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) {
34545 LDKPublicKey per_commitment_point_ref;
34546 CHECK(per_commitment_point->arr_len == 33);
34547 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34548 LDKChannelPublicKeys broadcaster_keys_conv;
34549 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34550 broadcaster_keys_conv.is_owned = false;
34551 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34552 LDKChannelPublicKeys countersignatory_keys_conv;
34553 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34554 countersignatory_keys_conv.is_owned = false;
34555 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34556 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34557 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34558 return (uint32_t)ret_conv;
34561 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) {
34562 LDKPublicKey revocation_key_ref;
34563 CHECK(revocation_key->arr_len == 33);
34564 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34565 LDKPublicKey broadcaster_delayed_payment_key_ref;
34566 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34567 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34568 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34569 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34570 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34571 CVec_u8Z_free(ret_var);
34575 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
34576 LDKHTLCOutputInCommitment this_obj_conv;
34577 this_obj_conv.inner = (void*)(this_obj & (~1));
34578 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34580 HTLCOutputInCommitment_free(this_obj_conv);
34583 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
34584 LDKHTLCOutputInCommitment this_ptr_conv;
34585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34586 this_ptr_conv.is_owned = false;
34587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34588 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34592 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
34593 LDKHTLCOutputInCommitment this_ptr_conv;
34594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34595 this_ptr_conv.is_owned = false;
34596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34597 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34600 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
34601 LDKHTLCOutputInCommitment this_ptr_conv;
34602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34603 this_ptr_conv.is_owned = false;
34604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34605 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34609 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
34610 LDKHTLCOutputInCommitment this_ptr_conv;
34611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34612 this_ptr_conv.is_owned = false;
34613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34614 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34617 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
34618 LDKHTLCOutputInCommitment this_ptr_conv;
34619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34620 this_ptr_conv.is_owned = false;
34621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34622 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34626 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
34627 LDKHTLCOutputInCommitment this_ptr_conv;
34628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34629 this_ptr_conv.is_owned = false;
34630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34631 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34634 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
34635 LDKHTLCOutputInCommitment this_ptr_conv;
34636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34637 this_ptr_conv.is_owned = false;
34638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34639 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34640 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
34644 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
34645 LDKHTLCOutputInCommitment this_ptr_conv;
34646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34647 this_ptr_conv.is_owned = false;
34648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34649 LDKThirtyTwoBytes val_ref;
34650 CHECK(val->arr_len == 32);
34651 memcpy(val_ref.data, val->elems, 32); FREE(val);
34652 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34655 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
34656 LDKHTLCOutputInCommitment this_ptr_conv;
34657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34658 this_ptr_conv.is_owned = false;
34659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34660 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34661 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34662 uint32_t ret_ref = (uintptr_t)ret_copy;
34666 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
34667 LDKHTLCOutputInCommitment this_ptr_conv;
34668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34669 this_ptr_conv.is_owned = false;
34670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34671 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34672 CHECK_ACCESS(val_ptr);
34673 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34674 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
34675 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34678 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) {
34679 LDKThirtyTwoBytes payment_hash_arg_ref;
34680 CHECK(payment_hash_arg->arr_len == 32);
34681 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
34682 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
34683 CHECK_ACCESS(transaction_output_index_arg_ptr);
34684 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34685 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
34686 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34687 uint32_t ret_ref = 0;
34688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34691 ret_ref = (uintptr_t)ret_var.inner;
34692 if (ret_var.is_owned) {
34698 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34699 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34700 uint32_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) {
34710 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
34711 LDKHTLCOutputInCommitment arg_conv;
34712 arg_conv.inner = (void*)(arg & (~1));
34713 arg_conv.is_owned = false;
34714 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34715 uint32_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34719 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
34720 LDKHTLCOutputInCommitment orig_conv;
34721 orig_conv.inner = (void*)(orig & (~1));
34722 orig_conv.is_owned = false;
34723 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34724 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34725 uint32_t ret_ref = 0;
34726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34729 ret_ref = (uintptr_t)ret_var.inner;
34730 if (ret_var.is_owned) {
34736 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
34737 LDKHTLCOutputInCommitment obj_conv;
34738 obj_conv.inner = (void*)(obj & (~1));
34739 obj_conv.is_owned = false;
34740 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34741 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34742 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34743 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34744 CVec_u8Z_free(ret_var);
34748 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
34749 LDKu8slice ser_ref;
34750 ser_ref.datalen = ser->arr_len;
34751 ser_ref.data = ser->elems;
34752 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34753 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34755 return (uint32_t)ret_conv;
34758 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
34759 LDKHTLCOutputInCommitment htlc_conv;
34760 htlc_conv.inner = (void*)(htlc & (~1));
34761 htlc_conv.is_owned = false;
34762 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34763 LDKTxCreationKeys keys_conv;
34764 keys_conv.inner = (void*)(keys & (~1));
34765 keys_conv.is_owned = false;
34766 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34767 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34768 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34769 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34770 CVec_u8Z_free(ret_var);
34774 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
34775 LDKPublicKey broadcaster_ref;
34776 CHECK(broadcaster->arr_len == 33);
34777 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
34778 LDKPublicKey countersignatory_ref;
34779 CHECK(countersignatory->arr_len == 33);
34780 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
34781 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34782 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34783 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34784 CVec_u8Z_free(ret_var);
34788 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) {
34789 unsigned char commitment_txid_arr[32];
34790 CHECK(commitment_txid->arr_len == 32);
34791 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
34792 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34793 LDKHTLCOutputInCommitment htlc_conv;
34794 htlc_conv.inner = (void*)(htlc & (~1));
34795 htlc_conv.is_owned = false;
34796 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34797 LDKPublicKey broadcaster_delayed_payment_key_ref;
34798 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34799 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34800 LDKPublicKey revocation_key_ref;
34801 CHECK(revocation_key->arr_len == 33);
34802 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34803 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);
34804 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34805 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34806 Transaction_free(ret_var);
34810 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
34811 LDKPublicKey funding_pubkey_ref;
34812 CHECK(funding_pubkey->arr_len == 33);
34813 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
34814 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34815 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34816 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34817 CVec_u8Z_free(ret_var);
34821 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
34822 LDKChannelTransactionParameters this_obj_conv;
34823 this_obj_conv.inner = (void*)(this_obj & (~1));
34824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34826 ChannelTransactionParameters_free(this_obj_conv);
34829 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
34830 LDKChannelTransactionParameters this_ptr_conv;
34831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34832 this_ptr_conv.is_owned = false;
34833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34834 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34835 uint32_t ret_ref = 0;
34836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34839 ret_ref = (uintptr_t)ret_var.inner;
34840 if (ret_var.is_owned) {
34846 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
34847 LDKChannelTransactionParameters this_ptr_conv;
34848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34849 this_ptr_conv.is_owned = false;
34850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34851 LDKChannelPublicKeys val_conv;
34852 val_conv.inner = (void*)(val & (~1));
34853 val_conv.is_owned = (val & 1) || (val == 0);
34854 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34855 val_conv = ChannelPublicKeys_clone(&val_conv);
34856 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34859 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
34860 LDKChannelTransactionParameters this_ptr_conv;
34861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34862 this_ptr_conv.is_owned = false;
34863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34864 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34868 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) {
34869 LDKChannelTransactionParameters this_ptr_conv;
34870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34871 this_ptr_conv.is_owned = false;
34872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34873 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34876 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
34877 LDKChannelTransactionParameters this_ptr_conv;
34878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34879 this_ptr_conv.is_owned = false;
34880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34881 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34885 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
34886 LDKChannelTransactionParameters this_ptr_conv;
34887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34888 this_ptr_conv.is_owned = false;
34889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34890 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34893 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
34894 LDKChannelTransactionParameters this_ptr_conv;
34895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34896 this_ptr_conv.is_owned = false;
34897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34898 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
34899 uint32_t ret_ref = 0;
34900 if ((uintptr_t)ret_var.inner > 4096) {
34901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34904 ret_ref = (uintptr_t)ret_var.inner;
34905 if (ret_var.is_owned) {
34912 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
34913 LDKChannelTransactionParameters this_ptr_conv;
34914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34915 this_ptr_conv.is_owned = false;
34916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34917 LDKCounterpartyChannelTransactionParameters val_conv;
34918 val_conv.inner = (void*)(val & (~1));
34919 val_conv.is_owned = (val & 1) || (val == 0);
34920 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34921 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
34922 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
34925 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
34926 LDKChannelTransactionParameters this_ptr_conv;
34927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34928 this_ptr_conv.is_owned = false;
34929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34930 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
34931 uint32_t ret_ref = 0;
34932 if ((uintptr_t)ret_var.inner > 4096) {
34933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34936 ret_ref = (uintptr_t)ret_var.inner;
34937 if (ret_var.is_owned) {
34944 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
34945 LDKChannelTransactionParameters this_ptr_conv;
34946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34947 this_ptr_conv.is_owned = false;
34948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34949 LDKOutPoint val_conv;
34950 val_conv.inner = (void*)(val & (~1));
34951 val_conv.is_owned = (val & 1) || (val == 0);
34952 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34953 val_conv = OutPoint_clone(&val_conv);
34954 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
34957 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
34958 LDKChannelTransactionParameters this_ptr_conv;
34959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34960 this_ptr_conv.is_owned = false;
34961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34962 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
34966 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
34967 LDKChannelTransactionParameters this_ptr_conv;
34968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34969 this_ptr_conv.is_owned = false;
34970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34971 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
34972 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
34975 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) {
34976 LDKChannelPublicKeys holder_pubkeys_arg_conv;
34977 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
34978 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
34979 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
34980 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
34981 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
34982 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
34983 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
34984 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
34985 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
34986 LDKOutPoint funding_outpoint_arg_conv;
34987 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
34988 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
34989 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
34990 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
34991 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
34992 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);
34993 uint32_t ret_ref = 0;
34994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34997 ret_ref = (uintptr_t)ret_var.inner;
34998 if (ret_var.is_owned) {
35004 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
35005 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
35006 uint32_t ret_ref = 0;
35007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35010 ret_ref = (uintptr_t)ret_var.inner;
35011 if (ret_var.is_owned) {
35016 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
35017 LDKChannelTransactionParameters arg_conv;
35018 arg_conv.inner = (void*)(arg & (~1));
35019 arg_conv.is_owned = false;
35020 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35021 uint32_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
35025 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
35026 LDKChannelTransactionParameters orig_conv;
35027 orig_conv.inner = (void*)(orig & (~1));
35028 orig_conv.is_owned = false;
35029 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35030 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
35031 uint32_t ret_ref = 0;
35032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35035 ret_ref = (uintptr_t)ret_var.inner;
35036 if (ret_var.is_owned) {
35042 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
35043 LDKCounterpartyChannelTransactionParameters this_obj_conv;
35044 this_obj_conv.inner = (void*)(this_obj & (~1));
35045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35047 CounterpartyChannelTransactionParameters_free(this_obj_conv);
35050 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
35051 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35053 this_ptr_conv.is_owned = false;
35054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35055 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
35056 uint32_t ret_ref = 0;
35057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35060 ret_ref = (uintptr_t)ret_var.inner;
35061 if (ret_var.is_owned) {
35067 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
35068 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35070 this_ptr_conv.is_owned = false;
35071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35072 LDKChannelPublicKeys val_conv;
35073 val_conv.inner = (void*)(val & (~1));
35074 val_conv.is_owned = (val & 1) || (val == 0);
35075 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35076 val_conv = ChannelPublicKeys_clone(&val_conv);
35077 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
35080 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
35081 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35083 this_ptr_conv.is_owned = false;
35084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35085 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
35089 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
35090 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35092 this_ptr_conv.is_owned = false;
35093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35094 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
35097 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
35098 LDKChannelPublicKeys pubkeys_arg_conv;
35099 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
35100 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
35101 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
35102 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
35103 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
35104 uint32_t ret_ref = 0;
35105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35108 ret_ref = (uintptr_t)ret_var.inner;
35109 if (ret_var.is_owned) {
35115 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
35116 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
35117 uint32_t ret_ref = 0;
35118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35121 ret_ref = (uintptr_t)ret_var.inner;
35122 if (ret_var.is_owned) {
35127 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
35128 LDKCounterpartyChannelTransactionParameters arg_conv;
35129 arg_conv.inner = (void*)(arg & (~1));
35130 arg_conv.is_owned = false;
35131 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35132 uint32_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
35136 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
35137 LDKCounterpartyChannelTransactionParameters orig_conv;
35138 orig_conv.inner = (void*)(orig & (~1));
35139 orig_conv.is_owned = false;
35140 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35141 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
35142 uint32_t ret_ref = 0;
35143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35146 ret_ref = (uintptr_t)ret_var.inner;
35147 if (ret_var.is_owned) {
35153 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
35154 LDKChannelTransactionParameters this_arg_conv;
35155 this_arg_conv.inner = (void*)(this_arg & (~1));
35156 this_arg_conv.is_owned = false;
35157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35158 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
35162 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
35163 LDKChannelTransactionParameters 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 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
35168 uint32_t ret_ref = 0;
35169 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35170 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35172 ret_ref = (uintptr_t)ret_var.inner;
35173 if (ret_var.is_owned) {
35179 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
35180 LDKChannelTransactionParameters this_arg_conv;
35181 this_arg_conv.inner = (void*)(this_arg & (~1));
35182 this_arg_conv.is_owned = false;
35183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35184 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
35185 uint32_t ret_ref = 0;
35186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35189 ret_ref = (uintptr_t)ret_var.inner;
35190 if (ret_var.is_owned) {
35196 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
35197 LDKCounterpartyChannelTransactionParameters obj_conv;
35198 obj_conv.inner = (void*)(obj & (~1));
35199 obj_conv.is_owned = false;
35200 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35201 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
35202 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35203 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35204 CVec_u8Z_free(ret_var);
35208 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
35209 LDKu8slice ser_ref;
35210 ser_ref.datalen = ser->arr_len;
35211 ser_ref.data = ser->elems;
35212 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
35213 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
35215 return (uint32_t)ret_conv;
35218 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
35219 LDKChannelTransactionParameters obj_conv;
35220 obj_conv.inner = (void*)(obj & (~1));
35221 obj_conv.is_owned = false;
35222 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35223 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
35224 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35225 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35226 CVec_u8Z_free(ret_var);
35230 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
35231 LDKu8slice ser_ref;
35232 ser_ref.datalen = ser->arr_len;
35233 ser_ref.data = ser->elems;
35234 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
35235 *ret_conv = ChannelTransactionParameters_read(ser_ref);
35237 return (uint32_t)ret_conv;
35240 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
35241 LDKDirectedChannelTransactionParameters this_obj_conv;
35242 this_obj_conv.inner = (void*)(this_obj & (~1));
35243 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35245 DirectedChannelTransactionParameters_free(this_obj_conv);
35248 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
35249 LDKDirectedChannelTransactionParameters this_arg_conv;
35250 this_arg_conv.inner = (void*)(this_arg & (~1));
35251 this_arg_conv.is_owned = false;
35252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35253 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
35254 uint32_t ret_ref = 0;
35255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35258 ret_ref = (uintptr_t)ret_var.inner;
35259 if (ret_var.is_owned) {
35265 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
35266 LDKDirectedChannelTransactionParameters this_arg_conv;
35267 this_arg_conv.inner = (void*)(this_arg & (~1));
35268 this_arg_conv.is_owned = false;
35269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35270 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
35271 uint32_t ret_ref = 0;
35272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35275 ret_ref = (uintptr_t)ret_var.inner;
35276 if (ret_var.is_owned) {
35282 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
35283 LDKDirectedChannelTransactionParameters this_arg_conv;
35284 this_arg_conv.inner = (void*)(this_arg & (~1));
35285 this_arg_conv.is_owned = false;
35286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35287 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
35291 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
35292 LDKDirectedChannelTransactionParameters this_arg_conv;
35293 this_arg_conv.inner = (void*)(this_arg & (~1));
35294 this_arg_conv.is_owned = false;
35295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35296 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
35300 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
35301 LDKDirectedChannelTransactionParameters this_arg_conv;
35302 this_arg_conv.inner = (void*)(this_arg & (~1));
35303 this_arg_conv.is_owned = false;
35304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35305 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
35306 uint32_t ret_ref = 0;
35307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35310 ret_ref = (uintptr_t)ret_var.inner;
35311 if (ret_var.is_owned) {
35317 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
35318 LDKDirectedChannelTransactionParameters this_arg_conv;
35319 this_arg_conv.inner = (void*)(this_arg & (~1));
35320 this_arg_conv.is_owned = false;
35321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35322 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
35326 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
35327 LDKHolderCommitmentTransaction this_obj_conv;
35328 this_obj_conv.inner = (void*)(this_obj & (~1));
35329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35331 HolderCommitmentTransaction_free(this_obj_conv);
35334 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
35335 LDKHolderCommitmentTransaction this_ptr_conv;
35336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35337 this_ptr_conv.is_owned = false;
35338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35339 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35340 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
35344 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
35345 LDKHolderCommitmentTransaction this_ptr_conv;
35346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35347 this_ptr_conv.is_owned = false;
35348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35349 LDKSignature val_ref;
35350 CHECK(val->arr_len == 64);
35351 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35352 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
35355 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
35356 LDKHolderCommitmentTransaction this_ptr_conv;
35357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35358 this_ptr_conv.is_owned = false;
35359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35360 LDKCVec_SignatureZ val_constr;
35361 val_constr.datalen = val->arr_len;
35362 if (val_constr.datalen > 0)
35363 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35365 val_constr.data = NULL;
35366 int8_tArray* val_vals = (void*) val->elems;
35367 for (size_t m = 0; m < val_constr.datalen; m++) {
35368 int8_tArray val_conv_12 = val_vals[m];
35369 LDKSignature val_conv_12_ref;
35370 CHECK(val_conv_12->arr_len == 64);
35371 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
35372 val_constr.data[m] = val_conv_12_ref;
35375 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
35378 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
35379 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
35380 uint32_t ret_ref = 0;
35381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35384 ret_ref = (uintptr_t)ret_var.inner;
35385 if (ret_var.is_owned) {
35390 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
35391 LDKHolderCommitmentTransaction arg_conv;
35392 arg_conv.inner = (void*)(arg & (~1));
35393 arg_conv.is_owned = false;
35394 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35395 uint32_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
35399 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
35400 LDKHolderCommitmentTransaction orig_conv;
35401 orig_conv.inner = (void*)(orig & (~1));
35402 orig_conv.is_owned = false;
35403 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35404 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
35405 uint32_t ret_ref = 0;
35406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35409 ret_ref = (uintptr_t)ret_var.inner;
35410 if (ret_var.is_owned) {
35416 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
35417 LDKHolderCommitmentTransaction obj_conv;
35418 obj_conv.inner = (void*)(obj & (~1));
35419 obj_conv.is_owned = false;
35420 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35421 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
35422 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35423 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35424 CVec_u8Z_free(ret_var);
35428 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
35429 LDKu8slice ser_ref;
35430 ser_ref.datalen = ser->arr_len;
35431 ser_ref.data = ser->elems;
35432 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
35433 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
35435 return (uint32_t)ret_conv;
35438 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) {
35439 LDKCommitmentTransaction commitment_tx_conv;
35440 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
35441 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
35442 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
35443 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
35444 LDKSignature counterparty_sig_ref;
35445 CHECK(counterparty_sig->arr_len == 64);
35446 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
35447 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
35448 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
35449 if (counterparty_htlc_sigs_constr.datalen > 0)
35450 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35452 counterparty_htlc_sigs_constr.data = NULL;
35453 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
35454 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
35455 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
35456 LDKSignature counterparty_htlc_sigs_conv_12_ref;
35457 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
35458 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
35459 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
35461 FREE(counterparty_htlc_sigs);
35462 LDKPublicKey holder_funding_key_ref;
35463 CHECK(holder_funding_key->arr_len == 33);
35464 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
35465 LDKPublicKey counterparty_funding_key_ref;
35466 CHECK(counterparty_funding_key->arr_len == 33);
35467 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
35468 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
35469 uint32_t ret_ref = 0;
35470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35473 ret_ref = (uintptr_t)ret_var.inner;
35474 if (ret_var.is_owned) {
35480 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
35481 LDKBuiltCommitmentTransaction this_obj_conv;
35482 this_obj_conv.inner = (void*)(this_obj & (~1));
35483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35485 BuiltCommitmentTransaction_free(this_obj_conv);
35488 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
35489 LDKBuiltCommitmentTransaction this_ptr_conv;
35490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35491 this_ptr_conv.is_owned = false;
35492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35493 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35494 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35495 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35496 Transaction_free(ret_var);
35500 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
35501 LDKBuiltCommitmentTransaction this_ptr_conv;
35502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35503 this_ptr_conv.is_owned = false;
35504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35505 LDKTransaction val_ref;
35506 val_ref.datalen = val->arr_len;
35507 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35508 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35509 val_ref.data_is_owned = true;
35510 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35513 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
35514 LDKBuiltCommitmentTransaction this_ptr_conv;
35515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35516 this_ptr_conv.is_owned = false;
35517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35518 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35519 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
35523 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
35524 LDKBuiltCommitmentTransaction this_ptr_conv;
35525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35526 this_ptr_conv.is_owned = false;
35527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35528 LDKThirtyTwoBytes val_ref;
35529 CHECK(val->arr_len == 32);
35530 memcpy(val_ref.data, val->elems, 32); FREE(val);
35531 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35534 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
35535 LDKTransaction transaction_arg_ref;
35536 transaction_arg_ref.datalen = transaction_arg->arr_len;
35537 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35538 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
35539 transaction_arg_ref.data_is_owned = true;
35540 LDKThirtyTwoBytes txid_arg_ref;
35541 CHECK(txid_arg->arr_len == 32);
35542 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35543 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35544 uint32_t ret_ref = 0;
35545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35548 ret_ref = (uintptr_t)ret_var.inner;
35549 if (ret_var.is_owned) {
35555 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35556 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35557 uint32_t ret_ref = 0;
35558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35561 ret_ref = (uintptr_t)ret_var.inner;
35562 if (ret_var.is_owned) {
35567 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
35568 LDKBuiltCommitmentTransaction arg_conv;
35569 arg_conv.inner = (void*)(arg & (~1));
35570 arg_conv.is_owned = false;
35571 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35572 uint32_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35576 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
35577 LDKBuiltCommitmentTransaction orig_conv;
35578 orig_conv.inner = (void*)(orig & (~1));
35579 orig_conv.is_owned = false;
35580 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35581 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35582 uint32_t ret_ref = 0;
35583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35586 ret_ref = (uintptr_t)ret_var.inner;
35587 if (ret_var.is_owned) {
35593 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
35594 LDKBuiltCommitmentTransaction obj_conv;
35595 obj_conv.inner = (void*)(obj & (~1));
35596 obj_conv.is_owned = false;
35597 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35598 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35599 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35600 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35601 CVec_u8Z_free(ret_var);
35605 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
35606 LDKu8slice ser_ref;
35607 ser_ref.datalen = ser->arr_len;
35608 ser_ref.data = ser->elems;
35609 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35610 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35612 return (uint32_t)ret_conv;
35615 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) {
35616 LDKBuiltCommitmentTransaction this_arg_conv;
35617 this_arg_conv.inner = (void*)(this_arg & (~1));
35618 this_arg_conv.is_owned = false;
35619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35620 LDKu8slice funding_redeemscript_ref;
35621 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35622 funding_redeemscript_ref.data = funding_redeemscript->elems;
35623 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35624 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35625 FREE(funding_redeemscript);
35629 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) {
35630 LDKBuiltCommitmentTransaction this_arg_conv;
35631 this_arg_conv.inner = (void*)(this_arg & (~1));
35632 this_arg_conv.is_owned = false;
35633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35634 unsigned char funding_key_arr[32];
35635 CHECK(funding_key->arr_len == 32);
35636 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35637 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35638 LDKu8slice funding_redeemscript_ref;
35639 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35640 funding_redeemscript_ref.data = funding_redeemscript->elems;
35641 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35642 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35643 FREE(funding_redeemscript);
35647 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
35648 LDKClosingTransaction this_obj_conv;
35649 this_obj_conv.inner = (void*)(this_obj & (~1));
35650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35652 ClosingTransaction_free(this_obj_conv);
35655 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35656 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35657 uint32_t ret_ref = 0;
35658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35661 ret_ref = (uintptr_t)ret_var.inner;
35662 if (ret_var.is_owned) {
35667 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
35668 LDKClosingTransaction arg_conv;
35669 arg_conv.inner = (void*)(arg & (~1));
35670 arg_conv.is_owned = false;
35671 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35672 uint32_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
35676 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
35677 LDKClosingTransaction orig_conv;
35678 orig_conv.inner = (void*)(orig & (~1));
35679 orig_conv.is_owned = false;
35680 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35681 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35682 uint32_t ret_ref = 0;
35683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35686 ret_ref = (uintptr_t)ret_var.inner;
35687 if (ret_var.is_owned) {
35693 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
35694 LDKClosingTransaction o_conv;
35695 o_conv.inner = (void*)(o & (~1));
35696 o_conv.is_owned = false;
35697 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35698 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
35702 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) {
35703 LDKCVec_u8Z to_holder_script_ref;
35704 to_holder_script_ref.datalen = to_holder_script->arr_len;
35705 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35706 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35707 LDKCVec_u8Z to_counterparty_script_ref;
35708 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35709 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35710 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35711 LDKOutPoint funding_outpoint_conv;
35712 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35713 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35714 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35715 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35716 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35717 uint32_t ret_ref = 0;
35718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35721 ret_ref = (uintptr_t)ret_var.inner;
35722 if (ret_var.is_owned) {
35728 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
35729 LDKClosingTransaction this_arg_conv;
35730 this_arg_conv.inner = (void*)(this_arg & (~1));
35731 this_arg_conv.is_owned = false;
35732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35733 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35734 uint32_t ret_ref = 0;
35735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35738 ret_ref = (uintptr_t)ret_var.inner;
35739 if (ret_var.is_owned) {
35745 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
35746 LDKClosingTransaction this_arg_conv;
35747 this_arg_conv.inner = (void*)(this_arg & (~1));
35748 this_arg_conv.is_owned = false;
35749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35750 LDKOutPoint funding_outpoint_conv;
35751 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35752 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35753 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35754 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35755 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35756 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35757 return (uint32_t)ret_conv;
35760 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
35761 LDKClosingTransaction this_arg_conv;
35762 this_arg_conv.inner = (void*)(this_arg & (~1));
35763 this_arg_conv.is_owned = false;
35764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35765 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35769 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
35770 LDKClosingTransaction this_arg_conv;
35771 this_arg_conv.inner = (void*)(this_arg & (~1));
35772 this_arg_conv.is_owned = false;
35773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35774 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35778 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
35779 LDKClosingTransaction this_arg_conv;
35780 this_arg_conv.inner = (void*)(this_arg & (~1));
35781 this_arg_conv.is_owned = false;
35782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35783 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35784 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35785 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35789 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
35790 LDKClosingTransaction this_arg_conv;
35791 this_arg_conv.inner = (void*)(this_arg & (~1));
35792 this_arg_conv.is_owned = false;
35793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35794 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35795 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35796 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35800 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
35801 LDKTrustedClosingTransaction this_obj_conv;
35802 this_obj_conv.inner = (void*)(this_obj & (~1));
35803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35805 TrustedClosingTransaction_free(this_obj_conv);
35808 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
35809 LDKTrustedClosingTransaction this_arg_conv;
35810 this_arg_conv.inner = (void*)(this_arg & (~1));
35811 this_arg_conv.is_owned = false;
35812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35813 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35814 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35815 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35816 Transaction_free(ret_var);
35820 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) {
35821 LDKTrustedClosingTransaction this_arg_conv;
35822 this_arg_conv.inner = (void*)(this_arg & (~1));
35823 this_arg_conv.is_owned = false;
35824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35825 LDKu8slice funding_redeemscript_ref;
35826 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35827 funding_redeemscript_ref.data = funding_redeemscript->elems;
35828 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35829 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35830 FREE(funding_redeemscript);
35834 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) {
35835 LDKTrustedClosingTransaction this_arg_conv;
35836 this_arg_conv.inner = (void*)(this_arg & (~1));
35837 this_arg_conv.is_owned = false;
35838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35839 unsigned char funding_key_arr[32];
35840 CHECK(funding_key->arr_len == 32);
35841 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35842 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35843 LDKu8slice funding_redeemscript_ref;
35844 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35845 funding_redeemscript_ref.data = funding_redeemscript->elems;
35846 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35847 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35848 FREE(funding_redeemscript);
35852 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
35853 LDKCommitmentTransaction this_obj_conv;
35854 this_obj_conv.inner = (void*)(this_obj & (~1));
35855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35857 CommitmentTransaction_free(this_obj_conv);
35860 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35861 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35862 uint32_t ret_ref = 0;
35863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35866 ret_ref = (uintptr_t)ret_var.inner;
35867 if (ret_var.is_owned) {
35872 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
35873 LDKCommitmentTransaction arg_conv;
35874 arg_conv.inner = (void*)(arg & (~1));
35875 arg_conv.is_owned = false;
35876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35877 uint32_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
35881 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
35882 LDKCommitmentTransaction orig_conv;
35883 orig_conv.inner = (void*)(orig & (~1));
35884 orig_conv.is_owned = false;
35885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35886 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35887 uint32_t ret_ref = 0;
35888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35891 ret_ref = (uintptr_t)ret_var.inner;
35892 if (ret_var.is_owned) {
35898 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
35899 LDKCommitmentTransaction obj_conv;
35900 obj_conv.inner = (void*)(obj & (~1));
35901 obj_conv.is_owned = false;
35902 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35903 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
35904 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35905 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35906 CVec_u8Z_free(ret_var);
35910 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
35911 LDKu8slice ser_ref;
35912 ser_ref.datalen = ser->arr_len;
35913 ser_ref.data = ser->elems;
35914 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
35915 *ret_conv = CommitmentTransaction_read(ser_ref);
35917 return (uint32_t)ret_conv;
35920 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
35921 LDKCommitmentTransaction this_arg_conv;
35922 this_arg_conv.inner = (void*)(this_arg & (~1));
35923 this_arg_conv.is_owned = false;
35924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35925 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
35929 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
35930 LDKCommitmentTransaction this_arg_conv;
35931 this_arg_conv.inner = (void*)(this_arg & (~1));
35932 this_arg_conv.is_owned = false;
35933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35934 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
35938 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
35939 LDKCommitmentTransaction this_arg_conv;
35940 this_arg_conv.inner = (void*)(this_arg & (~1));
35941 this_arg_conv.is_owned = false;
35942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35943 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
35947 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
35948 LDKCommitmentTransaction this_arg_conv;
35949 this_arg_conv.inner = (void*)(this_arg & (~1));
35950 this_arg_conv.is_owned = false;
35951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35952 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
35956 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
35957 LDKCommitmentTransaction this_arg_conv;
35958 this_arg_conv.inner = (void*)(this_arg & (~1));
35959 this_arg_conv.is_owned = false;
35960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35961 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
35962 uint32_t ret_ref = 0;
35963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35966 ret_ref = (uintptr_t)ret_var.inner;
35967 if (ret_var.is_owned) {
35973 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) {
35974 LDKCommitmentTransaction this_arg_conv;
35975 this_arg_conv.inner = (void*)(this_arg & (~1));
35976 this_arg_conv.is_owned = false;
35977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35978 LDKDirectedChannelTransactionParameters channel_parameters_conv;
35979 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
35980 channel_parameters_conv.is_owned = false;
35981 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35982 LDKChannelPublicKeys broadcaster_keys_conv;
35983 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
35984 broadcaster_keys_conv.is_owned = false;
35985 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35986 LDKChannelPublicKeys countersignatory_keys_conv;
35987 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
35988 countersignatory_keys_conv.is_owned = false;
35989 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35990 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
35991 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
35992 return (uint32_t)ret_conv;
35995 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
35996 LDKTrustedCommitmentTransaction this_obj_conv;
35997 this_obj_conv.inner = (void*)(this_obj & (~1));
35998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36000 TrustedCommitmentTransaction_free(this_obj_conv);
36003 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
36004 LDKTrustedCommitmentTransaction this_arg_conv;
36005 this_arg_conv.inner = (void*)(this_arg & (~1));
36006 this_arg_conv.is_owned = false;
36007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36008 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36009 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
36013 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
36014 LDKTrustedCommitmentTransaction this_arg_conv;
36015 this_arg_conv.inner = (void*)(this_arg & (~1));
36016 this_arg_conv.is_owned = false;
36017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36018 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
36019 uint32_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 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
36031 LDKTrustedCommitmentTransaction this_arg_conv;
36032 this_arg_conv.inner = (void*)(this_arg & (~1));
36033 this_arg_conv.is_owned = false;
36034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36035 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
36036 uint32_t ret_ref = 0;
36037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36040 ret_ref = (uintptr_t)ret_var.inner;
36041 if (ret_var.is_owned) {
36047 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
36048 LDKTrustedCommitmentTransaction this_arg_conv;
36049 this_arg_conv.inner = (void*)(this_arg & (~1));
36050 this_arg_conv.is_owned = false;
36051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36052 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
36056 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) {
36057 LDKTrustedCommitmentTransaction this_arg_conv;
36058 this_arg_conv.inner = (void*)(this_arg & (~1));
36059 this_arg_conv.is_owned = false;
36060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36061 unsigned char htlc_base_key_arr[32];
36062 CHECK(htlc_base_key->arr_len == 32);
36063 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
36064 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
36065 LDKDirectedChannelTransactionParameters channel_parameters_conv;
36066 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
36067 channel_parameters_conv.is_owned = false;
36068 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
36069 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
36070 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
36071 return (uint32_t)ret_conv;
36074 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) {
36075 LDKPublicKey broadcaster_payment_basepoint_ref;
36076 CHECK(broadcaster_payment_basepoint->arr_len == 33);
36077 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
36078 LDKPublicKey countersignatory_payment_basepoint_ref;
36079 CHECK(countersignatory_payment_basepoint->arr_len == 33);
36080 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
36081 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
36085 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
36086 LDKInitFeatures a_conv;
36087 a_conv.inner = (void*)(a & (~1));
36088 a_conv.is_owned = false;
36089 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36090 LDKInitFeatures b_conv;
36091 b_conv.inner = (void*)(b & (~1));
36092 b_conv.is_owned = false;
36093 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36094 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
36098 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
36099 LDKNodeFeatures a_conv;
36100 a_conv.inner = (void*)(a & (~1));
36101 a_conv.is_owned = false;
36102 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36103 LDKNodeFeatures b_conv;
36104 b_conv.inner = (void*)(b & (~1));
36105 b_conv.is_owned = false;
36106 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36107 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
36111 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
36112 LDKChannelFeatures a_conv;
36113 a_conv.inner = (void*)(a & (~1));
36114 a_conv.is_owned = false;
36115 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36116 LDKChannelFeatures b_conv;
36117 b_conv.inner = (void*)(b & (~1));
36118 b_conv.is_owned = false;
36119 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36120 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
36124 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
36125 LDKInvoiceFeatures a_conv;
36126 a_conv.inner = (void*)(a & (~1));
36127 a_conv.is_owned = false;
36128 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36129 LDKInvoiceFeatures b_conv;
36130 b_conv.inner = (void*)(b & (~1));
36131 b_conv.is_owned = false;
36132 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36133 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
36137 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
36138 LDKChannelTypeFeatures a_conv;
36139 a_conv.inner = (void*)(a & (~1));
36140 a_conv.is_owned = false;
36141 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36142 LDKChannelTypeFeatures b_conv;
36143 b_conv.inner = (void*)(b & (~1));
36144 b_conv.is_owned = false;
36145 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36146 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
36150 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
36151 LDKInitFeatures ret_var = InitFeatures_clone(arg);
36152 uint32_t ret_ref = 0;
36153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36156 ret_ref = (uintptr_t)ret_var.inner;
36157 if (ret_var.is_owned) {
36162 uint32_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
36163 LDKInitFeatures arg_conv;
36164 arg_conv.inner = (void*)(arg & (~1));
36165 arg_conv.is_owned = false;
36166 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36167 uint32_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
36171 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
36172 LDKInitFeatures orig_conv;
36173 orig_conv.inner = (void*)(orig & (~1));
36174 orig_conv.is_owned = false;
36175 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36176 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
36177 uint32_t ret_ref = 0;
36178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36181 ret_ref = (uintptr_t)ret_var.inner;
36182 if (ret_var.is_owned) {
36188 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
36189 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
36190 uint32_t ret_ref = 0;
36191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36194 ret_ref = (uintptr_t)ret_var.inner;
36195 if (ret_var.is_owned) {
36200 uint32_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
36201 LDKNodeFeatures arg_conv;
36202 arg_conv.inner = (void*)(arg & (~1));
36203 arg_conv.is_owned = false;
36204 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36205 uint32_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
36209 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
36210 LDKNodeFeatures orig_conv;
36211 orig_conv.inner = (void*)(orig & (~1));
36212 orig_conv.is_owned = false;
36213 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36214 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
36215 uint32_t ret_ref = 0;
36216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36219 ret_ref = (uintptr_t)ret_var.inner;
36220 if (ret_var.is_owned) {
36226 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
36227 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
36228 uint32_t ret_ref = 0;
36229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36232 ret_ref = (uintptr_t)ret_var.inner;
36233 if (ret_var.is_owned) {
36238 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
36239 LDKChannelFeatures arg_conv;
36240 arg_conv.inner = (void*)(arg & (~1));
36241 arg_conv.is_owned = false;
36242 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36243 uint32_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
36247 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
36248 LDKChannelFeatures orig_conv;
36249 orig_conv.inner = (void*)(orig & (~1));
36250 orig_conv.is_owned = false;
36251 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36252 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
36253 uint32_t ret_ref = 0;
36254 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36255 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36257 ret_ref = (uintptr_t)ret_var.inner;
36258 if (ret_var.is_owned) {
36264 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
36265 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
36266 uint32_t ret_ref = 0;
36267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36270 ret_ref = (uintptr_t)ret_var.inner;
36271 if (ret_var.is_owned) {
36276 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
36277 LDKInvoiceFeatures arg_conv;
36278 arg_conv.inner = (void*)(arg & (~1));
36279 arg_conv.is_owned = false;
36280 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36281 uint32_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
36285 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
36286 LDKInvoiceFeatures orig_conv;
36287 orig_conv.inner = (void*)(orig & (~1));
36288 orig_conv.is_owned = false;
36289 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36290 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
36291 uint32_t ret_ref = 0;
36292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36295 ret_ref = (uintptr_t)ret_var.inner;
36296 if (ret_var.is_owned) {
36302 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
36303 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
36304 uint32_t ret_ref = 0;
36305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36308 ret_ref = (uintptr_t)ret_var.inner;
36309 if (ret_var.is_owned) {
36314 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
36315 LDKChannelTypeFeatures arg_conv;
36316 arg_conv.inner = (void*)(arg & (~1));
36317 arg_conv.is_owned = false;
36318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36319 uint32_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
36323 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
36324 LDKChannelTypeFeatures orig_conv;
36325 orig_conv.inner = (void*)(orig & (~1));
36326 orig_conv.is_owned = false;
36327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36328 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
36329 uint32_t ret_ref = 0;
36330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36333 ret_ref = (uintptr_t)ret_var.inner;
36334 if (ret_var.is_owned) {
36340 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
36341 LDKInitFeatures this_obj_conv;
36342 this_obj_conv.inner = (void*)(this_obj & (~1));
36343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36345 InitFeatures_free(this_obj_conv);
36348 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
36349 LDKNodeFeatures this_obj_conv;
36350 this_obj_conv.inner = (void*)(this_obj & (~1));
36351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36353 NodeFeatures_free(this_obj_conv);
36356 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
36357 LDKChannelFeatures this_obj_conv;
36358 this_obj_conv.inner = (void*)(this_obj & (~1));
36359 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36361 ChannelFeatures_free(this_obj_conv);
36364 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
36365 LDKInvoiceFeatures this_obj_conv;
36366 this_obj_conv.inner = (void*)(this_obj & (~1));
36367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36369 InvoiceFeatures_free(this_obj_conv);
36372 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
36373 LDKChannelTypeFeatures this_obj_conv;
36374 this_obj_conv.inner = (void*)(this_obj & (~1));
36375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36377 ChannelTypeFeatures_free(this_obj_conv);
36380 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
36381 LDKInitFeatures ret_var = InitFeatures_empty();
36382 uint32_t ret_ref = 0;
36383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36386 ret_ref = (uintptr_t)ret_var.inner;
36387 if (ret_var.is_owned) {
36393 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
36394 LDKInitFeatures ret_var = InitFeatures_known();
36395 uint32_t ret_ref = 0;
36396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36399 ret_ref = (uintptr_t)ret_var.inner;
36400 if (ret_var.is_owned) {
36406 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
36407 LDKInitFeatures this_arg_conv;
36408 this_arg_conv.inner = (void*)(this_arg & (~1));
36409 this_arg_conv.is_owned = false;
36410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36411 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
36415 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
36416 LDKNodeFeatures ret_var = NodeFeatures_empty();
36417 uint32_t ret_ref = 0;
36418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36421 ret_ref = (uintptr_t)ret_var.inner;
36422 if (ret_var.is_owned) {
36428 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
36429 LDKNodeFeatures ret_var = NodeFeatures_known();
36430 uint32_t ret_ref = 0;
36431 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36432 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36434 ret_ref = (uintptr_t)ret_var.inner;
36435 if (ret_var.is_owned) {
36441 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
36442 LDKNodeFeatures this_arg_conv;
36443 this_arg_conv.inner = (void*)(this_arg & (~1));
36444 this_arg_conv.is_owned = false;
36445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36446 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
36450 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
36451 LDKChannelFeatures ret_var = ChannelFeatures_empty();
36452 uint32_t ret_ref = 0;
36453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36456 ret_ref = (uintptr_t)ret_var.inner;
36457 if (ret_var.is_owned) {
36463 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
36464 LDKChannelFeatures ret_var = ChannelFeatures_known();
36465 uint32_t ret_ref = 0;
36466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36469 ret_ref = (uintptr_t)ret_var.inner;
36470 if (ret_var.is_owned) {
36476 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
36477 LDKChannelFeatures this_arg_conv;
36478 this_arg_conv.inner = (void*)(this_arg & (~1));
36479 this_arg_conv.is_owned = false;
36480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36481 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
36485 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
36486 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
36487 uint32_t ret_ref = 0;
36488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36491 ret_ref = (uintptr_t)ret_var.inner;
36492 if (ret_var.is_owned) {
36498 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
36499 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
36500 uint32_t ret_ref = 0;
36501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36504 ret_ref = (uintptr_t)ret_var.inner;
36505 if (ret_var.is_owned) {
36511 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
36512 LDKInvoiceFeatures this_arg_conv;
36513 this_arg_conv.inner = (void*)(this_arg & (~1));
36514 this_arg_conv.is_owned = false;
36515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36516 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
36520 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
36521 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
36522 uint32_t ret_ref = 0;
36523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36526 ret_ref = (uintptr_t)ret_var.inner;
36527 if (ret_var.is_owned) {
36533 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
36534 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
36535 uint32_t ret_ref = 0;
36536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36539 ret_ref = (uintptr_t)ret_var.inner;
36540 if (ret_var.is_owned) {
36546 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
36547 LDKChannelTypeFeatures this_arg_conv;
36548 this_arg_conv.inner = (void*)(this_arg & (~1));
36549 this_arg_conv.is_owned = false;
36550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36551 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
36555 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
36556 LDKInitFeatures obj_conv;
36557 obj_conv.inner = (void*)(obj & (~1));
36558 obj_conv.is_owned = false;
36559 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36560 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
36561 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36562 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36563 CVec_u8Z_free(ret_var);
36567 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
36568 LDKu8slice ser_ref;
36569 ser_ref.datalen = ser->arr_len;
36570 ser_ref.data = ser->elems;
36571 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
36572 *ret_conv = InitFeatures_read(ser_ref);
36574 return (uint32_t)ret_conv;
36577 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
36578 LDKChannelFeatures obj_conv;
36579 obj_conv.inner = (void*)(obj & (~1));
36580 obj_conv.is_owned = false;
36581 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36582 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
36583 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36584 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36585 CVec_u8Z_free(ret_var);
36589 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
36590 LDKu8slice ser_ref;
36591 ser_ref.datalen = ser->arr_len;
36592 ser_ref.data = ser->elems;
36593 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36594 *ret_conv = ChannelFeatures_read(ser_ref);
36596 return (uint32_t)ret_conv;
36599 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
36600 LDKNodeFeatures obj_conv;
36601 obj_conv.inner = (void*)(obj & (~1));
36602 obj_conv.is_owned = false;
36603 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36604 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36605 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36606 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36607 CVec_u8Z_free(ret_var);
36611 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
36612 LDKu8slice ser_ref;
36613 ser_ref.datalen = ser->arr_len;
36614 ser_ref.data = ser->elems;
36615 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36616 *ret_conv = NodeFeatures_read(ser_ref);
36618 return (uint32_t)ret_conv;
36621 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
36622 LDKInvoiceFeatures obj_conv;
36623 obj_conv.inner = (void*)(obj & (~1));
36624 obj_conv.is_owned = false;
36625 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36626 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36627 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36628 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36629 CVec_u8Z_free(ret_var);
36633 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
36634 LDKu8slice ser_ref;
36635 ser_ref.datalen = ser->arr_len;
36636 ser_ref.data = ser->elems;
36637 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36638 *ret_conv = InvoiceFeatures_read(ser_ref);
36640 return (uint32_t)ret_conv;
36643 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
36644 LDKChannelTypeFeatures obj_conv;
36645 obj_conv.inner = (void*)(obj & (~1));
36646 obj_conv.is_owned = false;
36647 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36648 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36649 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36650 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36651 CVec_u8Z_free(ret_var);
36655 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
36656 LDKu8slice ser_ref;
36657 ser_ref.datalen = ser->arr_len;
36658 ser_ref.data = ser->elems;
36659 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36660 *ret_conv = ChannelTypeFeatures_read(ser_ref);
36662 return (uint32_t)ret_conv;
36665 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36666 LDKInitFeatures this_arg_conv;
36667 this_arg_conv.inner = (void*)(this_arg & (~1));
36668 this_arg_conv.is_owned = false;
36669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36670 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
36673 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36674 LDKInitFeatures this_arg_conv;
36675 this_arg_conv.inner = (void*)(this_arg & (~1));
36676 this_arg_conv.is_owned = false;
36677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36678 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
36681 jboolean __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint32_t this_arg) {
36682 LDKInitFeatures this_arg_conv;
36683 this_arg_conv.inner = (void*)(this_arg & (~1));
36684 this_arg_conv.is_owned = false;
36685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36686 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
36690 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36691 LDKNodeFeatures this_arg_conv;
36692 this_arg_conv.inner = (void*)(this_arg & (~1));
36693 this_arg_conv.is_owned = false;
36694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36695 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
36698 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36699 LDKNodeFeatures this_arg_conv;
36700 this_arg_conv.inner = (void*)(this_arg & (~1));
36701 this_arg_conv.is_owned = false;
36702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36703 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
36706 jboolean __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint32_t this_arg) {
36707 LDKNodeFeatures this_arg_conv;
36708 this_arg_conv.inner = (void*)(this_arg & (~1));
36709 this_arg_conv.is_owned = false;
36710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36711 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
36715 jboolean __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint32_t this_arg) {
36716 LDKInitFeatures this_arg_conv;
36717 this_arg_conv.inner = (void*)(this_arg & (~1));
36718 this_arg_conv.is_owned = false;
36719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36720 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
36724 jboolean __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint32_t this_arg) {
36725 LDKNodeFeatures this_arg_conv;
36726 this_arg_conv.inner = (void*)(this_arg & (~1));
36727 this_arg_conv.is_owned = false;
36728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36729 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
36733 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint32_t this_arg) {
36734 LDKInitFeatures this_arg_conv;
36735 this_arg_conv.inner = (void*)(this_arg & (~1));
36736 this_arg_conv.is_owned = false;
36737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36738 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
36741 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint32_t this_arg) {
36742 LDKInitFeatures this_arg_conv;
36743 this_arg_conv.inner = (void*)(this_arg & (~1));
36744 this_arg_conv.is_owned = false;
36745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36746 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
36749 jboolean __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint32_t this_arg) {
36750 LDKInitFeatures this_arg_conv;
36751 this_arg_conv.inner = (void*)(this_arg & (~1));
36752 this_arg_conv.is_owned = false;
36753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36754 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
36758 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36759 LDKInitFeatures this_arg_conv;
36760 this_arg_conv.inner = (void*)(this_arg & (~1));
36761 this_arg_conv.is_owned = false;
36762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36763 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36766 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36767 LDKInitFeatures this_arg_conv;
36768 this_arg_conv.inner = (void*)(this_arg & (~1));
36769 this_arg_conv.is_owned = false;
36770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36771 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36774 jboolean __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36775 LDKInitFeatures this_arg_conv;
36776 this_arg_conv.inner = (void*)(this_arg & (~1));
36777 this_arg_conv.is_owned = false;
36778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36779 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36783 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36784 LDKNodeFeatures this_arg_conv;
36785 this_arg_conv.inner = (void*)(this_arg & (~1));
36786 this_arg_conv.is_owned = false;
36787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36788 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36791 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36792 LDKNodeFeatures this_arg_conv;
36793 this_arg_conv.inner = (void*)(this_arg & (~1));
36794 this_arg_conv.is_owned = false;
36795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36796 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36799 jboolean __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36800 LDKNodeFeatures this_arg_conv;
36801 this_arg_conv.inner = (void*)(this_arg & (~1));
36802 this_arg_conv.is_owned = false;
36803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36804 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36808 jboolean __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36809 LDKInitFeatures this_arg_conv;
36810 this_arg_conv.inner = (void*)(this_arg & (~1));
36811 this_arg_conv.is_owned = false;
36812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36813 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36817 jboolean __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36818 LDKNodeFeatures this_arg_conv;
36819 this_arg_conv.inner = (void*)(this_arg & (~1));
36820 this_arg_conv.is_owned = false;
36821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36822 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36826 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36827 LDKInitFeatures this_arg_conv;
36828 this_arg_conv.inner = (void*)(this_arg & (~1));
36829 this_arg_conv.is_owned = false;
36830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36831 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
36834 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint32_t this_arg) {
36835 LDKInitFeatures this_arg_conv;
36836 this_arg_conv.inner = (void*)(this_arg & (~1));
36837 this_arg_conv.is_owned = false;
36838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36839 InitFeatures_set_gossip_queries_required(&this_arg_conv);
36842 jboolean __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint32_t this_arg) {
36843 LDKInitFeatures 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 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
36851 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36852 LDKNodeFeatures this_arg_conv;
36853 this_arg_conv.inner = (void*)(this_arg & (~1));
36854 this_arg_conv.is_owned = false;
36855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36856 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
36859 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint32_t this_arg) {
36860 LDKNodeFeatures this_arg_conv;
36861 this_arg_conv.inner = (void*)(this_arg & (~1));
36862 this_arg_conv.is_owned = false;
36863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36864 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
36867 jboolean __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint32_t this_arg) {
36868 LDKNodeFeatures this_arg_conv;
36869 this_arg_conv.inner = (void*)(this_arg & (~1));
36870 this_arg_conv.is_owned = false;
36871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36872 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
36876 jboolean __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint32_t this_arg) {
36877 LDKInitFeatures this_arg_conv;
36878 this_arg_conv.inner = (void*)(this_arg & (~1));
36879 this_arg_conv.is_owned = false;
36880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36881 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
36885 jboolean __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint32_t this_arg) {
36886 LDKNodeFeatures this_arg_conv;
36887 this_arg_conv.inner = (void*)(this_arg & (~1));
36888 this_arg_conv.is_owned = false;
36889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36890 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
36894 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36895 LDKInitFeatures this_arg_conv;
36896 this_arg_conv.inner = (void*)(this_arg & (~1));
36897 this_arg_conv.is_owned = false;
36898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36899 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
36902 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36903 LDKInitFeatures this_arg_conv;
36904 this_arg_conv.inner = (void*)(this_arg & (~1));
36905 this_arg_conv.is_owned = false;
36906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36907 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
36910 jboolean __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint32_t this_arg) {
36911 LDKInitFeatures this_arg_conv;
36912 this_arg_conv.inner = (void*)(this_arg & (~1));
36913 this_arg_conv.is_owned = false;
36914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36915 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
36919 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36920 LDKNodeFeatures this_arg_conv;
36921 this_arg_conv.inner = (void*)(this_arg & (~1));
36922 this_arg_conv.is_owned = false;
36923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36924 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
36927 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36928 LDKNodeFeatures this_arg_conv;
36929 this_arg_conv.inner = (void*)(this_arg & (~1));
36930 this_arg_conv.is_owned = false;
36931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36932 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
36935 jboolean __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint32_t this_arg) {
36936 LDKNodeFeatures this_arg_conv;
36937 this_arg_conv.inner = (void*)(this_arg & (~1));
36938 this_arg_conv.is_owned = false;
36939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36940 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
36944 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36945 LDKInvoiceFeatures this_arg_conv;
36946 this_arg_conv.inner = (void*)(this_arg & (~1));
36947 this_arg_conv.is_owned = false;
36948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36949 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
36952 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36953 LDKInvoiceFeatures this_arg_conv;
36954 this_arg_conv.inner = (void*)(this_arg & (~1));
36955 this_arg_conv.is_owned = false;
36956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36957 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
36960 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint32_t this_arg) {
36961 LDKInvoiceFeatures this_arg_conv;
36962 this_arg_conv.inner = (void*)(this_arg & (~1));
36963 this_arg_conv.is_owned = false;
36964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36965 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
36969 jboolean __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint32_t this_arg) {
36970 LDKInitFeatures this_arg_conv;
36971 this_arg_conv.inner = (void*)(this_arg & (~1));
36972 this_arg_conv.is_owned = false;
36973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36974 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
36978 jboolean __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint32_t this_arg) {
36979 LDKNodeFeatures this_arg_conv;
36980 this_arg_conv.inner = (void*)(this_arg & (~1));
36981 this_arg_conv.is_owned = false;
36982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36983 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
36987 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint32_t this_arg) {
36988 LDKInvoiceFeatures this_arg_conv;
36989 this_arg_conv.inner = (void*)(this_arg & (~1));
36990 this_arg_conv.is_owned = false;
36991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36992 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
36996 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint32_t this_arg) {
36997 LDKInitFeatures this_arg_conv;
36998 this_arg_conv.inner = (void*)(this_arg & (~1));
36999 this_arg_conv.is_owned = false;
37000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37001 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
37004 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint32_t this_arg) {
37005 LDKInitFeatures this_arg_conv;
37006 this_arg_conv.inner = (void*)(this_arg & (~1));
37007 this_arg_conv.is_owned = false;
37008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37009 InitFeatures_set_static_remote_key_required(&this_arg_conv);
37012 jboolean __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint32_t this_arg) {
37013 LDKInitFeatures this_arg_conv;
37014 this_arg_conv.inner = (void*)(this_arg & (~1));
37015 this_arg_conv.is_owned = false;
37016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37017 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
37021 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
37022 LDKNodeFeatures this_arg_conv;
37023 this_arg_conv.inner = (void*)(this_arg & (~1));
37024 this_arg_conv.is_owned = false;
37025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37026 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
37029 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint32_t this_arg) {
37030 LDKNodeFeatures this_arg_conv;
37031 this_arg_conv.inner = (void*)(this_arg & (~1));
37032 this_arg_conv.is_owned = false;
37033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37034 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
37037 jboolean __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint32_t this_arg) {
37038 LDKNodeFeatures this_arg_conv;
37039 this_arg_conv.inner = (void*)(this_arg & (~1));
37040 this_arg_conv.is_owned = false;
37041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37042 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
37046 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
37047 LDKChannelTypeFeatures this_arg_conv;
37048 this_arg_conv.inner = (void*)(this_arg & (~1));
37049 this_arg_conv.is_owned = false;
37050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37051 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
37054 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint32_t this_arg) {
37055 LDKChannelTypeFeatures this_arg_conv;
37056 this_arg_conv.inner = (void*)(this_arg & (~1));
37057 this_arg_conv.is_owned = false;
37058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37059 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
37062 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint32_t this_arg) {
37063 LDKChannelTypeFeatures this_arg_conv;
37064 this_arg_conv.inner = (void*)(this_arg & (~1));
37065 this_arg_conv.is_owned = false;
37066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37067 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
37071 jboolean __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint32_t this_arg) {
37072 LDKInitFeatures this_arg_conv;
37073 this_arg_conv.inner = (void*)(this_arg & (~1));
37074 this_arg_conv.is_owned = false;
37075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37076 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
37080 jboolean __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint32_t this_arg) {
37081 LDKNodeFeatures this_arg_conv;
37082 this_arg_conv.inner = (void*)(this_arg & (~1));
37083 this_arg_conv.is_owned = false;
37084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37085 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
37089 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint32_t this_arg) {
37090 LDKChannelTypeFeatures this_arg_conv;
37091 this_arg_conv.inner = (void*)(this_arg & (~1));
37092 this_arg_conv.is_owned = false;
37093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37094 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
37098 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint32_t this_arg) {
37099 LDKInitFeatures this_arg_conv;
37100 this_arg_conv.inner = (void*)(this_arg & (~1));
37101 this_arg_conv.is_owned = false;
37102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37103 InitFeatures_set_payment_secret_optional(&this_arg_conv);
37106 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint32_t this_arg) {
37107 LDKInitFeatures this_arg_conv;
37108 this_arg_conv.inner = (void*)(this_arg & (~1));
37109 this_arg_conv.is_owned = false;
37110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37111 InitFeatures_set_payment_secret_required(&this_arg_conv);
37114 jboolean __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
37115 LDKInitFeatures this_arg_conv;
37116 this_arg_conv.inner = (void*)(this_arg & (~1));
37117 this_arg_conv.is_owned = false;
37118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37119 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
37123 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint32_t this_arg) {
37124 LDKNodeFeatures this_arg_conv;
37125 this_arg_conv.inner = (void*)(this_arg & (~1));
37126 this_arg_conv.is_owned = false;
37127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37128 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
37131 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint32_t this_arg) {
37132 LDKNodeFeatures this_arg_conv;
37133 this_arg_conv.inner = (void*)(this_arg & (~1));
37134 this_arg_conv.is_owned = false;
37135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37136 NodeFeatures_set_payment_secret_required(&this_arg_conv);
37139 jboolean __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
37140 LDKNodeFeatures this_arg_conv;
37141 this_arg_conv.inner = (void*)(this_arg & (~1));
37142 this_arg_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37144 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
37148 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint32_t this_arg) {
37149 LDKInvoiceFeatures this_arg_conv;
37150 this_arg_conv.inner = (void*)(this_arg & (~1));
37151 this_arg_conv.is_owned = false;
37152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37153 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
37156 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint32_t this_arg) {
37157 LDKInvoiceFeatures this_arg_conv;
37158 this_arg_conv.inner = (void*)(this_arg & (~1));
37159 this_arg_conv.is_owned = false;
37160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37161 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
37164 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
37165 LDKInvoiceFeatures this_arg_conv;
37166 this_arg_conv.inner = (void*)(this_arg & (~1));
37167 this_arg_conv.is_owned = false;
37168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37169 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
37173 jboolean __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint32_t this_arg) {
37174 LDKInitFeatures this_arg_conv;
37175 this_arg_conv.inner = (void*)(this_arg & (~1));
37176 this_arg_conv.is_owned = false;
37177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37178 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
37182 jboolean __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint32_t this_arg) {
37183 LDKNodeFeatures this_arg_conv;
37184 this_arg_conv.inner = (void*)(this_arg & (~1));
37185 this_arg_conv.is_owned = false;
37186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37187 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
37191 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint32_t this_arg) {
37192 LDKInvoiceFeatures this_arg_conv;
37193 this_arg_conv.inner = (void*)(this_arg & (~1));
37194 this_arg_conv.is_owned = false;
37195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37196 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
37200 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37201 LDKInitFeatures this_arg_conv;
37202 this_arg_conv.inner = (void*)(this_arg & (~1));
37203 this_arg_conv.is_owned = false;
37204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37205 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
37208 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint32_t this_arg) {
37209 LDKInitFeatures this_arg_conv;
37210 this_arg_conv.inner = (void*)(this_arg & (~1));
37211 this_arg_conv.is_owned = false;
37212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37213 InitFeatures_set_basic_mpp_required(&this_arg_conv);
37216 jboolean __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint32_t this_arg) {
37217 LDKInitFeatures this_arg_conv;
37218 this_arg_conv.inner = (void*)(this_arg & (~1));
37219 this_arg_conv.is_owned = false;
37220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37221 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
37225 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37226 LDKNodeFeatures this_arg_conv;
37227 this_arg_conv.inner = (void*)(this_arg & (~1));
37228 this_arg_conv.is_owned = false;
37229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37230 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
37233 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint32_t this_arg) {
37234 LDKNodeFeatures this_arg_conv;
37235 this_arg_conv.inner = (void*)(this_arg & (~1));
37236 this_arg_conv.is_owned = false;
37237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37238 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
37241 jboolean __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint32_t this_arg) {
37242 LDKNodeFeatures this_arg_conv;
37243 this_arg_conv.inner = (void*)(this_arg & (~1));
37244 this_arg_conv.is_owned = false;
37245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37246 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
37250 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37251 LDKInvoiceFeatures this_arg_conv;
37252 this_arg_conv.inner = (void*)(this_arg & (~1));
37253 this_arg_conv.is_owned = false;
37254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37255 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
37258 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint32_t this_arg) {
37259 LDKInvoiceFeatures this_arg_conv;
37260 this_arg_conv.inner = (void*)(this_arg & (~1));
37261 this_arg_conv.is_owned = false;
37262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37263 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
37266 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint32_t this_arg) {
37267 LDKInvoiceFeatures this_arg_conv;
37268 this_arg_conv.inner = (void*)(this_arg & (~1));
37269 this_arg_conv.is_owned = false;
37270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37271 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
37275 jboolean __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint32_t this_arg) {
37276 LDKInitFeatures this_arg_conv;
37277 this_arg_conv.inner = (void*)(this_arg & (~1));
37278 this_arg_conv.is_owned = false;
37279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37280 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
37284 jboolean __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint32_t this_arg) {
37285 LDKNodeFeatures this_arg_conv;
37286 this_arg_conv.inner = (void*)(this_arg & (~1));
37287 this_arg_conv.is_owned = false;
37288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37289 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
37293 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint32_t this_arg) {
37294 LDKInvoiceFeatures this_arg_conv;
37295 this_arg_conv.inner = (void*)(this_arg & (~1));
37296 this_arg_conv.is_owned = false;
37297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37298 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
37302 void __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint32_t this_arg) {
37303 LDKInitFeatures this_arg_conv;
37304 this_arg_conv.inner = (void*)(this_arg & (~1));
37305 this_arg_conv.is_owned = false;
37306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37307 InitFeatures_set_wumbo_optional(&this_arg_conv);
37310 void __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint32_t this_arg) {
37311 LDKInitFeatures this_arg_conv;
37312 this_arg_conv.inner = (void*)(this_arg & (~1));
37313 this_arg_conv.is_owned = false;
37314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37315 InitFeatures_set_wumbo_required(&this_arg_conv);
37318 jboolean __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint32_t this_arg) {
37319 LDKInitFeatures this_arg_conv;
37320 this_arg_conv.inner = (void*)(this_arg & (~1));
37321 this_arg_conv.is_owned = false;
37322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37323 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
37327 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint32_t this_arg) {
37328 LDKNodeFeatures this_arg_conv;
37329 this_arg_conv.inner = (void*)(this_arg & (~1));
37330 this_arg_conv.is_owned = false;
37331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37332 NodeFeatures_set_wumbo_optional(&this_arg_conv);
37335 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint32_t this_arg) {
37336 LDKNodeFeatures this_arg_conv;
37337 this_arg_conv.inner = (void*)(this_arg & (~1));
37338 this_arg_conv.is_owned = false;
37339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37340 NodeFeatures_set_wumbo_required(&this_arg_conv);
37343 jboolean __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint32_t this_arg) {
37344 LDKNodeFeatures this_arg_conv;
37345 this_arg_conv.inner = (void*)(this_arg & (~1));
37346 this_arg_conv.is_owned = false;
37347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37348 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
37352 jboolean __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint32_t this_arg) {
37353 LDKInitFeatures this_arg_conv;
37354 this_arg_conv.inner = (void*)(this_arg & (~1));
37355 this_arg_conv.is_owned = false;
37356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37357 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
37361 jboolean __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint32_t this_arg) {
37362 LDKNodeFeatures this_arg_conv;
37363 this_arg_conv.inner = (void*)(this_arg & (~1));
37364 this_arg_conv.is_owned = false;
37365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37366 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
37370 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37371 LDKInitFeatures this_arg_conv;
37372 this_arg_conv.inner = (void*)(this_arg & (~1));
37373 this_arg_conv.is_owned = false;
37374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37375 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37378 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37379 LDKInitFeatures this_arg_conv;
37380 this_arg_conv.inner = (void*)(this_arg & (~1));
37381 this_arg_conv.is_owned = false;
37382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37383 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37386 jboolean __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37387 LDKInitFeatures this_arg_conv;
37388 this_arg_conv.inner = (void*)(this_arg & (~1));
37389 this_arg_conv.is_owned = false;
37390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37391 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37395 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37396 LDKNodeFeatures this_arg_conv;
37397 this_arg_conv.inner = (void*)(this_arg & (~1));
37398 this_arg_conv.is_owned = false;
37399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37400 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37403 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37404 LDKNodeFeatures this_arg_conv;
37405 this_arg_conv.inner = (void*)(this_arg & (~1));
37406 this_arg_conv.is_owned = false;
37407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37408 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37411 jboolean __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37412 LDKNodeFeatures this_arg_conv;
37413 this_arg_conv.inner = (void*)(this_arg & (~1));
37414 this_arg_conv.is_owned = false;
37415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37416 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37420 jboolean __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37421 LDKInitFeatures this_arg_conv;
37422 this_arg_conv.inner = (void*)(this_arg & (~1));
37423 this_arg_conv.is_owned = false;
37424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37425 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37429 jboolean __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37430 LDKNodeFeatures this_arg_conv;
37431 this_arg_conv.inner = (void*)(this_arg & (~1));
37432 this_arg_conv.is_owned = false;
37433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37434 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37438 void __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint32_t this_arg) {
37439 LDKInitFeatures this_arg_conv;
37440 this_arg_conv.inner = (void*)(this_arg & (~1));
37441 this_arg_conv.is_owned = false;
37442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37443 InitFeatures_set_channel_type_optional(&this_arg_conv);
37446 void __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint32_t this_arg) {
37447 LDKInitFeatures this_arg_conv;
37448 this_arg_conv.inner = (void*)(this_arg & (~1));
37449 this_arg_conv.is_owned = false;
37450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37451 InitFeatures_set_channel_type_required(&this_arg_conv);
37454 jboolean __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint32_t this_arg) {
37455 LDKInitFeatures this_arg_conv;
37456 this_arg_conv.inner = (void*)(this_arg & (~1));
37457 this_arg_conv.is_owned = false;
37458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37459 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
37463 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint32_t this_arg) {
37464 LDKNodeFeatures this_arg_conv;
37465 this_arg_conv.inner = (void*)(this_arg & (~1));
37466 this_arg_conv.is_owned = false;
37467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37468 NodeFeatures_set_channel_type_optional(&this_arg_conv);
37471 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint32_t this_arg) {
37472 LDKNodeFeatures this_arg_conv;
37473 this_arg_conv.inner = (void*)(this_arg & (~1));
37474 this_arg_conv.is_owned = false;
37475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37476 NodeFeatures_set_channel_type_required(&this_arg_conv);
37479 jboolean __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint32_t this_arg) {
37480 LDKNodeFeatures this_arg_conv;
37481 this_arg_conv.inner = (void*)(this_arg & (~1));
37482 this_arg_conv.is_owned = false;
37483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37484 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
37488 jboolean __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint32_t this_arg) {
37489 LDKInitFeatures this_arg_conv;
37490 this_arg_conv.inner = (void*)(this_arg & (~1));
37491 this_arg_conv.is_owned = false;
37492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37493 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
37497 jboolean __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint32_t this_arg) {
37498 LDKNodeFeatures this_arg_conv;
37499 this_arg_conv.inner = (void*)(this_arg & (~1));
37500 this_arg_conv.is_owned = false;
37501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37502 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
37506 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37507 LDKInitFeatures this_arg_conv;
37508 this_arg_conv.inner = (void*)(this_arg & (~1));
37509 this_arg_conv.is_owned = false;
37510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37511 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
37514 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint32_t this_arg) {
37515 LDKInitFeatures this_arg_conv;
37516 this_arg_conv.inner = (void*)(this_arg & (~1));
37517 this_arg_conv.is_owned = false;
37518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37519 InitFeatures_set_scid_privacy_required(&this_arg_conv);
37522 jboolean __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint32_t this_arg) {
37523 LDKInitFeatures this_arg_conv;
37524 this_arg_conv.inner = (void*)(this_arg & (~1));
37525 this_arg_conv.is_owned = false;
37526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37527 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
37531 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37532 LDKNodeFeatures this_arg_conv;
37533 this_arg_conv.inner = (void*)(this_arg & (~1));
37534 this_arg_conv.is_owned = false;
37535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37536 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
37539 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37540 LDKNodeFeatures this_arg_conv;
37541 this_arg_conv.inner = (void*)(this_arg & (~1));
37542 this_arg_conv.is_owned = false;
37543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37544 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
37547 jboolean __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint32_t this_arg) {
37548 LDKNodeFeatures this_arg_conv;
37549 this_arg_conv.inner = (void*)(this_arg & (~1));
37550 this_arg_conv.is_owned = false;
37551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37552 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
37556 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37557 LDKChannelTypeFeatures this_arg_conv;
37558 this_arg_conv.inner = (void*)(this_arg & (~1));
37559 this_arg_conv.is_owned = false;
37560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37561 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
37564 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37565 LDKChannelTypeFeatures this_arg_conv;
37566 this_arg_conv.inner = (void*)(this_arg & (~1));
37567 this_arg_conv.is_owned = false;
37568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37569 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
37572 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint32_t this_arg) {
37573 LDKChannelTypeFeatures this_arg_conv;
37574 this_arg_conv.inner = (void*)(this_arg & (~1));
37575 this_arg_conv.is_owned = false;
37576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37577 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
37581 jboolean __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint32_t this_arg) {
37582 LDKInitFeatures this_arg_conv;
37583 this_arg_conv.inner = (void*)(this_arg & (~1));
37584 this_arg_conv.is_owned = false;
37585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37586 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
37590 jboolean __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint32_t this_arg) {
37591 LDKNodeFeatures this_arg_conv;
37592 this_arg_conv.inner = (void*)(this_arg & (~1));
37593 this_arg_conv.is_owned = false;
37594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37595 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
37599 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint32_t this_arg) {
37600 LDKChannelTypeFeatures this_arg_conv;
37601 this_arg_conv.inner = (void*)(this_arg & (~1));
37602 this_arg_conv.is_owned = false;
37603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37604 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
37608 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint32_t this_arg) {
37609 LDKInitFeatures this_arg_conv;
37610 this_arg_conv.inner = (void*)(this_arg & (~1));
37611 this_arg_conv.is_owned = false;
37612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37613 InitFeatures_set_zero_conf_optional(&this_arg_conv);
37616 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint32_t this_arg) {
37617 LDKInitFeatures this_arg_conv;
37618 this_arg_conv.inner = (void*)(this_arg & (~1));
37619 this_arg_conv.is_owned = false;
37620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37621 InitFeatures_set_zero_conf_required(&this_arg_conv);
37624 jboolean __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint32_t this_arg) {
37625 LDKInitFeatures this_arg_conv;
37626 this_arg_conv.inner = (void*)(this_arg & (~1));
37627 this_arg_conv.is_owned = false;
37628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37629 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
37633 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37634 LDKNodeFeatures this_arg_conv;
37635 this_arg_conv.inner = (void*)(this_arg & (~1));
37636 this_arg_conv.is_owned = false;
37637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37638 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
37641 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint32_t this_arg) {
37642 LDKNodeFeatures this_arg_conv;
37643 this_arg_conv.inner = (void*)(this_arg & (~1));
37644 this_arg_conv.is_owned = false;
37645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37646 NodeFeatures_set_zero_conf_required(&this_arg_conv);
37649 jboolean __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint32_t this_arg) {
37650 LDKNodeFeatures this_arg_conv;
37651 this_arg_conv.inner = (void*)(this_arg & (~1));
37652 this_arg_conv.is_owned = false;
37653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37654 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
37658 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37659 LDKChannelTypeFeatures this_arg_conv;
37660 this_arg_conv.inner = (void*)(this_arg & (~1));
37661 this_arg_conv.is_owned = false;
37662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37663 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
37666 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint32_t this_arg) {
37667 LDKChannelTypeFeatures this_arg_conv;
37668 this_arg_conv.inner = (void*)(this_arg & (~1));
37669 this_arg_conv.is_owned = false;
37670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37671 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
37674 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint32_t this_arg) {
37675 LDKChannelTypeFeatures this_arg_conv;
37676 this_arg_conv.inner = (void*)(this_arg & (~1));
37677 this_arg_conv.is_owned = false;
37678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37679 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
37683 jboolean __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint32_t this_arg) {
37684 LDKInitFeatures this_arg_conv;
37685 this_arg_conv.inner = (void*)(this_arg & (~1));
37686 this_arg_conv.is_owned = false;
37687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37688 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
37692 jboolean __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint32_t this_arg) {
37693 LDKNodeFeatures this_arg_conv;
37694 this_arg_conv.inner = (void*)(this_arg & (~1));
37695 this_arg_conv.is_owned = false;
37696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37697 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
37701 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint32_t this_arg) {
37702 LDKChannelTypeFeatures this_arg_conv;
37703 this_arg_conv.inner = (void*)(this_arg & (~1));
37704 this_arg_conv.is_owned = false;
37705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37706 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
37710 void __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint32_t this_arg) {
37711 LDKNodeFeatures this_arg_conv;
37712 this_arg_conv.inner = (void*)(this_arg & (~1));
37713 this_arg_conv.is_owned = false;
37714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37715 NodeFeatures_set_keysend_optional(&this_arg_conv);
37718 void __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint32_t this_arg) {
37719 LDKNodeFeatures this_arg_conv;
37720 this_arg_conv.inner = (void*)(this_arg & (~1));
37721 this_arg_conv.is_owned = false;
37722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37723 NodeFeatures_set_keysend_required(&this_arg_conv);
37726 jboolean __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint32_t this_arg) {
37727 LDKNodeFeatures this_arg_conv;
37728 this_arg_conv.inner = (void*)(this_arg & (~1));
37729 this_arg_conv.is_owned = false;
37730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37731 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
37735 jboolean __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint32_t this_arg) {
37736 LDKNodeFeatures this_arg_conv;
37737 this_arg_conv.inner = (void*)(this_arg & (~1));
37738 this_arg_conv.is_owned = false;
37739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37740 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
37744 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
37745 LDKShutdownScript this_obj_conv;
37746 this_obj_conv.inner = (void*)(this_obj & (~1));
37747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37749 ShutdownScript_free(this_obj_conv);
37752 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
37753 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
37754 uint32_t ret_ref = 0;
37755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37758 ret_ref = (uintptr_t)ret_var.inner;
37759 if (ret_var.is_owned) {
37764 uint32_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
37765 LDKShutdownScript arg_conv;
37766 arg_conv.inner = (void*)(arg & (~1));
37767 arg_conv.is_owned = false;
37768 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37769 uint32_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
37773 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
37774 LDKShutdownScript orig_conv;
37775 orig_conv.inner = (void*)(orig & (~1));
37776 orig_conv.is_owned = false;
37777 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37778 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
37779 uint32_t ret_ref = 0;
37780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37783 ret_ref = (uintptr_t)ret_var.inner;
37784 if (ret_var.is_owned) {
37790 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
37791 LDKInvalidShutdownScript this_obj_conv;
37792 this_obj_conv.inner = (void*)(this_obj & (~1));
37793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37795 InvalidShutdownScript_free(this_obj_conv);
37798 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
37799 LDKInvalidShutdownScript this_ptr_conv;
37800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37801 this_ptr_conv.is_owned = false;
37802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37803 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
37804 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37805 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37809 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
37810 LDKInvalidShutdownScript this_ptr_conv;
37811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37812 this_ptr_conv.is_owned = false;
37813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37814 LDKCVec_u8Z val_ref;
37815 val_ref.datalen = val->arr_len;
37816 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37817 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37818 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
37821 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
37822 LDKCVec_u8Z script_arg_ref;
37823 script_arg_ref.datalen = script_arg->arr_len;
37824 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37825 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37826 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
37827 uint32_t ret_ref = 0;
37828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37831 ret_ref = (uintptr_t)ret_var.inner;
37832 if (ret_var.is_owned) {
37838 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
37839 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
37840 uint32_t ret_ref = 0;
37841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37844 ret_ref = (uintptr_t)ret_var.inner;
37845 if (ret_var.is_owned) {
37850 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
37851 LDKInvalidShutdownScript arg_conv;
37852 arg_conv.inner = (void*)(arg & (~1));
37853 arg_conv.is_owned = false;
37854 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37855 uint32_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
37859 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
37860 LDKInvalidShutdownScript orig_conv;
37861 orig_conv.inner = (void*)(orig & (~1));
37862 orig_conv.is_owned = false;
37863 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37864 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
37865 uint32_t ret_ref = 0;
37866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37869 ret_ref = (uintptr_t)ret_var.inner;
37870 if (ret_var.is_owned) {
37876 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
37877 LDKShutdownScript obj_conv;
37878 obj_conv.inner = (void*)(obj & (~1));
37879 obj_conv.is_owned = false;
37880 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37881 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
37882 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37883 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37884 CVec_u8Z_free(ret_var);
37888 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
37889 LDKu8slice ser_ref;
37890 ser_ref.datalen = ser->arr_len;
37891 ser_ref.data = ser->elems;
37892 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37893 *ret_conv = ShutdownScript_read(ser_ref);
37895 return (uint32_t)ret_conv;
37898 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
37899 unsigned char pubkey_hash_arr[20];
37900 CHECK(pubkey_hash->arr_len == 20);
37901 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
37902 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
37903 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
37904 uint32_t ret_ref = 0;
37905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37908 ret_ref = (uintptr_t)ret_var.inner;
37909 if (ret_var.is_owned) {
37915 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
37916 unsigned char script_hash_arr[32];
37917 CHECK(script_hash->arr_len == 32);
37918 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
37919 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
37920 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
37921 uint32_t ret_ref = 0;
37922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37925 ret_ref = (uintptr_t)ret_var.inner;
37926 if (ret_var.is_owned) {
37932 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
37934 LDKu8slice program_ref;
37935 program_ref.datalen = program->arr_len;
37936 program_ref.data = program->elems;
37937 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37938 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
37940 return (uint32_t)ret_conv;
37943 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
37944 LDKShutdownScript this_arg_conv;
37945 this_arg_conv.inner = (void*)(this_arg & (~1));
37946 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
37947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37948 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
37949 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
37950 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37951 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37952 CVec_u8Z_free(ret_var);
37956 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
37957 LDKShutdownScript this_arg_conv;
37958 this_arg_conv.inner = (void*)(this_arg & (~1));
37959 this_arg_conv.is_owned = false;
37960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37961 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37962 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
37966 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
37967 LDKShutdownScript this_arg_conv;
37968 this_arg_conv.inner = (void*)(this_arg & (~1));
37969 this_arg_conv.is_owned = false;
37970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37971 LDKInitFeatures features_conv;
37972 features_conv.inner = (void*)(features & (~1));
37973 features_conv.is_owned = false;
37974 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
37975 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37979 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
37980 if ((this_ptr & 1) != 0) return;
37981 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37982 CHECK_ACCESS(this_ptr_ptr);
37983 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37984 FREE((void*)this_ptr);
37985 CustomMessageReader_free(this_ptr_conv);
37988 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37989 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37990 *ret_ret = Type_clone(arg);
37991 return (uint32_t)ret_ret;
37993 uint32_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
37994 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37995 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37996 LDKType* arg_conv = (LDKType*)arg_ptr;
37997 uint32_t ret_conv = Type_clone_ptr(arg_conv);
38001 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
38002 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
38003 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
38004 LDKType* orig_conv = (LDKType*)orig_ptr;
38005 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
38006 *ret_ret = Type_clone(orig_conv);
38007 return (uint32_t)ret_ret;
38010 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
38011 if ((this_ptr & 1) != 0) return;
38012 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38013 CHECK_ACCESS(this_ptr_ptr);
38014 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
38015 FREE((void*)this_ptr);
38016 Type_free(this_ptr_conv);
38019 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
38020 LDKNodeId this_obj_conv;
38021 this_obj_conv.inner = (void*)(this_obj & (~1));
38022 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38024 NodeId_free(this_obj_conv);
38027 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
38028 LDKNodeId ret_var = NodeId_clone(arg);
38029 uint32_t ret_ref = 0;
38030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38033 ret_ref = (uintptr_t)ret_var.inner;
38034 if (ret_var.is_owned) {
38039 uint32_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
38040 LDKNodeId arg_conv;
38041 arg_conv.inner = (void*)(arg & (~1));
38042 arg_conv.is_owned = false;
38043 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38044 uint32_t ret_conv = NodeId_clone_ptr(&arg_conv);
38048 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
38049 LDKNodeId orig_conv;
38050 orig_conv.inner = (void*)(orig & (~1));
38051 orig_conv.is_owned = false;
38052 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38053 LDKNodeId ret_var = NodeId_clone(&orig_conv);
38054 uint32_t ret_ref = 0;
38055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38058 ret_ref = (uintptr_t)ret_var.inner;
38059 if (ret_var.is_owned) {
38065 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
38066 LDKPublicKey pubkey_ref;
38067 CHECK(pubkey->arr_len == 33);
38068 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
38069 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
38070 uint32_t ret_ref = 0;
38071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38074 ret_ref = (uintptr_t)ret_var.inner;
38075 if (ret_var.is_owned) {
38081 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
38082 LDKNodeId this_arg_conv;
38083 this_arg_conv.inner = (void*)(this_arg & (~1));
38084 this_arg_conv.is_owned = false;
38085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38086 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
38087 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38088 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38092 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
38094 o_conv.inner = (void*)(o & (~1));
38095 o_conv.is_owned = false;
38096 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38097 int64_t ret_conv = NodeId_hash(&o_conv);
38101 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
38102 LDKNodeId obj_conv;
38103 obj_conv.inner = (void*)(obj & (~1));
38104 obj_conv.is_owned = false;
38105 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38106 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
38107 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38108 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38109 CVec_u8Z_free(ret_var);
38113 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
38114 LDKu8slice ser_ref;
38115 ser_ref.datalen = ser->arr_len;
38116 ser_ref.data = ser->elems;
38117 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
38118 *ret_conv = NodeId_read(ser_ref);
38120 return (uint32_t)ret_conv;
38123 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
38124 LDKNetworkGraph this_obj_conv;
38125 this_obj_conv.inner = (void*)(this_obj & (~1));
38126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38128 NetworkGraph_free(this_obj_conv);
38131 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
38132 LDKReadOnlyNetworkGraph this_obj_conv;
38133 this_obj_conv.inner = (void*)(this_obj & (~1));
38134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38136 ReadOnlyNetworkGraph_free(this_obj_conv);
38139 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
38140 if ((this_ptr & 1) != 0) return;
38141 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38142 CHECK_ACCESS(this_ptr_ptr);
38143 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
38144 FREE((void*)this_ptr);
38145 NetworkUpdate_free(this_ptr_conv);
38148 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
38149 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38150 *ret_copy = NetworkUpdate_clone(arg);
38151 uint32_t ret_ref = (uintptr_t)ret_copy;
38154 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
38155 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
38156 uint32_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
38160 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
38161 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
38162 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38163 *ret_copy = NetworkUpdate_clone(orig_conv);
38164 uint32_t ret_ref = (uintptr_t)ret_copy;
38168 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
38169 LDKChannelUpdate msg_conv;
38170 msg_conv.inner = (void*)(msg & (~1));
38171 msg_conv.is_owned = (msg & 1) || (msg == 0);
38172 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38173 msg_conv = ChannelUpdate_clone(&msg_conv);
38174 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38175 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
38176 uint32_t ret_ref = (uintptr_t)ret_copy;
38180 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
38181 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38182 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
38183 uint32_t ret_ref = (uintptr_t)ret_copy;
38187 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
38188 LDKPublicKey node_id_ref;
38189 CHECK(node_id->arr_len == 33);
38190 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38191 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38192 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
38193 uint32_t ret_ref = (uintptr_t)ret_copy;
38197 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
38198 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
38199 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
38200 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38201 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38202 CVec_u8Z_free(ret_var);
38206 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
38207 LDKu8slice ser_ref;
38208 ser_ref.datalen = ser->arr_len;
38209 ser_ref.data = ser->elems;
38210 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
38211 *ret_conv = NetworkUpdate_read(ser_ref);
38213 return (uint32_t)ret_conv;
38216 void __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint32_t this_obj) {
38217 LDKP2PGossipSync this_obj_conv;
38218 this_obj_conv.inner = (void*)(this_obj & (~1));
38219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38221 P2PGossipSync_free(this_obj_conv);
38224 uint32_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
38225 LDKNetworkGraph network_graph_conv;
38226 network_graph_conv.inner = (void*)(network_graph & (~1));
38227 network_graph_conv.is_owned = false;
38228 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
38229 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38230 CHECK_ACCESS(chain_access_ptr);
38231 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38232 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38233 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38234 // Manually implement clone for Java trait instances
38235 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38236 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38237 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38240 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38241 CHECK_ACCESS(logger_ptr);
38242 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38243 if (logger_conv.free == LDKLogger_JCalls_free) {
38244 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38245 LDKLogger_JCalls_cloned(&logger_conv);
38247 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
38248 uint32_t ret_ref = 0;
38249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38252 ret_ref = (uintptr_t)ret_var.inner;
38253 if (ret_var.is_owned) {
38259 void __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
38260 LDKP2PGossipSync this_arg_conv;
38261 this_arg_conv.inner = (void*)(this_arg & (~1));
38262 this_arg_conv.is_owned = false;
38263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38264 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38265 CHECK_ACCESS(chain_access_ptr);
38266 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38267 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38268 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38269 // Manually implement clone for Java trait instances
38270 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38271 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38272 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38275 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
38278 uint32_t __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint32_t this_arg) {
38279 LDKNetworkGraph this_arg_conv;
38280 this_arg_conv.inner = (void*)(this_arg & (~1));
38281 this_arg_conv.is_owned = false;
38282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38283 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
38284 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
38285 return (uint32_t)ret_ret;
38288 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint32_t this_arg) {
38289 LDKP2PGossipSync this_arg_conv;
38290 this_arg_conv.inner = (void*)(this_arg & (~1));
38291 this_arg_conv.is_owned = false;
38292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38293 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38294 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
38295 return (uint32_t)ret_ret;
38298 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint32_t this_arg) {
38299 LDKP2PGossipSync this_arg_conv;
38300 this_arg_conv.inner = (void*)(this_arg & (~1));
38301 this_arg_conv.is_owned = false;
38302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38303 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38304 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
38305 return (uint32_t)ret_ret;
38308 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
38309 LDKChannelUpdateInfo this_obj_conv;
38310 this_obj_conv.inner = (void*)(this_obj & (~1));
38311 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38313 ChannelUpdateInfo_free(this_obj_conv);
38316 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
38317 LDKChannelUpdateInfo this_ptr_conv;
38318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38319 this_ptr_conv.is_owned = false;
38320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38321 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
38325 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
38326 LDKChannelUpdateInfo this_ptr_conv;
38327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38328 this_ptr_conv.is_owned = false;
38329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38330 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
38333 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
38334 LDKChannelUpdateInfo this_ptr_conv;
38335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38336 this_ptr_conv.is_owned = false;
38337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38338 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
38342 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
38343 LDKChannelUpdateInfo this_ptr_conv;
38344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38345 this_ptr_conv.is_owned = false;
38346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38347 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
38350 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
38351 LDKChannelUpdateInfo this_ptr_conv;
38352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38353 this_ptr_conv.is_owned = false;
38354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38355 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
38359 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
38360 LDKChannelUpdateInfo this_ptr_conv;
38361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38362 this_ptr_conv.is_owned = false;
38363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38364 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38367 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
38368 LDKChannelUpdateInfo this_ptr_conv;
38369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38370 this_ptr_conv.is_owned = false;
38371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38372 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
38376 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
38377 LDKChannelUpdateInfo this_ptr_conv;
38378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38379 this_ptr_conv.is_owned = false;
38380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38381 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
38384 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
38385 LDKChannelUpdateInfo this_ptr_conv;
38386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38387 this_ptr_conv.is_owned = false;
38388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38389 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38390 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
38391 uint32_t ret_ref = (uintptr_t)ret_copy;
38395 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
38396 LDKChannelUpdateInfo this_ptr_conv;
38397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38398 this_ptr_conv.is_owned = false;
38399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38400 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38401 CHECK_ACCESS(val_ptr);
38402 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38403 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38404 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38407 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
38408 LDKChannelUpdateInfo this_ptr_conv;
38409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38410 this_ptr_conv.is_owned = false;
38411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38412 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
38413 uint32_t ret_ref = 0;
38414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38417 ret_ref = (uintptr_t)ret_var.inner;
38418 if (ret_var.is_owned) {
38424 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
38425 LDKChannelUpdateInfo this_ptr_conv;
38426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38427 this_ptr_conv.is_owned = false;
38428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38429 LDKRoutingFees val_conv;
38430 val_conv.inner = (void*)(val & (~1));
38431 val_conv.is_owned = (val & 1) || (val == 0);
38432 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38433 val_conv = RoutingFees_clone(&val_conv);
38434 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
38437 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
38438 LDKChannelUpdateInfo this_ptr_conv;
38439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38440 this_ptr_conv.is_owned = false;
38441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38442 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
38443 uint32_t ret_ref = 0;
38444 if ((uintptr_t)ret_var.inner > 4096) {
38445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38448 ret_ref = (uintptr_t)ret_var.inner;
38449 if (ret_var.is_owned) {
38456 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
38457 LDKChannelUpdateInfo this_ptr_conv;
38458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38459 this_ptr_conv.is_owned = false;
38460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38461 LDKChannelUpdate val_conv;
38462 val_conv.inner = (void*)(val & (~1));
38463 val_conv.is_owned = (val & 1) || (val == 0);
38464 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38465 val_conv = ChannelUpdate_clone(&val_conv);
38466 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
38469 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) {
38470 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
38471 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38472 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38473 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
38474 LDKRoutingFees fees_arg_conv;
38475 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38476 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38477 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38478 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38479 LDKChannelUpdate last_update_message_arg_conv;
38480 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
38481 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
38482 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
38483 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
38484 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);
38485 uint32_t ret_ref = 0;
38486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38489 ret_ref = (uintptr_t)ret_var.inner;
38490 if (ret_var.is_owned) {
38496 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
38497 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
38498 uint32_t ret_ref = 0;
38499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38502 ret_ref = (uintptr_t)ret_var.inner;
38503 if (ret_var.is_owned) {
38508 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
38509 LDKChannelUpdateInfo arg_conv;
38510 arg_conv.inner = (void*)(arg & (~1));
38511 arg_conv.is_owned = false;
38512 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38513 uint32_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
38517 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
38518 LDKChannelUpdateInfo orig_conv;
38519 orig_conv.inner = (void*)(orig & (~1));
38520 orig_conv.is_owned = false;
38521 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38522 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
38523 uint32_t ret_ref = 0;
38524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38527 ret_ref = (uintptr_t)ret_var.inner;
38528 if (ret_var.is_owned) {
38534 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
38535 LDKChannelUpdateInfo obj_conv;
38536 obj_conv.inner = (void*)(obj & (~1));
38537 obj_conv.is_owned = false;
38538 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38539 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
38540 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38541 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38542 CVec_u8Z_free(ret_var);
38546 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
38547 LDKu8slice ser_ref;
38548 ser_ref.datalen = ser->arr_len;
38549 ser_ref.data = ser->elems;
38550 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
38551 *ret_conv = ChannelUpdateInfo_read(ser_ref);
38553 return (uint32_t)ret_conv;
38556 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
38557 LDKChannelInfo this_obj_conv;
38558 this_obj_conv.inner = (void*)(this_obj & (~1));
38559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38561 ChannelInfo_free(this_obj_conv);
38564 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
38565 LDKChannelInfo this_ptr_conv;
38566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38567 this_ptr_conv.is_owned = false;
38568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38569 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
38570 uint32_t ret_ref = 0;
38571 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38572 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38574 ret_ref = (uintptr_t)ret_var.inner;
38575 if (ret_var.is_owned) {
38581 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
38582 LDKChannelInfo this_ptr_conv;
38583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38584 this_ptr_conv.is_owned = false;
38585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38586 LDKChannelFeatures val_conv;
38587 val_conv.inner = (void*)(val & (~1));
38588 val_conv.is_owned = (val & 1) || (val == 0);
38589 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38590 val_conv = ChannelFeatures_clone(&val_conv);
38591 ChannelInfo_set_features(&this_ptr_conv, val_conv);
38594 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
38595 LDKChannelInfo this_ptr_conv;
38596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38597 this_ptr_conv.is_owned = false;
38598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38599 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
38600 uint32_t ret_ref = 0;
38601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38604 ret_ref = (uintptr_t)ret_var.inner;
38605 if (ret_var.is_owned) {
38611 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
38612 LDKChannelInfo this_ptr_conv;
38613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38614 this_ptr_conv.is_owned = false;
38615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38616 LDKNodeId val_conv;
38617 val_conv.inner = (void*)(val & (~1));
38618 val_conv.is_owned = (val & 1) || (val == 0);
38619 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38620 val_conv = NodeId_clone(&val_conv);
38621 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
38624 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
38625 LDKChannelInfo this_ptr_conv;
38626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38627 this_ptr_conv.is_owned = false;
38628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38629 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
38630 uint32_t ret_ref = 0;
38631 if ((uintptr_t)ret_var.inner > 4096) {
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) {
38643 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
38644 LDKChannelInfo this_ptr_conv;
38645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38646 this_ptr_conv.is_owned = false;
38647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38648 LDKChannelUpdateInfo val_conv;
38649 val_conv.inner = (void*)(val & (~1));
38650 val_conv.is_owned = (val & 1) || (val == 0);
38651 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38652 val_conv = ChannelUpdateInfo_clone(&val_conv);
38653 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
38656 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
38657 LDKChannelInfo this_ptr_conv;
38658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38659 this_ptr_conv.is_owned = false;
38660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38661 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
38662 uint32_t ret_ref = 0;
38663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38666 ret_ref = (uintptr_t)ret_var.inner;
38667 if (ret_var.is_owned) {
38673 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
38674 LDKChannelInfo this_ptr_conv;
38675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38676 this_ptr_conv.is_owned = false;
38677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38678 LDKNodeId val_conv;
38679 val_conv.inner = (void*)(val & (~1));
38680 val_conv.is_owned = (val & 1) || (val == 0);
38681 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38682 val_conv = NodeId_clone(&val_conv);
38683 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
38686 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
38687 LDKChannelInfo this_ptr_conv;
38688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38689 this_ptr_conv.is_owned = false;
38690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38691 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
38692 uint32_t ret_ref = 0;
38693 if ((uintptr_t)ret_var.inner > 4096) {
38694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38697 ret_ref = (uintptr_t)ret_var.inner;
38698 if (ret_var.is_owned) {
38705 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
38706 LDKChannelInfo this_ptr_conv;
38707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38708 this_ptr_conv.is_owned = false;
38709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38710 LDKChannelUpdateInfo val_conv;
38711 val_conv.inner = (void*)(val & (~1));
38712 val_conv.is_owned = (val & 1) || (val == 0);
38713 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38714 val_conv = ChannelUpdateInfo_clone(&val_conv);
38715 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
38718 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
38719 LDKChannelInfo this_ptr_conv;
38720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38721 this_ptr_conv.is_owned = false;
38722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38723 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38724 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
38725 uint32_t ret_ref = (uintptr_t)ret_copy;
38729 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
38730 LDKChannelInfo this_ptr_conv;
38731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38732 this_ptr_conv.is_owned = false;
38733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38734 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38735 CHECK_ACCESS(val_ptr);
38736 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38737 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38738 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
38741 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
38742 LDKChannelInfo this_ptr_conv;
38743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38744 this_ptr_conv.is_owned = false;
38745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38746 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
38747 uint32_t ret_ref = 0;
38748 if ((uintptr_t)ret_var.inner > 4096) {
38749 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38750 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38752 ret_ref = (uintptr_t)ret_var.inner;
38753 if (ret_var.is_owned) {
38760 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
38761 LDKChannelInfo this_ptr_conv;
38762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38763 this_ptr_conv.is_owned = false;
38764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38765 LDKChannelAnnouncement val_conv;
38766 val_conv.inner = (void*)(val & (~1));
38767 val_conv.is_owned = (val & 1) || (val == 0);
38768 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38769 val_conv = ChannelAnnouncement_clone(&val_conv);
38770 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
38773 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
38774 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
38775 uint32_t ret_ref = 0;
38776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38779 ret_ref = (uintptr_t)ret_var.inner;
38780 if (ret_var.is_owned) {
38785 uint32_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
38786 LDKChannelInfo arg_conv;
38787 arg_conv.inner = (void*)(arg & (~1));
38788 arg_conv.is_owned = false;
38789 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38790 uint32_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
38794 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
38795 LDKChannelInfo orig_conv;
38796 orig_conv.inner = (void*)(orig & (~1));
38797 orig_conv.is_owned = false;
38798 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38799 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
38800 uint32_t ret_ref = 0;
38801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38804 ret_ref = (uintptr_t)ret_var.inner;
38805 if (ret_var.is_owned) {
38811 uint32_t __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint32_t this_arg, int8_t channel_flags) {
38812 LDKChannelInfo this_arg_conv;
38813 this_arg_conv.inner = (void*)(this_arg & (~1));
38814 this_arg_conv.is_owned = false;
38815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38816 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
38817 uint32_t ret_ref = 0;
38818 if ((uintptr_t)ret_var.inner > 4096) {
38819 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38820 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38822 ret_ref = (uintptr_t)ret_var.inner;
38823 if (ret_var.is_owned) {
38830 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
38831 LDKChannelInfo obj_conv;
38832 obj_conv.inner = (void*)(obj & (~1));
38833 obj_conv.is_owned = false;
38834 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38835 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
38836 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38837 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38838 CVec_u8Z_free(ret_var);
38842 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
38843 LDKu8slice ser_ref;
38844 ser_ref.datalen = ser->arr_len;
38845 ser_ref.data = ser->elems;
38846 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
38847 *ret_conv = ChannelInfo_read(ser_ref);
38849 return (uint32_t)ret_conv;
38852 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
38853 LDKDirectedChannelInfo this_obj_conv;
38854 this_obj_conv.inner = (void*)(this_obj & (~1));
38855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38857 DirectedChannelInfo_free(this_obj_conv);
38860 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
38861 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
38862 uint32_t ret_ref = 0;
38863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38866 ret_ref = (uintptr_t)ret_var.inner;
38867 if (ret_var.is_owned) {
38872 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
38873 LDKDirectedChannelInfo arg_conv;
38874 arg_conv.inner = (void*)(arg & (~1));
38875 arg_conv.is_owned = false;
38876 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38877 uint32_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
38881 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
38882 LDKDirectedChannelInfo orig_conv;
38883 orig_conv.inner = (void*)(orig & (~1));
38884 orig_conv.is_owned = false;
38885 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38886 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
38887 uint32_t ret_ref = 0;
38888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38891 ret_ref = (uintptr_t)ret_var.inner;
38892 if (ret_var.is_owned) {
38898 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
38899 LDKDirectedChannelInfo this_arg_conv;
38900 this_arg_conv.inner = (void*)(this_arg & (~1));
38901 this_arg_conv.is_owned = false;
38902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38903 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
38904 uint32_t ret_ref = 0;
38905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38908 ret_ref = (uintptr_t)ret_var.inner;
38909 if (ret_var.is_owned) {
38915 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
38916 LDKDirectedChannelInfo this_arg_conv;
38917 this_arg_conv.inner = (void*)(this_arg & (~1));
38918 this_arg_conv.is_owned = false;
38919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38920 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
38921 uint32_t ret_ref = 0;
38922 if ((uintptr_t)ret_var.inner > 4096) {
38923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38926 ret_ref = (uintptr_t)ret_var.inner;
38927 if (ret_var.is_owned) {
38934 int64_t __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint32_t this_arg) {
38935 LDKDirectedChannelInfo this_arg_conv;
38936 this_arg_conv.inner = (void*)(this_arg & (~1));
38937 this_arg_conv.is_owned = false;
38938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38939 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
38943 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
38944 LDKDirectedChannelInfo this_arg_conv;
38945 this_arg_conv.inner = (void*)(this_arg & (~1));
38946 this_arg_conv.is_owned = false;
38947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38948 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38949 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
38950 uint32_t ret_ref = (uintptr_t)ret_copy;
38954 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
38955 if ((this_ptr & 1) != 0) return;
38956 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38957 CHECK_ACCESS(this_ptr_ptr);
38958 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
38959 FREE((void*)this_ptr);
38960 EffectiveCapacity_free(this_ptr_conv);
38963 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
38964 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38965 *ret_copy = EffectiveCapacity_clone(arg);
38966 uint32_t ret_ref = (uintptr_t)ret_copy;
38969 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
38970 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
38971 uint32_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
38975 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
38976 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
38977 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38978 *ret_copy = EffectiveCapacity_clone(orig_conv);
38979 uint32_t ret_ref = (uintptr_t)ret_copy;
38983 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
38984 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38985 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
38986 uint32_t ret_ref = (uintptr_t)ret_copy;
38990 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
38991 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38992 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
38993 uint32_t ret_ref = (uintptr_t)ret_copy;
38997 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat) {
38998 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38999 *ret_copy = EffectiveCapacity_total(capacity_msat);
39000 uint32_t ret_ref = (uintptr_t)ret_copy;
39004 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
39005 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39006 *ret_copy = EffectiveCapacity_infinite();
39007 uint32_t ret_ref = (uintptr_t)ret_copy;
39011 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
39012 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39013 *ret_copy = EffectiveCapacity_unknown();
39014 uint32_t ret_ref = (uintptr_t)ret_copy;
39018 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
39019 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
39020 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
39024 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
39025 LDKRoutingFees this_obj_conv;
39026 this_obj_conv.inner = (void*)(this_obj & (~1));
39027 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39029 RoutingFees_free(this_obj_conv);
39032 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
39033 LDKRoutingFees this_ptr_conv;
39034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39035 this_ptr_conv.is_owned = false;
39036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39037 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
39041 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
39042 LDKRoutingFees this_ptr_conv;
39043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39044 this_ptr_conv.is_owned = false;
39045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39046 RoutingFees_set_base_msat(&this_ptr_conv, val);
39049 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
39050 LDKRoutingFees this_ptr_conv;
39051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39052 this_ptr_conv.is_owned = false;
39053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39054 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
39058 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
39059 LDKRoutingFees this_ptr_conv;
39060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39061 this_ptr_conv.is_owned = false;
39062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39063 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
39066 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
39067 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
39068 uint32_t ret_ref = 0;
39069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39072 ret_ref = (uintptr_t)ret_var.inner;
39073 if (ret_var.is_owned) {
39079 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
39080 LDKRoutingFees a_conv;
39081 a_conv.inner = (void*)(a & (~1));
39082 a_conv.is_owned = false;
39083 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39084 LDKRoutingFees b_conv;
39085 b_conv.inner = (void*)(b & (~1));
39086 b_conv.is_owned = false;
39087 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39088 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
39092 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
39093 LDKRoutingFees ret_var = RoutingFees_clone(arg);
39094 uint32_t ret_ref = 0;
39095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39098 ret_ref = (uintptr_t)ret_var.inner;
39099 if (ret_var.is_owned) {
39104 uint32_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
39105 LDKRoutingFees arg_conv;
39106 arg_conv.inner = (void*)(arg & (~1));
39107 arg_conv.is_owned = false;
39108 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39109 uint32_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
39113 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
39114 LDKRoutingFees orig_conv;
39115 orig_conv.inner = (void*)(orig & (~1));
39116 orig_conv.is_owned = false;
39117 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39118 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
39119 uint32_t ret_ref = 0;
39120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39123 ret_ref = (uintptr_t)ret_var.inner;
39124 if (ret_var.is_owned) {
39130 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
39131 LDKRoutingFees o_conv;
39132 o_conv.inner = (void*)(o & (~1));
39133 o_conv.is_owned = false;
39134 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39135 int64_t ret_conv = RoutingFees_hash(&o_conv);
39139 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
39140 LDKRoutingFees obj_conv;
39141 obj_conv.inner = (void*)(obj & (~1));
39142 obj_conv.is_owned = false;
39143 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39144 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
39145 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39146 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39147 CVec_u8Z_free(ret_var);
39151 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
39152 LDKu8slice ser_ref;
39153 ser_ref.datalen = ser->arr_len;
39154 ser_ref.data = ser->elems;
39155 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
39156 *ret_conv = RoutingFees_read(ser_ref);
39158 return (uint32_t)ret_conv;
39161 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
39162 LDKNodeAnnouncementInfo this_obj_conv;
39163 this_obj_conv.inner = (void*)(this_obj & (~1));
39164 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39166 NodeAnnouncementInfo_free(this_obj_conv);
39169 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
39170 LDKNodeAnnouncementInfo this_ptr_conv;
39171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39172 this_ptr_conv.is_owned = false;
39173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39174 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
39175 uint32_t ret_ref = 0;
39176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39179 ret_ref = (uintptr_t)ret_var.inner;
39180 if (ret_var.is_owned) {
39186 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
39187 LDKNodeAnnouncementInfo this_ptr_conv;
39188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39189 this_ptr_conv.is_owned = false;
39190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39191 LDKNodeFeatures val_conv;
39192 val_conv.inner = (void*)(val & (~1));
39193 val_conv.is_owned = (val & 1) || (val == 0);
39194 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39195 val_conv = NodeFeatures_clone(&val_conv);
39196 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
39199 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
39200 LDKNodeAnnouncementInfo this_ptr_conv;
39201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39202 this_ptr_conv.is_owned = false;
39203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39204 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
39208 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
39209 LDKNodeAnnouncementInfo this_ptr_conv;
39210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39211 this_ptr_conv.is_owned = false;
39212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39213 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
39216 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
39217 LDKNodeAnnouncementInfo this_ptr_conv;
39218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39219 this_ptr_conv.is_owned = false;
39220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39221 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
39222 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
39226 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
39227 LDKNodeAnnouncementInfo this_ptr_conv;
39228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39229 this_ptr_conv.is_owned = false;
39230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39231 LDKThreeBytes val_ref;
39232 CHECK(val->arr_len == 3);
39233 memcpy(val_ref.data, val->elems, 3); FREE(val);
39234 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
39237 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
39238 LDKNodeAnnouncementInfo this_ptr_conv;
39239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39240 this_ptr_conv.is_owned = false;
39241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39242 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39243 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
39247 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
39248 LDKNodeAnnouncementInfo this_ptr_conv;
39249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39250 this_ptr_conv.is_owned = false;
39251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39252 LDKThirtyTwoBytes val_ref;
39253 CHECK(val->arr_len == 32);
39254 memcpy(val_ref.data, val->elems, 32); FREE(val);
39255 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
39258 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
39259 LDKNodeAnnouncementInfo this_ptr_conv;
39260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39261 this_ptr_conv.is_owned = false;
39262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39263 LDKCVec_NetAddressZ val_constr;
39264 val_constr.datalen = val->arr_len;
39265 if (val_constr.datalen > 0)
39266 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39268 val_constr.data = NULL;
39269 uint32_t* val_vals = val->elems;
39270 for (size_t m = 0; m < val_constr.datalen; m++) {
39271 uint32_t val_conv_12 = val_vals[m];
39272 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
39273 CHECK_ACCESS(val_conv_12_ptr);
39274 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
39275 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
39276 val_constr.data[m] = val_conv_12_conv;
39279 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
39282 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
39283 LDKNodeAnnouncementInfo this_ptr_conv;
39284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39285 this_ptr_conv.is_owned = false;
39286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39287 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
39288 uint32_t ret_ref = 0;
39289 if ((uintptr_t)ret_var.inner > 4096) {
39290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39293 ret_ref = (uintptr_t)ret_var.inner;
39294 if (ret_var.is_owned) {
39301 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
39302 LDKNodeAnnouncementInfo this_ptr_conv;
39303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39304 this_ptr_conv.is_owned = false;
39305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39306 LDKNodeAnnouncement val_conv;
39307 val_conv.inner = (void*)(val & (~1));
39308 val_conv.is_owned = (val & 1) || (val == 0);
39309 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39310 val_conv = NodeAnnouncement_clone(&val_conv);
39311 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
39314 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) {
39315 LDKNodeFeatures features_arg_conv;
39316 features_arg_conv.inner = (void*)(features_arg & (~1));
39317 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
39318 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39319 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
39320 LDKThreeBytes rgb_arg_ref;
39321 CHECK(rgb_arg->arr_len == 3);
39322 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
39323 LDKThirtyTwoBytes alias_arg_ref;
39324 CHECK(alias_arg->arr_len == 32);
39325 memcpy(alias_arg_ref.data, alias_arg->elems, 32); FREE(alias_arg);
39326 LDKCVec_NetAddressZ addresses_arg_constr;
39327 addresses_arg_constr.datalen = addresses_arg->arr_len;
39328 if (addresses_arg_constr.datalen > 0)
39329 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39331 addresses_arg_constr.data = NULL;
39332 uint32_t* addresses_arg_vals = addresses_arg->elems;
39333 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
39334 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
39335 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
39336 CHECK_ACCESS(addresses_arg_conv_12_ptr);
39337 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
39338 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
39340 FREE(addresses_arg);
39341 LDKNodeAnnouncement announcement_message_arg_conv;
39342 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
39343 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
39344 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
39345 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
39346 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
39347 uint32_t ret_ref = 0;
39348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39351 ret_ref = (uintptr_t)ret_var.inner;
39352 if (ret_var.is_owned) {
39358 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
39359 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
39360 uint32_t ret_ref = 0;
39361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39364 ret_ref = (uintptr_t)ret_var.inner;
39365 if (ret_var.is_owned) {
39370 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
39371 LDKNodeAnnouncementInfo arg_conv;
39372 arg_conv.inner = (void*)(arg & (~1));
39373 arg_conv.is_owned = false;
39374 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39375 uint32_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
39379 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
39380 LDKNodeAnnouncementInfo orig_conv;
39381 orig_conv.inner = (void*)(orig & (~1));
39382 orig_conv.is_owned = false;
39383 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39384 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
39385 uint32_t ret_ref = 0;
39386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39389 ret_ref = (uintptr_t)ret_var.inner;
39390 if (ret_var.is_owned) {
39396 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
39397 LDKNodeAnnouncementInfo obj_conv;
39398 obj_conv.inner = (void*)(obj & (~1));
39399 obj_conv.is_owned = false;
39400 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39401 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
39402 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39403 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39404 CVec_u8Z_free(ret_var);
39408 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
39409 LDKu8slice ser_ref;
39410 ser_ref.datalen = ser->arr_len;
39411 ser_ref.data = ser->elems;
39412 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
39413 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
39415 return (uint32_t)ret_conv;
39418 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
39419 LDKNodeInfo this_obj_conv;
39420 this_obj_conv.inner = (void*)(this_obj & (~1));
39421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39423 NodeInfo_free(this_obj_conv);
39426 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
39427 LDKNodeInfo this_ptr_conv;
39428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39429 this_ptr_conv.is_owned = false;
39430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431 LDKCVec_u64Z val_constr;
39432 val_constr.datalen = val->arr_len;
39433 if (val_constr.datalen > 0)
39434 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39436 val_constr.data = NULL;
39437 int64_t* val_vals = val->elems;
39438 for (size_t i = 0; i < val_constr.datalen; i++) {
39439 int64_t val_conv_8 = val_vals[i];
39440 val_constr.data[i] = val_conv_8;
39443 NodeInfo_set_channels(&this_ptr_conv, val_constr);
39446 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
39447 LDKNodeInfo this_ptr_conv;
39448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39449 this_ptr_conv.is_owned = false;
39450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39451 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
39452 uint32_t ret_ref = 0;
39453 if ((uintptr_t)ret_var.inner > 4096) {
39454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39457 ret_ref = (uintptr_t)ret_var.inner;
39458 if (ret_var.is_owned) {
39465 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) {
39466 LDKNodeInfo this_ptr_conv;
39467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39468 this_ptr_conv.is_owned = false;
39469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39470 LDKRoutingFees val_conv;
39471 val_conv.inner = (void*)(val & (~1));
39472 val_conv.is_owned = (val & 1) || (val == 0);
39473 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39474 val_conv = RoutingFees_clone(&val_conv);
39475 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
39478 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
39479 LDKNodeInfo this_ptr_conv;
39480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39481 this_ptr_conv.is_owned = false;
39482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39483 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
39484 uint32_t ret_ref = 0;
39485 if ((uintptr_t)ret_var.inner > 4096) {
39486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39489 ret_ref = (uintptr_t)ret_var.inner;
39490 if (ret_var.is_owned) {
39497 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
39498 LDKNodeInfo this_ptr_conv;
39499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39500 this_ptr_conv.is_owned = false;
39501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39502 LDKNodeAnnouncementInfo val_conv;
39503 val_conv.inner = (void*)(val & (~1));
39504 val_conv.is_owned = (val & 1) || (val == 0);
39505 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39506 val_conv = NodeAnnouncementInfo_clone(&val_conv);
39507 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
39510 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) {
39511 LDKCVec_u64Z channels_arg_constr;
39512 channels_arg_constr.datalen = channels_arg->arr_len;
39513 if (channels_arg_constr.datalen > 0)
39514 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39516 channels_arg_constr.data = NULL;
39517 int64_t* channels_arg_vals = channels_arg->elems;
39518 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
39519 int64_t channels_arg_conv_8 = channels_arg_vals[i];
39520 channels_arg_constr.data[i] = channels_arg_conv_8;
39522 FREE(channels_arg);
39523 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
39524 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
39525 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
39526 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
39527 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
39528 LDKNodeAnnouncementInfo announcement_info_arg_conv;
39529 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
39530 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
39531 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
39532 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
39533 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
39534 uint32_t ret_ref = 0;
39535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39538 ret_ref = (uintptr_t)ret_var.inner;
39539 if (ret_var.is_owned) {
39545 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
39546 LDKNodeInfo ret_var = NodeInfo_clone(arg);
39547 uint32_t ret_ref = 0;
39548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39551 ret_ref = (uintptr_t)ret_var.inner;
39552 if (ret_var.is_owned) {
39557 uint32_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
39558 LDKNodeInfo arg_conv;
39559 arg_conv.inner = (void*)(arg & (~1));
39560 arg_conv.is_owned = false;
39561 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39562 uint32_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
39566 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
39567 LDKNodeInfo orig_conv;
39568 orig_conv.inner = (void*)(orig & (~1));
39569 orig_conv.is_owned = false;
39570 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39571 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
39572 uint32_t ret_ref = 0;
39573 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39574 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39576 ret_ref = (uintptr_t)ret_var.inner;
39577 if (ret_var.is_owned) {
39583 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
39584 LDKNodeInfo obj_conv;
39585 obj_conv.inner = (void*)(obj & (~1));
39586 obj_conv.is_owned = false;
39587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39588 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
39589 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39590 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39591 CVec_u8Z_free(ret_var);
39595 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
39596 LDKu8slice ser_ref;
39597 ser_ref.datalen = ser->arr_len;
39598 ser_ref.data = ser->elems;
39599 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
39600 *ret_conv = NodeInfo_read(ser_ref);
39602 return (uint32_t)ret_conv;
39605 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
39606 LDKNetworkGraph obj_conv;
39607 obj_conv.inner = (void*)(obj & (~1));
39608 obj_conv.is_owned = false;
39609 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39610 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
39611 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39612 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39613 CVec_u8Z_free(ret_var);
39617 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint32_t arg) {
39618 LDKu8slice ser_ref;
39619 ser_ref.datalen = ser->arr_len;
39620 ser_ref.data = ser->elems;
39621 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39622 CHECK_ACCESS(arg_ptr);
39623 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
39624 if (arg_conv.free == LDKLogger_JCalls_free) {
39625 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39626 LDKLogger_JCalls_cloned(&arg_conv);
39628 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
39629 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
39631 return (uint32_t)ret_conv;
39634 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint32_t logger) {
39635 LDKThirtyTwoBytes genesis_hash_ref;
39636 CHECK(genesis_hash->arr_len == 32);
39637 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
39638 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39639 CHECK_ACCESS(logger_ptr);
39640 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39641 if (logger_conv.free == LDKLogger_JCalls_free) {
39642 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39643 LDKLogger_JCalls_cloned(&logger_conv);
39645 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
39646 uint32_t ret_ref = 0;
39647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39650 ret_ref = (uintptr_t)ret_var.inner;
39651 if (ret_var.is_owned) {
39657 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
39658 LDKNetworkGraph this_arg_conv;
39659 this_arg_conv.inner = (void*)(this_arg & (~1));
39660 this_arg_conv.is_owned = false;
39661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39662 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
39663 uint32_t ret_ref = 0;
39664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39667 ret_ref = (uintptr_t)ret_var.inner;
39668 if (ret_var.is_owned) {
39674 uint32_t __attribute__((export_name("TS_NetworkGraph_get_last_rapid_gossip_sync_timestamp"))) TS_NetworkGraph_get_last_rapid_gossip_sync_timestamp(uint32_t this_arg) {
39675 LDKNetworkGraph this_arg_conv;
39676 this_arg_conv.inner = (void*)(this_arg & (~1));
39677 this_arg_conv.is_owned = false;
39678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39679 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39680 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
39681 uint32_t ret_ref = (uintptr_t)ret_copy;
39685 void __attribute__((export_name("TS_NetworkGraph_set_last_rapid_gossip_sync_timestamp"))) TS_NetworkGraph_set_last_rapid_gossip_sync_timestamp(uint32_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
39686 LDKNetworkGraph this_arg_conv;
39687 this_arg_conv.inner = (void*)(this_arg & (~1));
39688 this_arg_conv.is_owned = false;
39689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39690 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
39693 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
39694 LDKNetworkGraph this_arg_conv;
39695 this_arg_conv.inner = (void*)(this_arg & (~1));
39696 this_arg_conv.is_owned = false;
39697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39698 LDKNodeAnnouncement msg_conv;
39699 msg_conv.inner = (void*)(msg & (~1));
39700 msg_conv.is_owned = false;
39701 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39702 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39703 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
39704 return (uint32_t)ret_conv;
39707 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) {
39708 LDKNetworkGraph this_arg_conv;
39709 this_arg_conv.inner = (void*)(this_arg & (~1));
39710 this_arg_conv.is_owned = false;
39711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39712 LDKUnsignedNodeAnnouncement msg_conv;
39713 msg_conv.inner = (void*)(msg & (~1));
39714 msg_conv.is_owned = false;
39715 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39716 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39717 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
39718 return (uint32_t)ret_conv;
39721 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) {
39722 LDKNetworkGraph this_arg_conv;
39723 this_arg_conv.inner = (void*)(this_arg & (~1));
39724 this_arg_conv.is_owned = false;
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39726 LDKChannelAnnouncement msg_conv;
39727 msg_conv.inner = (void*)(msg & (~1));
39728 msg_conv.is_owned = false;
39729 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39730 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39731 CHECK_ACCESS(chain_access_ptr);
39732 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39733 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39734 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39735 // Manually implement clone for Java trait instances
39736 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39738 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39741 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39742 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39743 return (uint32_t)ret_conv;
39746 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) {
39747 LDKNetworkGraph this_arg_conv;
39748 this_arg_conv.inner = (void*)(this_arg & (~1));
39749 this_arg_conv.is_owned = false;
39750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39751 LDKUnsignedChannelAnnouncement msg_conv;
39752 msg_conv.inner = (void*)(msg & (~1));
39753 msg_conv.is_owned = false;
39754 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39755 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39756 CHECK_ACCESS(chain_access_ptr);
39757 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39758 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39759 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39760 // Manually implement clone for Java trait instances
39761 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39762 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39763 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39766 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39767 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39768 return (uint32_t)ret_conv;
39771 uint32_t __attribute__((export_name("TS_NetworkGraph_add_channel_from_partial_announcement"))) TS_NetworkGraph_add_channel_from_partial_announcement(uint32_t this_arg, int64_t short_channel_id, int64_t timestamp, uint32_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
39772 LDKNetworkGraph this_arg_conv;
39773 this_arg_conv.inner = (void*)(this_arg & (~1));
39774 this_arg_conv.is_owned = false;
39775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39776 LDKChannelFeatures features_conv;
39777 features_conv.inner = (void*)(features & (~1));
39778 features_conv.is_owned = (features & 1) || (features == 0);
39779 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39780 features_conv = ChannelFeatures_clone(&features_conv);
39781 LDKPublicKey node_id_1_ref;
39782 CHECK(node_id_1->arr_len == 33);
39783 memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
39784 LDKPublicKey node_id_2_ref;
39785 CHECK(node_id_2->arr_len == 33);
39786 memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
39787 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39788 *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
39789 return (uint32_t)ret_conv;
39792 void __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
39793 LDKNetworkGraph this_arg_conv;
39794 this_arg_conv.inner = (void*)(this_arg & (~1));
39795 this_arg_conv.is_owned = false;
39796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39797 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
39800 void __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
39801 LDKNetworkGraph this_arg_conv;
39802 this_arg_conv.inner = (void*)(this_arg & (~1));
39803 this_arg_conv.is_owned = false;
39804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39805 LDKPublicKey _node_id_ref;
39806 CHECK(_node_id->arr_len == 33);
39807 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
39808 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
39811 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) {
39812 LDKNetworkGraph this_arg_conv;
39813 this_arg_conv.inner = (void*)(this_arg & (~1));
39814 this_arg_conv.is_owned = false;
39815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39816 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
39819 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
39820 LDKNetworkGraph this_arg_conv;
39821 this_arg_conv.inner = (void*)(this_arg & (~1));
39822 this_arg_conv.is_owned = false;
39823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39824 LDKChannelUpdate msg_conv;
39825 msg_conv.inner = (void*)(msg & (~1));
39826 msg_conv.is_owned = false;
39827 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39828 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39829 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
39830 return (uint32_t)ret_conv;
39833 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
39834 LDKNetworkGraph this_arg_conv;
39835 this_arg_conv.inner = (void*)(this_arg & (~1));
39836 this_arg_conv.is_owned = false;
39837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39838 LDKUnsignedChannelUpdate msg_conv;
39839 msg_conv.inner = (void*)(msg & (~1));
39840 msg_conv.is_owned = false;
39841 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39842 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39843 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
39844 return (uint32_t)ret_conv;
39847 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
39848 LDKReadOnlyNetworkGraph this_arg_conv;
39849 this_arg_conv.inner = (void*)(this_arg & (~1));
39850 this_arg_conv.is_owned = false;
39851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39852 LDKPublicKey pubkey_ref;
39853 CHECK(pubkey->arr_len == 33);
39854 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39855 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
39856 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
39857 uint32_t ret_ref = (uintptr_t)ret_copy;
39861 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
39862 LDKRouteHop this_obj_conv;
39863 this_obj_conv.inner = (void*)(this_obj & (~1));
39864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39866 RouteHop_free(this_obj_conv);
39869 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
39870 LDKRouteHop this_ptr_conv;
39871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39872 this_ptr_conv.is_owned = false;
39873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39874 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39875 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
39879 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
39880 LDKRouteHop this_ptr_conv;
39881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39882 this_ptr_conv.is_owned = false;
39883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39884 LDKPublicKey val_ref;
39885 CHECK(val->arr_len == 33);
39886 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39887 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
39890 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
39891 LDKRouteHop this_ptr_conv;
39892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39893 this_ptr_conv.is_owned = false;
39894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39895 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
39896 uint32_t ret_ref = 0;
39897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39900 ret_ref = (uintptr_t)ret_var.inner;
39901 if (ret_var.is_owned) {
39907 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
39908 LDKRouteHop this_ptr_conv;
39909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39910 this_ptr_conv.is_owned = false;
39911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39912 LDKNodeFeatures val_conv;
39913 val_conv.inner = (void*)(val & (~1));
39914 val_conv.is_owned = (val & 1) || (val == 0);
39915 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39916 val_conv = NodeFeatures_clone(&val_conv);
39917 RouteHop_set_node_features(&this_ptr_conv, val_conv);
39920 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
39921 LDKRouteHop this_ptr_conv;
39922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39923 this_ptr_conv.is_owned = false;
39924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39925 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
39929 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
39930 LDKRouteHop this_ptr_conv;
39931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39932 this_ptr_conv.is_owned = false;
39933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39934 RouteHop_set_short_channel_id(&this_ptr_conv, val);
39937 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
39938 LDKRouteHop this_ptr_conv;
39939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39940 this_ptr_conv.is_owned = false;
39941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39942 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
39943 uint32_t ret_ref = 0;
39944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39947 ret_ref = (uintptr_t)ret_var.inner;
39948 if (ret_var.is_owned) {
39954 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
39955 LDKRouteHop this_ptr_conv;
39956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39957 this_ptr_conv.is_owned = false;
39958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39959 LDKChannelFeatures val_conv;
39960 val_conv.inner = (void*)(val & (~1));
39961 val_conv.is_owned = (val & 1) || (val == 0);
39962 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39963 val_conv = ChannelFeatures_clone(&val_conv);
39964 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
39967 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
39968 LDKRouteHop this_ptr_conv;
39969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39970 this_ptr_conv.is_owned = false;
39971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39972 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
39976 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
39977 LDKRouteHop this_ptr_conv;
39978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39979 this_ptr_conv.is_owned = false;
39980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39981 RouteHop_set_fee_msat(&this_ptr_conv, val);
39984 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
39985 LDKRouteHop this_ptr_conv;
39986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39987 this_ptr_conv.is_owned = false;
39988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39989 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
39993 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
39994 LDKRouteHop this_ptr_conv;
39995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39996 this_ptr_conv.is_owned = false;
39997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39998 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
40001 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) {
40002 LDKPublicKey pubkey_arg_ref;
40003 CHECK(pubkey_arg->arr_len == 33);
40004 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
40005 LDKNodeFeatures node_features_arg_conv;
40006 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
40007 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
40008 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
40009 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
40010 LDKChannelFeatures channel_features_arg_conv;
40011 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
40012 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
40013 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
40014 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
40015 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);
40016 uint32_t ret_ref = 0;
40017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40020 ret_ref = (uintptr_t)ret_var.inner;
40021 if (ret_var.is_owned) {
40027 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
40028 LDKRouteHop ret_var = RouteHop_clone(arg);
40029 uint32_t ret_ref = 0;
40030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40033 ret_ref = (uintptr_t)ret_var.inner;
40034 if (ret_var.is_owned) {
40039 uint32_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
40040 LDKRouteHop arg_conv;
40041 arg_conv.inner = (void*)(arg & (~1));
40042 arg_conv.is_owned = false;
40043 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40044 uint32_t ret_conv = RouteHop_clone_ptr(&arg_conv);
40048 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
40049 LDKRouteHop orig_conv;
40050 orig_conv.inner = (void*)(orig & (~1));
40051 orig_conv.is_owned = false;
40052 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40053 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
40054 uint32_t ret_ref = 0;
40055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40058 ret_ref = (uintptr_t)ret_var.inner;
40059 if (ret_var.is_owned) {
40065 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
40066 LDKRouteHop o_conv;
40067 o_conv.inner = (void*)(o & (~1));
40068 o_conv.is_owned = false;
40069 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40070 int64_t ret_conv = RouteHop_hash(&o_conv);
40074 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
40075 LDKRouteHop a_conv;
40076 a_conv.inner = (void*)(a & (~1));
40077 a_conv.is_owned = false;
40078 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40079 LDKRouteHop b_conv;
40080 b_conv.inner = (void*)(b & (~1));
40081 b_conv.is_owned = false;
40082 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40083 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
40087 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
40088 LDKRouteHop obj_conv;
40089 obj_conv.inner = (void*)(obj & (~1));
40090 obj_conv.is_owned = false;
40091 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40092 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
40093 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40094 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40095 CVec_u8Z_free(ret_var);
40099 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
40100 LDKu8slice ser_ref;
40101 ser_ref.datalen = ser->arr_len;
40102 ser_ref.data = ser->elems;
40103 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
40104 *ret_conv = RouteHop_read(ser_ref);
40106 return (uint32_t)ret_conv;
40109 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
40110 LDKRoute this_obj_conv;
40111 this_obj_conv.inner = (void*)(this_obj & (~1));
40112 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40114 Route_free(this_obj_conv);
40117 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
40118 LDKRoute this_ptr_conv;
40119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40120 this_ptr_conv.is_owned = false;
40121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40122 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
40123 ptrArray ret_arr = NULL;
40124 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
40125 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
40126 for (size_t m = 0; m < ret_var.datalen; m++) {
40127 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
40128 uint32_tArray ret_conv_12_arr = NULL;
40129 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
40130 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
40131 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
40132 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
40133 uint32_t ret_conv_12_conv_10_ref = 0;
40134 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40135 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
40137 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
40138 if (ret_conv_12_conv_10_var.is_owned) {
40139 ret_conv_12_conv_10_ref |= 1;
40141 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
40144 FREE(ret_conv_12_var.data);
40145 ret_arr_ptr[m] = ret_conv_12_arr;
40148 FREE(ret_var.data);
40152 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
40153 LDKRoute this_ptr_conv;
40154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40155 this_ptr_conv.is_owned = false;
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40157 LDKCVec_CVec_RouteHopZZ val_constr;
40158 val_constr.datalen = val->arr_len;
40159 if (val_constr.datalen > 0)
40160 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40162 val_constr.data = NULL;
40163 uint32_tArray* val_vals = (void*) val->elems;
40164 for (size_t m = 0; m < val_constr.datalen; m++) {
40165 uint32_tArray val_conv_12 = val_vals[m];
40166 LDKCVec_RouteHopZ val_conv_12_constr;
40167 val_conv_12_constr.datalen = val_conv_12->arr_len;
40168 if (val_conv_12_constr.datalen > 0)
40169 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40171 val_conv_12_constr.data = NULL;
40172 uint32_t* val_conv_12_vals = val_conv_12->elems;
40173 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
40174 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
40175 LDKRouteHop val_conv_12_conv_10_conv;
40176 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
40177 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
40178 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
40179 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
40180 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
40183 val_constr.data[m] = val_conv_12_constr;
40186 Route_set_paths(&this_ptr_conv, val_constr);
40189 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
40190 LDKRoute this_ptr_conv;
40191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40192 this_ptr_conv.is_owned = false;
40193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40194 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
40195 uint32_t ret_ref = 0;
40196 if ((uintptr_t)ret_var.inner > 4096) {
40197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40200 ret_ref = (uintptr_t)ret_var.inner;
40201 if (ret_var.is_owned) {
40208 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
40209 LDKRoute this_ptr_conv;
40210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40211 this_ptr_conv.is_owned = false;
40212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40213 LDKPaymentParameters val_conv;
40214 val_conv.inner = (void*)(val & (~1));
40215 val_conv.is_owned = (val & 1) || (val == 0);
40216 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40217 val_conv = PaymentParameters_clone(&val_conv);
40218 Route_set_payment_params(&this_ptr_conv, val_conv);
40221 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
40222 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
40223 paths_arg_constr.datalen = paths_arg->arr_len;
40224 if (paths_arg_constr.datalen > 0)
40225 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40227 paths_arg_constr.data = NULL;
40228 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
40229 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
40230 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
40231 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
40232 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
40233 if (paths_arg_conv_12_constr.datalen > 0)
40234 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40236 paths_arg_conv_12_constr.data = NULL;
40237 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
40238 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
40239 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
40240 LDKRouteHop paths_arg_conv_12_conv_10_conv;
40241 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
40242 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
40243 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
40244 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
40245 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
40247 FREE(paths_arg_conv_12);
40248 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
40251 LDKPaymentParameters payment_params_arg_conv;
40252 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40253 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40254 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40255 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40256 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
40257 uint32_t ret_ref = 0;
40258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40261 ret_ref = (uintptr_t)ret_var.inner;
40262 if (ret_var.is_owned) {
40268 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
40269 LDKRoute ret_var = Route_clone(arg);
40270 uint32_t ret_ref = 0;
40271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40274 ret_ref = (uintptr_t)ret_var.inner;
40275 if (ret_var.is_owned) {
40280 uint32_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
40282 arg_conv.inner = (void*)(arg & (~1));
40283 arg_conv.is_owned = false;
40284 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40285 uint32_t ret_conv = Route_clone_ptr(&arg_conv);
40289 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
40290 LDKRoute orig_conv;
40291 orig_conv.inner = (void*)(orig & (~1));
40292 orig_conv.is_owned = false;
40293 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40294 LDKRoute ret_var = Route_clone(&orig_conv);
40295 uint32_t ret_ref = 0;
40296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40299 ret_ref = (uintptr_t)ret_var.inner;
40300 if (ret_var.is_owned) {
40306 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
40308 o_conv.inner = (void*)(o & (~1));
40309 o_conv.is_owned = false;
40310 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40311 int64_t ret_conv = Route_hash(&o_conv);
40315 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
40317 a_conv.inner = (void*)(a & (~1));
40318 a_conv.is_owned = false;
40319 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40321 b_conv.inner = (void*)(b & (~1));
40322 b_conv.is_owned = false;
40323 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40324 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
40328 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
40329 LDKRoute this_arg_conv;
40330 this_arg_conv.inner = (void*)(this_arg & (~1));
40331 this_arg_conv.is_owned = false;
40332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40333 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
40337 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
40338 LDKRoute this_arg_conv;
40339 this_arg_conv.inner = (void*)(this_arg & (~1));
40340 this_arg_conv.is_owned = false;
40341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40342 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
40346 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
40348 obj_conv.inner = (void*)(obj & (~1));
40349 obj_conv.is_owned = false;
40350 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40351 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
40352 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40353 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40354 CVec_u8Z_free(ret_var);
40358 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
40359 LDKu8slice ser_ref;
40360 ser_ref.datalen = ser->arr_len;
40361 ser_ref.data = ser->elems;
40362 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
40363 *ret_conv = Route_read(ser_ref);
40365 return (uint32_t)ret_conv;
40368 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
40369 LDKRouteParameters this_obj_conv;
40370 this_obj_conv.inner = (void*)(this_obj & (~1));
40371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40373 RouteParameters_free(this_obj_conv);
40376 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
40377 LDKRouteParameters this_ptr_conv;
40378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40379 this_ptr_conv.is_owned = false;
40380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40381 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
40382 uint32_t ret_ref = 0;
40383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40386 ret_ref = (uintptr_t)ret_var.inner;
40387 if (ret_var.is_owned) {
40393 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
40394 LDKRouteParameters this_ptr_conv;
40395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40396 this_ptr_conv.is_owned = false;
40397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40398 LDKPaymentParameters val_conv;
40399 val_conv.inner = (void*)(val & (~1));
40400 val_conv.is_owned = (val & 1) || (val == 0);
40401 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40402 val_conv = PaymentParameters_clone(&val_conv);
40403 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
40406 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
40407 LDKRouteParameters this_ptr_conv;
40408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40409 this_ptr_conv.is_owned = false;
40410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40411 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
40415 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
40416 LDKRouteParameters this_ptr_conv;
40417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40418 this_ptr_conv.is_owned = false;
40419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40420 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
40423 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
40424 LDKRouteParameters this_ptr_conv;
40425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40426 this_ptr_conv.is_owned = false;
40427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40428 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
40432 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) {
40433 LDKRouteParameters this_ptr_conv;
40434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40435 this_ptr_conv.is_owned = false;
40436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40437 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
40440 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) {
40441 LDKPaymentParameters payment_params_arg_conv;
40442 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40443 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40444 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40445 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40446 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
40447 uint32_t ret_ref = 0;
40448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40451 ret_ref = (uintptr_t)ret_var.inner;
40452 if (ret_var.is_owned) {
40458 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
40459 LDKRouteParameters ret_var = RouteParameters_clone(arg);
40460 uint32_t ret_ref = 0;
40461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40464 ret_ref = (uintptr_t)ret_var.inner;
40465 if (ret_var.is_owned) {
40470 uint32_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
40471 LDKRouteParameters arg_conv;
40472 arg_conv.inner = (void*)(arg & (~1));
40473 arg_conv.is_owned = false;
40474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40475 uint32_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
40479 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
40480 LDKRouteParameters orig_conv;
40481 orig_conv.inner = (void*)(orig & (~1));
40482 orig_conv.is_owned = false;
40483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40484 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
40485 uint32_t ret_ref = 0;
40486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40489 ret_ref = (uintptr_t)ret_var.inner;
40490 if (ret_var.is_owned) {
40496 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
40497 LDKRouteParameters obj_conv;
40498 obj_conv.inner = (void*)(obj & (~1));
40499 obj_conv.is_owned = false;
40500 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40501 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
40502 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40503 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40504 CVec_u8Z_free(ret_var);
40508 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
40509 LDKu8slice ser_ref;
40510 ser_ref.datalen = ser->arr_len;
40511 ser_ref.data = ser->elems;
40512 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
40513 *ret_conv = RouteParameters_read(ser_ref);
40515 return (uint32_t)ret_conv;
40518 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
40519 LDKPaymentParameters this_obj_conv;
40520 this_obj_conv.inner = (void*)(this_obj & (~1));
40521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40523 PaymentParameters_free(this_obj_conv);
40526 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
40527 LDKPaymentParameters this_ptr_conv;
40528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40529 this_ptr_conv.is_owned = false;
40530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40531 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40532 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
40536 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
40537 LDKPaymentParameters this_ptr_conv;
40538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40539 this_ptr_conv.is_owned = false;
40540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40541 LDKPublicKey val_ref;
40542 CHECK(val->arr_len == 33);
40543 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40544 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
40547 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
40548 LDKPaymentParameters this_ptr_conv;
40549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40550 this_ptr_conv.is_owned = false;
40551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40552 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
40553 uint32_t ret_ref = 0;
40554 if ((uintptr_t)ret_var.inner > 4096) {
40555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40558 ret_ref = (uintptr_t)ret_var.inner;
40559 if (ret_var.is_owned) {
40566 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
40567 LDKPaymentParameters this_ptr_conv;
40568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40569 this_ptr_conv.is_owned = false;
40570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40571 LDKInvoiceFeatures val_conv;
40572 val_conv.inner = (void*)(val & (~1));
40573 val_conv.is_owned = (val & 1) || (val == 0);
40574 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40575 val_conv = InvoiceFeatures_clone(&val_conv);
40576 PaymentParameters_set_features(&this_ptr_conv, val_conv);
40579 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
40580 LDKPaymentParameters this_ptr_conv;
40581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40582 this_ptr_conv.is_owned = false;
40583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40584 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
40585 uint32_tArray ret_arr = NULL;
40586 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40587 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40588 for (size_t l = 0; l < ret_var.datalen; l++) {
40589 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40590 uint32_t ret_conv_11_ref = 0;
40591 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40592 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40594 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
40595 if (ret_conv_11_var.is_owned) {
40596 ret_conv_11_ref |= 1;
40598 ret_arr_ptr[l] = ret_conv_11_ref;
40601 FREE(ret_var.data);
40605 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
40606 LDKPaymentParameters this_ptr_conv;
40607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40608 this_ptr_conv.is_owned = false;
40609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40610 LDKCVec_RouteHintZ val_constr;
40611 val_constr.datalen = val->arr_len;
40612 if (val_constr.datalen > 0)
40613 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40615 val_constr.data = NULL;
40616 uint32_t* val_vals = val->elems;
40617 for (size_t l = 0; l < val_constr.datalen; l++) {
40618 uint32_t val_conv_11 = val_vals[l];
40619 LDKRouteHint val_conv_11_conv;
40620 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
40621 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
40622 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
40623 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
40624 val_constr.data[l] = val_conv_11_conv;
40627 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
40630 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
40631 LDKPaymentParameters this_ptr_conv;
40632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40633 this_ptr_conv.is_owned = false;
40634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40635 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40636 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
40637 uint32_t ret_ref = (uintptr_t)ret_copy;
40641 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
40642 LDKPaymentParameters this_ptr_conv;
40643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40644 this_ptr_conv.is_owned = false;
40645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40646 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40647 CHECK_ACCESS(val_ptr);
40648 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40649 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40650 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
40653 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) {
40654 LDKPaymentParameters this_ptr_conv;
40655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40656 this_ptr_conv.is_owned = false;
40657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40658 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
40662 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) {
40663 LDKPaymentParameters this_ptr_conv;
40664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40665 this_ptr_conv.is_owned = false;
40666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40667 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
40670 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) {
40671 LDKPublicKey payee_pubkey_arg_ref;
40672 CHECK(payee_pubkey_arg->arr_len == 33);
40673 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
40674 LDKInvoiceFeatures features_arg_conv;
40675 features_arg_conv.inner = (void*)(features_arg & (~1));
40676 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40677 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40678 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
40679 LDKCVec_RouteHintZ route_hints_arg_constr;
40680 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
40681 if (route_hints_arg_constr.datalen > 0)
40682 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40684 route_hints_arg_constr.data = NULL;
40685 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
40686 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
40687 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
40688 LDKRouteHint route_hints_arg_conv_11_conv;
40689 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
40690 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
40691 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
40692 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
40693 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
40695 FREE(route_hints_arg);
40696 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
40697 CHECK_ACCESS(expiry_time_arg_ptr);
40698 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
40699 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
40700 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);
40701 uint32_t ret_ref = 0;
40702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40705 ret_ref = (uintptr_t)ret_var.inner;
40706 if (ret_var.is_owned) {
40712 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
40713 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
40714 uint32_t ret_ref = 0;
40715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40718 ret_ref = (uintptr_t)ret_var.inner;
40719 if (ret_var.is_owned) {
40724 uint32_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
40725 LDKPaymentParameters arg_conv;
40726 arg_conv.inner = (void*)(arg & (~1));
40727 arg_conv.is_owned = false;
40728 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40729 uint32_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
40733 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
40734 LDKPaymentParameters orig_conv;
40735 orig_conv.inner = (void*)(orig & (~1));
40736 orig_conv.is_owned = false;
40737 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40738 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
40739 uint32_t ret_ref = 0;
40740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40743 ret_ref = (uintptr_t)ret_var.inner;
40744 if (ret_var.is_owned) {
40750 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
40751 LDKPaymentParameters o_conv;
40752 o_conv.inner = (void*)(o & (~1));
40753 o_conv.is_owned = false;
40754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40755 int64_t ret_conv = PaymentParameters_hash(&o_conv);
40759 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
40760 LDKPaymentParameters a_conv;
40761 a_conv.inner = (void*)(a & (~1));
40762 a_conv.is_owned = false;
40763 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40764 LDKPaymentParameters b_conv;
40765 b_conv.inner = (void*)(b & (~1));
40766 b_conv.is_owned = false;
40767 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40768 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
40772 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
40773 LDKPaymentParameters obj_conv;
40774 obj_conv.inner = (void*)(obj & (~1));
40775 obj_conv.is_owned = false;
40776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40777 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
40778 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40779 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40780 CVec_u8Z_free(ret_var);
40784 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
40785 LDKu8slice ser_ref;
40786 ser_ref.datalen = ser->arr_len;
40787 ser_ref.data = ser->elems;
40788 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
40789 *ret_conv = PaymentParameters_read(ser_ref);
40791 return (uint32_t)ret_conv;
40794 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
40795 LDKPublicKey payee_pubkey_ref;
40796 CHECK(payee_pubkey->arr_len == 33);
40797 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40798 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
40799 uint32_t ret_ref = 0;
40800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40803 ret_ref = (uintptr_t)ret_var.inner;
40804 if (ret_var.is_owned) {
40810 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
40811 LDKPublicKey payee_pubkey_ref;
40812 CHECK(payee_pubkey->arr_len == 33);
40813 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40814 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
40815 uint32_t ret_ref = 0;
40816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40819 ret_ref = (uintptr_t)ret_var.inner;
40820 if (ret_var.is_owned) {
40826 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
40827 LDKRouteHint this_obj_conv;
40828 this_obj_conv.inner = (void*)(this_obj & (~1));
40829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40831 RouteHint_free(this_obj_conv);
40834 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
40835 LDKRouteHint this_ptr_conv;
40836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40837 this_ptr_conv.is_owned = false;
40838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40839 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
40840 uint32_tArray ret_arr = NULL;
40841 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40842 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40843 for (size_t o = 0; o < ret_var.datalen; o++) {
40844 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
40845 uint32_t ret_conv_14_ref = 0;
40846 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40847 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40849 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40850 if (ret_conv_14_var.is_owned) {
40851 ret_conv_14_ref |= 1;
40853 ret_arr_ptr[o] = ret_conv_14_ref;
40856 FREE(ret_var.data);
40860 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
40861 LDKRouteHint this_ptr_conv;
40862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40863 this_ptr_conv.is_owned = false;
40864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40865 LDKCVec_RouteHintHopZ val_constr;
40866 val_constr.datalen = val->arr_len;
40867 if (val_constr.datalen > 0)
40868 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40870 val_constr.data = NULL;
40871 uint32_t* val_vals = val->elems;
40872 for (size_t o = 0; o < val_constr.datalen; o++) {
40873 uint32_t val_conv_14 = val_vals[o];
40874 LDKRouteHintHop val_conv_14_conv;
40875 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
40876 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
40877 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
40878 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
40879 val_constr.data[o] = val_conv_14_conv;
40882 RouteHint_set_a(&this_ptr_conv, val_constr);
40885 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
40886 LDKCVec_RouteHintHopZ a_arg_constr;
40887 a_arg_constr.datalen = a_arg->arr_len;
40888 if (a_arg_constr.datalen > 0)
40889 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40891 a_arg_constr.data = NULL;
40892 uint32_t* a_arg_vals = a_arg->elems;
40893 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
40894 uint32_t a_arg_conv_14 = a_arg_vals[o];
40895 LDKRouteHintHop a_arg_conv_14_conv;
40896 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
40897 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
40898 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
40899 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
40900 a_arg_constr.data[o] = a_arg_conv_14_conv;
40903 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
40904 uint32_t ret_ref = 0;
40905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40908 ret_ref = (uintptr_t)ret_var.inner;
40909 if (ret_var.is_owned) {
40915 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
40916 LDKRouteHint ret_var = RouteHint_clone(arg);
40917 uint32_t ret_ref = 0;
40918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40921 ret_ref = (uintptr_t)ret_var.inner;
40922 if (ret_var.is_owned) {
40927 uint32_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
40928 LDKRouteHint arg_conv;
40929 arg_conv.inner = (void*)(arg & (~1));
40930 arg_conv.is_owned = false;
40931 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40932 uint32_t ret_conv = RouteHint_clone_ptr(&arg_conv);
40936 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
40937 LDKRouteHint orig_conv;
40938 orig_conv.inner = (void*)(orig & (~1));
40939 orig_conv.is_owned = false;
40940 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40941 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
40942 uint32_t ret_ref = 0;
40943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40946 ret_ref = (uintptr_t)ret_var.inner;
40947 if (ret_var.is_owned) {
40953 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
40954 LDKRouteHint o_conv;
40955 o_conv.inner = (void*)(o & (~1));
40956 o_conv.is_owned = false;
40957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40958 int64_t ret_conv = RouteHint_hash(&o_conv);
40962 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
40963 LDKRouteHint a_conv;
40964 a_conv.inner = (void*)(a & (~1));
40965 a_conv.is_owned = false;
40966 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40967 LDKRouteHint b_conv;
40968 b_conv.inner = (void*)(b & (~1));
40969 b_conv.is_owned = false;
40970 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40971 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
40975 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
40976 LDKRouteHint obj_conv;
40977 obj_conv.inner = (void*)(obj & (~1));
40978 obj_conv.is_owned = false;
40979 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40980 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
40981 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40982 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40983 CVec_u8Z_free(ret_var);
40987 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
40988 LDKu8slice ser_ref;
40989 ser_ref.datalen = ser->arr_len;
40990 ser_ref.data = ser->elems;
40991 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
40992 *ret_conv = RouteHint_read(ser_ref);
40994 return (uint32_t)ret_conv;
40997 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
40998 LDKRouteHintHop this_obj_conv;
40999 this_obj_conv.inner = (void*)(this_obj & (~1));
41000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41002 RouteHintHop_free(this_obj_conv);
41005 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
41006 LDKRouteHintHop this_ptr_conv;
41007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41008 this_ptr_conv.is_owned = false;
41009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41010 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41011 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
41015 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
41016 LDKRouteHintHop this_ptr_conv;
41017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41018 this_ptr_conv.is_owned = false;
41019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41020 LDKPublicKey val_ref;
41021 CHECK(val->arr_len == 33);
41022 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41023 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
41026 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
41027 LDKRouteHintHop this_ptr_conv;
41028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41029 this_ptr_conv.is_owned = false;
41030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41031 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
41035 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
41036 LDKRouteHintHop this_ptr_conv;
41037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41038 this_ptr_conv.is_owned = false;
41039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41040 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
41043 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
41044 LDKRouteHintHop this_ptr_conv;
41045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41046 this_ptr_conv.is_owned = false;
41047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41048 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
41049 uint32_t ret_ref = 0;
41050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41053 ret_ref = (uintptr_t)ret_var.inner;
41054 if (ret_var.is_owned) {
41060 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
41061 LDKRouteHintHop this_ptr_conv;
41062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41063 this_ptr_conv.is_owned = false;
41064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41065 LDKRoutingFees val_conv;
41066 val_conv.inner = (void*)(val & (~1));
41067 val_conv.is_owned = (val & 1) || (val == 0);
41068 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41069 val_conv = RoutingFees_clone(&val_conv);
41070 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
41073 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
41074 LDKRouteHintHop this_ptr_conv;
41075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41076 this_ptr_conv.is_owned = false;
41077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41078 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
41082 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
41083 LDKRouteHintHop this_ptr_conv;
41084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41085 this_ptr_conv.is_owned = false;
41086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41087 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41090 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
41091 LDKRouteHintHop this_ptr_conv;
41092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41093 this_ptr_conv.is_owned = false;
41094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41095 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41096 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
41097 uint32_t ret_ref = (uintptr_t)ret_copy;
41101 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
41102 LDKRouteHintHop this_ptr_conv;
41103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41104 this_ptr_conv.is_owned = false;
41105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41106 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41107 CHECK_ACCESS(val_ptr);
41108 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41109 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41110 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
41113 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
41114 LDKRouteHintHop this_ptr_conv;
41115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41116 this_ptr_conv.is_owned = false;
41117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41118 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41119 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
41120 uint32_t ret_ref = (uintptr_t)ret_copy;
41124 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
41125 LDKRouteHintHop this_ptr_conv;
41126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41127 this_ptr_conv.is_owned = false;
41128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41129 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41130 CHECK_ACCESS(val_ptr);
41131 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41132 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41133 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
41136 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) {
41137 LDKPublicKey src_node_id_arg_ref;
41138 CHECK(src_node_id_arg->arr_len == 33);
41139 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
41140 LDKRoutingFees fees_arg_conv;
41141 fees_arg_conv.inner = (void*)(fees_arg & (~1));
41142 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
41143 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41144 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41145 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
41146 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
41147 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
41148 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
41149 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
41150 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
41151 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
41152 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
41153 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);
41154 uint32_t ret_ref = 0;
41155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41158 ret_ref = (uintptr_t)ret_var.inner;
41159 if (ret_var.is_owned) {
41165 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
41166 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
41167 uint32_t ret_ref = 0;
41168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41171 ret_ref = (uintptr_t)ret_var.inner;
41172 if (ret_var.is_owned) {
41177 uint32_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
41178 LDKRouteHintHop arg_conv;
41179 arg_conv.inner = (void*)(arg & (~1));
41180 arg_conv.is_owned = false;
41181 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41182 uint32_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
41186 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
41187 LDKRouteHintHop orig_conv;
41188 orig_conv.inner = (void*)(orig & (~1));
41189 orig_conv.is_owned = false;
41190 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41191 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
41192 uint32_t ret_ref = 0;
41193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41196 ret_ref = (uintptr_t)ret_var.inner;
41197 if (ret_var.is_owned) {
41203 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
41204 LDKRouteHintHop o_conv;
41205 o_conv.inner = (void*)(o & (~1));
41206 o_conv.is_owned = false;
41207 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41208 int64_t ret_conv = RouteHintHop_hash(&o_conv);
41212 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
41213 LDKRouteHintHop a_conv;
41214 a_conv.inner = (void*)(a & (~1));
41215 a_conv.is_owned = false;
41216 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41217 LDKRouteHintHop b_conv;
41218 b_conv.inner = (void*)(b & (~1));
41219 b_conv.is_owned = false;
41220 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41221 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
41225 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
41226 LDKRouteHintHop obj_conv;
41227 obj_conv.inner = (void*)(obj & (~1));
41228 obj_conv.is_owned = false;
41229 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41230 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
41231 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41232 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41233 CVec_u8Z_free(ret_var);
41237 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
41238 LDKu8slice ser_ref;
41239 ser_ref.datalen = ser->arr_len;
41240 ser_ref.data = ser->elems;
41241 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
41242 *ret_conv = RouteHintHop_read(ser_ref);
41244 return (uint32_t)ret_conv;
41247 uint32_t __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t route_params, uint32_t network_graph, uint32_tArray first_hops, uint32_t logger, uint32_t scorer, int8_tArray random_seed_bytes) {
41248 LDKPublicKey our_node_pubkey_ref;
41249 CHECK(our_node_pubkey->arr_len == 33);
41250 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41251 LDKRouteParameters route_params_conv;
41252 route_params_conv.inner = (void*)(route_params & (~1));
41253 route_params_conv.is_owned = false;
41254 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41255 LDKNetworkGraph network_graph_conv;
41256 network_graph_conv.inner = (void*)(network_graph & (~1));
41257 network_graph_conv.is_owned = false;
41258 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41259 LDKCVec_ChannelDetailsZ first_hops_constr;
41260 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
41261 if (first_hops != 0) {
41262 first_hops_constr.datalen = first_hops->arr_len;
41263 if (first_hops_constr.datalen > 0)
41264 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41266 first_hops_constr.data = NULL;
41267 uint32_t* first_hops_vals = first_hops->elems;
41268 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
41269 uint32_t first_hops_conv_16 = first_hops_vals[q];
41270 LDKChannelDetails first_hops_conv_16_conv;
41271 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
41272 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
41273 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
41274 first_hops_constr.data[q] = first_hops_conv_16_conv;
41277 first_hops_ptr = &first_hops_constr;
41279 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41280 CHECK_ACCESS(logger_ptr);
41281 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41282 if (logger_conv.free == LDKLogger_JCalls_free) {
41283 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41284 LDKLogger_JCalls_cloned(&logger_conv);
41286 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
41287 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
41288 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
41289 unsigned char random_seed_bytes_arr[32];
41290 CHECK(random_seed_bytes->arr_len == 32);
41291 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41292 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41293 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41294 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
41295 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
41296 return (uint32_t)ret_conv;
41299 uint32_t __attribute__((export_name("TS_build_route_from_hops"))) TS_build_route_from_hops(int8_tArray our_node_pubkey, ptrArray hops, uint32_t route_params, uint32_t network_graph, uint32_t logger, int8_tArray random_seed_bytes) {
41300 LDKPublicKey our_node_pubkey_ref;
41301 CHECK(our_node_pubkey->arr_len == 33);
41302 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41303 LDKCVec_PublicKeyZ hops_constr;
41304 hops_constr.datalen = hops->arr_len;
41305 if (hops_constr.datalen > 0)
41306 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
41308 hops_constr.data = NULL;
41309 int8_tArray* hops_vals = (void*) hops->elems;
41310 for (size_t m = 0; m < hops_constr.datalen; m++) {
41311 int8_tArray hops_conv_12 = hops_vals[m];
41312 LDKPublicKey hops_conv_12_ref;
41313 CHECK(hops_conv_12->arr_len == 33);
41314 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
41315 hops_constr.data[m] = hops_conv_12_ref;
41318 LDKRouteParameters route_params_conv;
41319 route_params_conv.inner = (void*)(route_params & (~1));
41320 route_params_conv.is_owned = false;
41321 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41322 LDKNetworkGraph network_graph_conv;
41323 network_graph_conv.inner = (void*)(network_graph & (~1));
41324 network_graph_conv.is_owned = false;
41325 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41326 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41327 CHECK_ACCESS(logger_ptr);
41328 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41329 if (logger_conv.free == LDKLogger_JCalls_free) {
41330 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41331 LDKLogger_JCalls_cloned(&logger_conv);
41333 unsigned char random_seed_bytes_arr[32];
41334 CHECK(random_seed_bytes->arr_len == 32);
41335 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41336 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41337 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41338 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
41339 return (uint32_t)ret_conv;
41342 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
41343 if ((this_ptr & 1) != 0) return;
41344 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41345 CHECK_ACCESS(this_ptr_ptr);
41346 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
41347 FREE((void*)this_ptr);
41348 Score_free(this_ptr_conv);
41351 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
41352 if ((this_ptr & 1) != 0) return;
41353 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41354 CHECK_ACCESS(this_ptr_ptr);
41355 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
41356 FREE((void*)this_ptr);
41357 LockableScore_free(this_ptr_conv);
41360 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
41361 LDKMultiThreadedLockableScore this_obj_conv;
41362 this_obj_conv.inner = (void*)(this_obj & (~1));
41363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41365 MultiThreadedLockableScore_free(this_obj_conv);
41368 int8_tArray __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint32_t obj) {
41369 LDKMultiThreadedLockableScore obj_conv;
41370 obj_conv.inner = (void*)(obj & (~1));
41371 obj_conv.is_owned = false;
41372 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41373 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
41374 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41375 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41376 CVec_u8Z_free(ret_var);
41380 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
41381 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
41382 CHECK_ACCESS(score_ptr);
41383 LDKScore score_conv = *(LDKScore*)(score_ptr);
41384 if (score_conv.free == LDKScore_JCalls_free) {
41385 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41386 LDKScore_JCalls_cloned(&score_conv);
41388 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
41389 uint32_t ret_ref = 0;
41390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41393 ret_ref = (uintptr_t)ret_var.inner;
41394 if (ret_var.is_owned) {
41400 void __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint32_t this_obj) {
41401 LDKChannelUsage this_obj_conv;
41402 this_obj_conv.inner = (void*)(this_obj & (~1));
41403 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41405 ChannelUsage_free(this_obj_conv);
41408 int64_t __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint32_t this_ptr) {
41409 LDKChannelUsage this_ptr_conv;
41410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41411 this_ptr_conv.is_owned = false;
41412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
41417 void __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint32_t this_ptr, int64_t val) {
41418 LDKChannelUsage this_ptr_conv;
41419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41420 this_ptr_conv.is_owned = false;
41421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41422 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
41425 int64_t __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint32_t this_ptr) {
41426 LDKChannelUsage this_ptr_conv;
41427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41428 this_ptr_conv.is_owned = false;
41429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41430 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
41434 void __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint32_t this_ptr, int64_t val) {
41435 LDKChannelUsage this_ptr_conv;
41436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41437 this_ptr_conv.is_owned = false;
41438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41439 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
41442 uint32_t __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint32_t this_ptr) {
41443 LDKChannelUsage this_ptr_conv;
41444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41445 this_ptr_conv.is_owned = false;
41446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41447 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41448 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
41449 uint32_t ret_ref = (uintptr_t)ret_copy;
41453 void __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint32_t this_ptr, uint32_t val) {
41454 LDKChannelUsage this_ptr_conv;
41455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41456 this_ptr_conv.is_owned = false;
41457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41458 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41459 CHECK_ACCESS(val_ptr);
41460 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
41461 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
41462 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
41465 uint32_t __attribute__((export_name("TS_ChannelUsage_new"))) TS_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, uint32_t effective_capacity_arg) {
41466 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
41467 CHECK_ACCESS(effective_capacity_arg_ptr);
41468 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
41469 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
41470 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
41471 uint32_t ret_ref = 0;
41472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41475 ret_ref = (uintptr_t)ret_var.inner;
41476 if (ret_var.is_owned) {
41482 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
41483 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
41484 uint32_t ret_ref = 0;
41485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41488 ret_ref = (uintptr_t)ret_var.inner;
41489 if (ret_var.is_owned) {
41494 uint32_t __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint32_t arg) {
41495 LDKChannelUsage arg_conv;
41496 arg_conv.inner = (void*)(arg & (~1));
41497 arg_conv.is_owned = false;
41498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41499 uint32_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
41503 uint32_t __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint32_t orig) {
41504 LDKChannelUsage orig_conv;
41505 orig_conv.inner = (void*)(orig & (~1));
41506 orig_conv.is_owned = false;
41507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41508 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
41509 uint32_t ret_ref = 0;
41510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41513 ret_ref = (uintptr_t)ret_var.inner;
41514 if (ret_var.is_owned) {
41520 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
41521 LDKFixedPenaltyScorer this_obj_conv;
41522 this_obj_conv.inner = (void*)(this_obj & (~1));
41523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41525 FixedPenaltyScorer_free(this_obj_conv);
41528 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
41529 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
41530 uint32_t ret_ref = 0;
41531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41534 ret_ref = (uintptr_t)ret_var.inner;
41535 if (ret_var.is_owned) {
41540 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
41541 LDKFixedPenaltyScorer arg_conv;
41542 arg_conv.inner = (void*)(arg & (~1));
41543 arg_conv.is_owned = false;
41544 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41545 uint32_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
41549 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
41550 LDKFixedPenaltyScorer orig_conv;
41551 orig_conv.inner = (void*)(orig & (~1));
41552 orig_conv.is_owned = false;
41553 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41554 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
41555 uint32_t ret_ref = 0;
41556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41559 ret_ref = (uintptr_t)ret_var.inner;
41560 if (ret_var.is_owned) {
41566 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
41567 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
41568 uint32_t ret_ref = 0;
41569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41572 ret_ref = (uintptr_t)ret_var.inner;
41573 if (ret_var.is_owned) {
41579 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
41580 LDKFixedPenaltyScorer this_arg_conv;
41581 this_arg_conv.inner = (void*)(this_arg & (~1));
41582 this_arg_conv.is_owned = false;
41583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41584 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41585 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
41586 return (uint32_t)ret_ret;
41589 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
41590 LDKFixedPenaltyScorer obj_conv;
41591 obj_conv.inner = (void*)(obj & (~1));
41592 obj_conv.is_owned = false;
41593 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41594 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
41595 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41596 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41597 CVec_u8Z_free(ret_var);
41601 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
41602 LDKu8slice ser_ref;
41603 ser_ref.datalen = ser->arr_len;
41604 ser_ref.data = ser->elems;
41605 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
41606 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
41608 return (uint32_t)ret_conv;
41611 void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint32_t this_obj) {
41612 LDKProbabilisticScorer this_obj_conv;
41613 this_obj_conv.inner = (void*)(this_obj & (~1));
41614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41616 ProbabilisticScorer_free(this_obj_conv);
41619 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
41620 LDKProbabilisticScoringParameters this_obj_conv;
41621 this_obj_conv.inner = (void*)(this_obj & (~1));
41622 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41624 ProbabilisticScoringParameters_free(this_obj_conv);
41627 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
41628 LDKProbabilisticScoringParameters this_ptr_conv;
41629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41630 this_ptr_conv.is_owned = false;
41631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41632 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
41636 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
41637 LDKProbabilisticScoringParameters this_ptr_conv;
41638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41639 this_ptr_conv.is_owned = false;
41640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41641 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
41644 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
41645 LDKProbabilisticScoringParameters this_ptr_conv;
41646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41647 this_ptr_conv.is_owned = false;
41648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41649 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
41653 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) {
41654 LDKProbabilisticScoringParameters this_ptr_conv;
41655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41656 this_ptr_conv.is_owned = false;
41657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41658 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
41661 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
41662 LDKProbabilisticScoringParameters this_ptr_conv;
41663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41664 this_ptr_conv.is_owned = false;
41665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41666 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
41670 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) {
41671 LDKProbabilisticScoringParameters this_ptr_conv;
41672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41673 this_ptr_conv.is_owned = false;
41674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41675 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
41678 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(uint32_t this_ptr) {
41679 LDKProbabilisticScoringParameters this_ptr_conv;
41680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41681 this_ptr_conv.is_owned = false;
41682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41683 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
41687 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(uint32_t this_ptr, int64_t val) {
41688 LDKProbabilisticScoringParameters this_ptr_conv;
41689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41690 this_ptr_conv.is_owned = false;
41691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41692 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
41695 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_new"))) TS_ProbabilisticScoringParameters_new(int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) {
41696 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
41697 uint32_t ret_ref = 0;
41698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41701 ret_ref = (uintptr_t)ret_var.inner;
41702 if (ret_var.is_owned) {
41708 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
41709 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
41710 uint32_t ret_ref = 0;
41711 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41712 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41714 ret_ref = (uintptr_t)ret_var.inner;
41715 if (ret_var.is_owned) {
41720 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
41721 LDKProbabilisticScoringParameters arg_conv;
41722 arg_conv.inner = (void*)(arg & (~1));
41723 arg_conv.is_owned = false;
41724 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41725 uint32_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
41729 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
41730 LDKProbabilisticScoringParameters orig_conv;
41731 orig_conv.inner = (void*)(orig & (~1));
41732 orig_conv.is_owned = false;
41733 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41734 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
41735 uint32_t ret_ref = 0;
41736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41739 ret_ref = (uintptr_t)ret_var.inner;
41740 if (ret_var.is_owned) {
41746 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint32_t params, uint32_t network_graph, uint32_t logger) {
41747 LDKProbabilisticScoringParameters params_conv;
41748 params_conv.inner = (void*)(params & (~1));
41749 params_conv.is_owned = (params & 1) || (params == 0);
41750 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41751 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
41752 LDKNetworkGraph network_graph_conv;
41753 network_graph_conv.inner = (void*)(network_graph & (~1));
41754 network_graph_conv.is_owned = false;
41755 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41756 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41757 CHECK_ACCESS(logger_ptr);
41758 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41759 if (logger_conv.free == LDKLogger_JCalls_free) {
41760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41761 LDKLogger_JCalls_cloned(&logger_conv);
41763 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
41764 uint32_t ret_ref = 0;
41765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41768 ret_ref = (uintptr_t)ret_var.inner;
41769 if (ret_var.is_owned) {
41775 void __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint32_t this_arg) {
41776 LDKProbabilisticScorer this_arg_conv;
41777 this_arg_conv.inner = (void*)(this_arg & (~1));
41778 this_arg_conv.is_owned = false;
41779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41780 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
41783 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
41784 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
41785 uint32_t ret_ref = 0;
41786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41789 ret_ref = (uintptr_t)ret_var.inner;
41790 if (ret_var.is_owned) {
41796 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint32_t this_arg) {
41797 LDKProbabilisticScorer this_arg_conv;
41798 this_arg_conv.inner = (void*)(this_arg & (~1));
41799 this_arg_conv.is_owned = false;
41800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41801 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41802 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
41803 return (uint32_t)ret_ret;
41806 int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint32_t obj) {
41807 LDKProbabilisticScorer obj_conv;
41808 obj_conv.inner = (void*)(obj & (~1));
41809 obj_conv.is_owned = false;
41810 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41811 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
41812 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41813 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41814 CVec_u8Z_free(ret_var);
41818 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_read"))) TS_ProbabilisticScorer_read(int8_tArray ser, uint32_t arg_a, uint32_t arg_b, uint32_t arg_c) {
41819 LDKu8slice ser_ref;
41820 ser_ref.datalen = ser->arr_len;
41821 ser_ref.data = ser->elems;
41822 LDKProbabilisticScoringParameters arg_a_conv;
41823 arg_a_conv.inner = (void*)(arg_a & (~1));
41824 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
41825 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
41826 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
41827 LDKNetworkGraph arg_b_conv;
41828 arg_b_conv.inner = (void*)(arg_b & (~1));
41829 arg_b_conv.is_owned = false;
41830 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
41831 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
41832 CHECK_ACCESS(arg_c_ptr);
41833 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
41834 if (arg_c_conv.free == LDKLogger_JCalls_free) {
41835 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41836 LDKLogger_JCalls_cloned(&arg_c_conv);
41838 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
41839 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
41841 return (uint32_t)ret_conv;
41844 void __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint32_t this_ptr) {
41845 if ((this_ptr & 1) != 0) return;
41846 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41847 CHECK_ACCESS(this_ptr_ptr);
41848 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
41849 FREE((void*)this_ptr);
41850 ParseError_free(this_ptr_conv);
41853 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
41854 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41855 *ret_copy = ParseError_clone(arg);
41856 uint32_t ret_ref = (uintptr_t)ret_copy;
41859 uint32_t __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint32_t arg) {
41860 LDKParseError* arg_conv = (LDKParseError*)arg;
41861 uint32_t ret_conv = ParseError_clone_ptr(arg_conv);
41865 uint32_t __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint32_t orig) {
41866 LDKParseError* orig_conv = (LDKParseError*)orig;
41867 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41868 *ret_copy = ParseError_clone(orig_conv);
41869 uint32_t ret_ref = (uintptr_t)ret_copy;
41873 uint32_t __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint32_t a) {
41874 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
41875 CHECK_ACCESS(a_ptr);
41876 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
41877 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
41878 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41879 *ret_copy = ParseError_bech32_error(a_conv);
41880 uint32_t ret_ref = (uintptr_t)ret_copy;
41884 uint32_t __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
41886 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41887 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
41888 uint32_t ret_ref = (uintptr_t)ret_copy;
41892 uint32_t __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
41893 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
41894 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41895 *ret_copy = ParseError_malformed_signature(a_conv);
41896 uint32_t ret_ref = (uintptr_t)ret_copy;
41900 uint32_t __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
41901 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41902 *ret_copy = ParseError_bad_prefix();
41903 uint32_t ret_ref = (uintptr_t)ret_copy;
41907 uint32_t __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
41908 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41909 *ret_copy = ParseError_unknown_currency();
41910 uint32_t ret_ref = (uintptr_t)ret_copy;
41914 uint32_t __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
41915 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41916 *ret_copy = ParseError_unknown_si_prefix();
41917 uint32_t ret_ref = (uintptr_t)ret_copy;
41921 uint32_t __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
41922 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41923 *ret_copy = ParseError_malformed_hrp();
41924 uint32_t ret_ref = (uintptr_t)ret_copy;
41928 uint32_t __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
41929 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41930 *ret_copy = ParseError_too_short_data_part();
41931 uint32_t ret_ref = (uintptr_t)ret_copy;
41935 uint32_t __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
41936 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41937 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
41938 uint32_t ret_ref = (uintptr_t)ret_copy;
41942 uint32_t __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
41944 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41945 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
41946 uint32_t ret_ref = (uintptr_t)ret_copy;
41950 uint32_t __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
41951 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41952 *ret_copy = ParseError_padding_error();
41953 uint32_t ret_ref = (uintptr_t)ret_copy;
41957 uint32_t __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
41958 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41959 *ret_copy = ParseError_integer_overflow_error();
41960 uint32_t ret_ref = (uintptr_t)ret_copy;
41964 uint32_t __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
41965 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41966 *ret_copy = ParseError_invalid_seg_wit_program_length();
41967 uint32_t ret_ref = (uintptr_t)ret_copy;
41971 uint32_t __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
41972 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41973 *ret_copy = ParseError_invalid_pub_key_hash_length();
41974 uint32_t ret_ref = (uintptr_t)ret_copy;
41978 uint32_t __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
41979 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41980 *ret_copy = ParseError_invalid_script_hash_length();
41981 uint32_t ret_ref = (uintptr_t)ret_copy;
41985 uint32_t __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
41986 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41987 *ret_copy = ParseError_invalid_recovery_id();
41988 uint32_t ret_ref = (uintptr_t)ret_copy;
41992 uint32_t __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
41993 LDKStr a_conv = str_ref_to_owned_c(a);
41994 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41995 *ret_copy = ParseError_invalid_slice_length(a_conv);
41996 uint32_t ret_ref = (uintptr_t)ret_copy;
42000 uint32_t __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
42001 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
42002 *ret_copy = ParseError_skip();
42003 uint32_t ret_ref = (uintptr_t)ret_copy;
42007 void __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint32_t this_ptr) {
42008 if ((this_ptr & 1) != 0) return;
42009 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42010 CHECK_ACCESS(this_ptr_ptr);
42011 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
42012 FREE((void*)this_ptr);
42013 ParseOrSemanticError_free(this_ptr_conv);
42016 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
42017 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42018 *ret_copy = ParseOrSemanticError_clone(arg);
42019 uint32_t ret_ref = (uintptr_t)ret_copy;
42022 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint32_t arg) {
42023 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
42024 uint32_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
42028 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint32_t orig) {
42029 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
42030 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42031 *ret_copy = ParseOrSemanticError_clone(orig_conv);
42032 uint32_t ret_ref = (uintptr_t)ret_copy;
42036 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint32_t a) {
42037 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
42038 CHECK_ACCESS(a_ptr);
42039 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
42040 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
42041 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42042 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
42043 uint32_t ret_ref = (uintptr_t)ret_copy;
42047 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
42048 LDKSemanticError a_conv = LDKSemanticError_from_js(a);
42049 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42050 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
42051 uint32_t ret_ref = (uintptr_t)ret_copy;
42055 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
42056 LDKInvoice this_obj_conv;
42057 this_obj_conv.inner = (void*)(this_obj & (~1));
42058 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42060 Invoice_free(this_obj_conv);
42063 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
42065 a_conv.inner = (void*)(a & (~1));
42066 a_conv.is_owned = false;
42067 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42069 b_conv.inner = (void*)(b & (~1));
42070 b_conv.is_owned = false;
42071 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42072 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
42076 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
42077 LDKInvoice ret_var = Invoice_clone(arg);
42078 uint32_t ret_ref = 0;
42079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42082 ret_ref = (uintptr_t)ret_var.inner;
42083 if (ret_var.is_owned) {
42088 uint32_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
42089 LDKInvoice arg_conv;
42090 arg_conv.inner = (void*)(arg & (~1));
42091 arg_conv.is_owned = false;
42092 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42093 uint32_t ret_conv = Invoice_clone_ptr(&arg_conv);
42097 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
42098 LDKInvoice orig_conv;
42099 orig_conv.inner = (void*)(orig & (~1));
42100 orig_conv.is_owned = false;
42101 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42102 LDKInvoice ret_var = Invoice_clone(&orig_conv);
42103 uint32_t ret_ref = 0;
42104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42107 ret_ref = (uintptr_t)ret_var.inner;
42108 if (ret_var.is_owned) {
42114 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
42115 LDKSignedRawInvoice this_obj_conv;
42116 this_obj_conv.inner = (void*)(this_obj & (~1));
42117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42119 SignedRawInvoice_free(this_obj_conv);
42122 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
42123 LDKSignedRawInvoice a_conv;
42124 a_conv.inner = (void*)(a & (~1));
42125 a_conv.is_owned = false;
42126 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42127 LDKSignedRawInvoice b_conv;
42128 b_conv.inner = (void*)(b & (~1));
42129 b_conv.is_owned = false;
42130 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42131 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
42135 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
42136 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
42137 uint32_t ret_ref = 0;
42138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42141 ret_ref = (uintptr_t)ret_var.inner;
42142 if (ret_var.is_owned) {
42147 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
42148 LDKSignedRawInvoice arg_conv;
42149 arg_conv.inner = (void*)(arg & (~1));
42150 arg_conv.is_owned = false;
42151 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42152 uint32_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
42156 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
42157 LDKSignedRawInvoice orig_conv;
42158 orig_conv.inner = (void*)(orig & (~1));
42159 orig_conv.is_owned = false;
42160 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42161 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
42162 uint32_t ret_ref = 0;
42163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42166 ret_ref = (uintptr_t)ret_var.inner;
42167 if (ret_var.is_owned) {
42173 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
42174 LDKRawInvoice this_obj_conv;
42175 this_obj_conv.inner = (void*)(this_obj & (~1));
42176 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42178 RawInvoice_free(this_obj_conv);
42181 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
42182 LDKRawInvoice this_ptr_conv;
42183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42184 this_ptr_conv.is_owned = false;
42185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42186 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
42187 uint32_t ret_ref = 0;
42188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42191 ret_ref = (uintptr_t)ret_var.inner;
42192 if (ret_var.is_owned) {
42198 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
42199 LDKRawInvoice this_ptr_conv;
42200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42201 this_ptr_conv.is_owned = false;
42202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42203 LDKRawDataPart val_conv;
42204 val_conv.inner = (void*)(val & (~1));
42205 val_conv.is_owned = (val & 1) || (val == 0);
42206 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42207 val_conv = RawDataPart_clone(&val_conv);
42208 RawInvoice_set_data(&this_ptr_conv, val_conv);
42211 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
42212 LDKRawInvoice a_conv;
42213 a_conv.inner = (void*)(a & (~1));
42214 a_conv.is_owned = false;
42215 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42216 LDKRawInvoice b_conv;
42217 b_conv.inner = (void*)(b & (~1));
42218 b_conv.is_owned = false;
42219 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42220 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
42224 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
42225 LDKRawInvoice ret_var = RawInvoice_clone(arg);
42226 uint32_t ret_ref = 0;
42227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42230 ret_ref = (uintptr_t)ret_var.inner;
42231 if (ret_var.is_owned) {
42236 uint32_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
42237 LDKRawInvoice arg_conv;
42238 arg_conv.inner = (void*)(arg & (~1));
42239 arg_conv.is_owned = false;
42240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42241 uint32_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
42245 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
42246 LDKRawInvoice orig_conv;
42247 orig_conv.inner = (void*)(orig & (~1));
42248 orig_conv.is_owned = false;
42249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42250 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
42251 uint32_t ret_ref = 0;
42252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42255 ret_ref = (uintptr_t)ret_var.inner;
42256 if (ret_var.is_owned) {
42262 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
42263 LDKRawDataPart this_obj_conv;
42264 this_obj_conv.inner = (void*)(this_obj & (~1));
42265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42267 RawDataPart_free(this_obj_conv);
42270 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
42271 LDKRawDataPart this_ptr_conv;
42272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42273 this_ptr_conv.is_owned = false;
42274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42275 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
42276 uint32_t ret_ref = 0;
42277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42280 ret_ref = (uintptr_t)ret_var.inner;
42281 if (ret_var.is_owned) {
42287 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
42288 LDKRawDataPart this_ptr_conv;
42289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42290 this_ptr_conv.is_owned = false;
42291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42292 LDKPositiveTimestamp val_conv;
42293 val_conv.inner = (void*)(val & (~1));
42294 val_conv.is_owned = (val & 1) || (val == 0);
42295 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42296 val_conv = PositiveTimestamp_clone(&val_conv);
42297 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
42300 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
42301 LDKRawDataPart a_conv;
42302 a_conv.inner = (void*)(a & (~1));
42303 a_conv.is_owned = false;
42304 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42305 LDKRawDataPart b_conv;
42306 b_conv.inner = (void*)(b & (~1));
42307 b_conv.is_owned = false;
42308 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42309 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
42313 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
42314 LDKRawDataPart ret_var = RawDataPart_clone(arg);
42315 uint32_t ret_ref = 0;
42316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42319 ret_ref = (uintptr_t)ret_var.inner;
42320 if (ret_var.is_owned) {
42325 uint32_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
42326 LDKRawDataPart arg_conv;
42327 arg_conv.inner = (void*)(arg & (~1));
42328 arg_conv.is_owned = false;
42329 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42330 uint32_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
42334 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
42335 LDKRawDataPart orig_conv;
42336 orig_conv.inner = (void*)(orig & (~1));
42337 orig_conv.is_owned = false;
42338 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42339 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
42340 uint32_t ret_ref = 0;
42341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42344 ret_ref = (uintptr_t)ret_var.inner;
42345 if (ret_var.is_owned) {
42351 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
42352 LDKPositiveTimestamp this_obj_conv;
42353 this_obj_conv.inner = (void*)(this_obj & (~1));
42354 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42356 PositiveTimestamp_free(this_obj_conv);
42359 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
42360 LDKPositiveTimestamp a_conv;
42361 a_conv.inner = (void*)(a & (~1));
42362 a_conv.is_owned = false;
42363 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42364 LDKPositiveTimestamp b_conv;
42365 b_conv.inner = (void*)(b & (~1));
42366 b_conv.is_owned = false;
42367 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42368 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
42372 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
42373 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
42374 uint32_t ret_ref = 0;
42375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42378 ret_ref = (uintptr_t)ret_var.inner;
42379 if (ret_var.is_owned) {
42384 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
42385 LDKPositiveTimestamp arg_conv;
42386 arg_conv.inner = (void*)(arg & (~1));
42387 arg_conv.is_owned = false;
42388 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42389 uint32_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
42393 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
42394 LDKPositiveTimestamp orig_conv;
42395 orig_conv.inner = (void*)(orig & (~1));
42396 orig_conv.is_owned = false;
42397 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42398 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
42399 uint32_t ret_ref = 0;
42400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42403 ret_ref = (uintptr_t)ret_var.inner;
42404 if (ret_var.is_owned) {
42410 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
42411 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
42412 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
42416 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
42417 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
42421 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
42422 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
42426 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
42427 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
42431 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
42432 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
42436 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
42437 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
42438 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
42439 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
42443 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
42444 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
42445 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
42449 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
42450 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
42451 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
42455 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
42456 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
42460 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
42461 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
42465 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
42466 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
42470 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
42471 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
42475 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
42476 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
42480 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
42481 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
42482 int64_t ret_conv = Currency_hash(o_conv);
42486 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
42487 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
42488 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
42489 jboolean ret_conv = Currency_eq(a_conv, b_conv);
42493 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
42494 LDKSha256 this_obj_conv;
42495 this_obj_conv.inner = (void*)(this_obj & (~1));
42496 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42498 Sha256_free(this_obj_conv);
42501 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
42502 LDKSha256 ret_var = Sha256_clone(arg);
42503 uint32_t ret_ref = 0;
42504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42507 ret_ref = (uintptr_t)ret_var.inner;
42508 if (ret_var.is_owned) {
42513 uint32_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
42514 LDKSha256 arg_conv;
42515 arg_conv.inner = (void*)(arg & (~1));
42516 arg_conv.is_owned = false;
42517 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42518 uint32_t ret_conv = Sha256_clone_ptr(&arg_conv);
42522 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
42523 LDKSha256 orig_conv;
42524 orig_conv.inner = (void*)(orig & (~1));
42525 orig_conv.is_owned = false;
42526 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42527 LDKSha256 ret_var = Sha256_clone(&orig_conv);
42528 uint32_t ret_ref = 0;
42529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42532 ret_ref = (uintptr_t)ret_var.inner;
42533 if (ret_var.is_owned) {
42539 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
42541 o_conv.inner = (void*)(o & (~1));
42542 o_conv.is_owned = false;
42543 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42544 int64_t ret_conv = Sha256_hash(&o_conv);
42548 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
42550 a_conv.inner = (void*)(a & (~1));
42551 a_conv.is_owned = false;
42552 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42554 b_conv.inner = (void*)(b & (~1));
42555 b_conv.is_owned = false;
42556 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42557 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
42561 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
42562 LDKDescription this_obj_conv;
42563 this_obj_conv.inner = (void*)(this_obj & (~1));
42564 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42566 Description_free(this_obj_conv);
42569 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
42570 LDKDescription ret_var = Description_clone(arg);
42571 uint32_t ret_ref = 0;
42572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42575 ret_ref = (uintptr_t)ret_var.inner;
42576 if (ret_var.is_owned) {
42581 uint32_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
42582 LDKDescription arg_conv;
42583 arg_conv.inner = (void*)(arg & (~1));
42584 arg_conv.is_owned = false;
42585 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42586 uint32_t ret_conv = Description_clone_ptr(&arg_conv);
42590 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
42591 LDKDescription orig_conv;
42592 orig_conv.inner = (void*)(orig & (~1));
42593 orig_conv.is_owned = false;
42594 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42595 LDKDescription ret_var = Description_clone(&orig_conv);
42596 uint32_t ret_ref = 0;
42597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42600 ret_ref = (uintptr_t)ret_var.inner;
42601 if (ret_var.is_owned) {
42607 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
42608 LDKDescription o_conv;
42609 o_conv.inner = (void*)(o & (~1));
42610 o_conv.is_owned = false;
42611 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42612 int64_t ret_conv = Description_hash(&o_conv);
42616 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
42617 LDKDescription a_conv;
42618 a_conv.inner = (void*)(a & (~1));
42619 a_conv.is_owned = false;
42620 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42621 LDKDescription b_conv;
42622 b_conv.inner = (void*)(b & (~1));
42623 b_conv.is_owned = false;
42624 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42625 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
42629 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
42630 LDKPayeePubKey this_obj_conv;
42631 this_obj_conv.inner = (void*)(this_obj & (~1));
42632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42634 PayeePubKey_free(this_obj_conv);
42637 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
42638 LDKPayeePubKey this_ptr_conv;
42639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42640 this_ptr_conv.is_owned = false;
42641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42642 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42643 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
42647 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
42648 LDKPayeePubKey this_ptr_conv;
42649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42650 this_ptr_conv.is_owned = false;
42651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42652 LDKPublicKey val_ref;
42653 CHECK(val->arr_len == 33);
42654 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42655 PayeePubKey_set_a(&this_ptr_conv, val_ref);
42658 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
42659 LDKPublicKey a_arg_ref;
42660 CHECK(a_arg->arr_len == 33);
42661 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
42662 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
42663 uint32_t ret_ref = 0;
42664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42667 ret_ref = (uintptr_t)ret_var.inner;
42668 if (ret_var.is_owned) {
42674 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
42675 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
42676 uint32_t ret_ref = 0;
42677 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42678 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42680 ret_ref = (uintptr_t)ret_var.inner;
42681 if (ret_var.is_owned) {
42686 uint32_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
42687 LDKPayeePubKey arg_conv;
42688 arg_conv.inner = (void*)(arg & (~1));
42689 arg_conv.is_owned = false;
42690 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42691 uint32_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
42695 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
42696 LDKPayeePubKey orig_conv;
42697 orig_conv.inner = (void*)(orig & (~1));
42698 orig_conv.is_owned = false;
42699 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42700 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
42701 uint32_t ret_ref = 0;
42702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42705 ret_ref = (uintptr_t)ret_var.inner;
42706 if (ret_var.is_owned) {
42712 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
42713 LDKPayeePubKey o_conv;
42714 o_conv.inner = (void*)(o & (~1));
42715 o_conv.is_owned = false;
42716 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42717 int64_t ret_conv = PayeePubKey_hash(&o_conv);
42721 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
42722 LDKPayeePubKey a_conv;
42723 a_conv.inner = (void*)(a & (~1));
42724 a_conv.is_owned = false;
42725 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42726 LDKPayeePubKey b_conv;
42727 b_conv.inner = (void*)(b & (~1));
42728 b_conv.is_owned = false;
42729 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42730 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
42734 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
42735 LDKExpiryTime this_obj_conv;
42736 this_obj_conv.inner = (void*)(this_obj & (~1));
42737 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42739 ExpiryTime_free(this_obj_conv);
42742 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
42743 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
42744 uint32_t ret_ref = 0;
42745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42748 ret_ref = (uintptr_t)ret_var.inner;
42749 if (ret_var.is_owned) {
42754 uint32_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
42755 LDKExpiryTime arg_conv;
42756 arg_conv.inner = (void*)(arg & (~1));
42757 arg_conv.is_owned = false;
42758 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42759 uint32_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
42763 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
42764 LDKExpiryTime orig_conv;
42765 orig_conv.inner = (void*)(orig & (~1));
42766 orig_conv.is_owned = false;
42767 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42768 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
42769 uint32_t ret_ref = 0;
42770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42773 ret_ref = (uintptr_t)ret_var.inner;
42774 if (ret_var.is_owned) {
42780 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
42781 LDKExpiryTime o_conv;
42782 o_conv.inner = (void*)(o & (~1));
42783 o_conv.is_owned = false;
42784 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42785 int64_t ret_conv = ExpiryTime_hash(&o_conv);
42789 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
42790 LDKExpiryTime a_conv;
42791 a_conv.inner = (void*)(a & (~1));
42792 a_conv.is_owned = false;
42793 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42794 LDKExpiryTime b_conv;
42795 b_conv.inner = (void*)(b & (~1));
42796 b_conv.is_owned = false;
42797 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42798 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
42802 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
42803 LDKMinFinalCltvExpiry this_obj_conv;
42804 this_obj_conv.inner = (void*)(this_obj & (~1));
42805 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42807 MinFinalCltvExpiry_free(this_obj_conv);
42810 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
42811 LDKMinFinalCltvExpiry this_ptr_conv;
42812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42813 this_ptr_conv.is_owned = false;
42814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42815 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
42819 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
42820 LDKMinFinalCltvExpiry this_ptr_conv;
42821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42822 this_ptr_conv.is_owned = false;
42823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42824 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
42827 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
42828 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
42829 uint32_t ret_ref = 0;
42830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42833 ret_ref = (uintptr_t)ret_var.inner;
42834 if (ret_var.is_owned) {
42840 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
42841 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
42842 uint32_t ret_ref = 0;
42843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42846 ret_ref = (uintptr_t)ret_var.inner;
42847 if (ret_var.is_owned) {
42852 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
42853 LDKMinFinalCltvExpiry arg_conv;
42854 arg_conv.inner = (void*)(arg & (~1));
42855 arg_conv.is_owned = false;
42856 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42857 uint32_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
42861 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
42862 LDKMinFinalCltvExpiry orig_conv;
42863 orig_conv.inner = (void*)(orig & (~1));
42864 orig_conv.is_owned = false;
42865 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42866 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
42867 uint32_t ret_ref = 0;
42868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42871 ret_ref = (uintptr_t)ret_var.inner;
42872 if (ret_var.is_owned) {
42878 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
42879 LDKMinFinalCltvExpiry o_conv;
42880 o_conv.inner = (void*)(o & (~1));
42881 o_conv.is_owned = false;
42882 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42883 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
42887 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
42888 LDKMinFinalCltvExpiry a_conv;
42889 a_conv.inner = (void*)(a & (~1));
42890 a_conv.is_owned = false;
42891 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42892 LDKMinFinalCltvExpiry b_conv;
42893 b_conv.inner = (void*)(b & (~1));
42894 b_conv.is_owned = false;
42895 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42896 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
42900 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
42901 if ((this_ptr & 1) != 0) return;
42902 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42903 CHECK_ACCESS(this_ptr_ptr);
42904 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
42905 FREE((void*)this_ptr);
42906 Fallback_free(this_ptr_conv);
42909 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
42910 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42911 *ret_copy = Fallback_clone(arg);
42912 uint32_t ret_ref = (uintptr_t)ret_copy;
42915 uint32_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
42916 LDKFallback* arg_conv = (LDKFallback*)arg;
42917 uint32_t ret_conv = Fallback_clone_ptr(arg_conv);
42921 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
42922 LDKFallback* orig_conv = (LDKFallback*)orig;
42923 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42924 *ret_copy = Fallback_clone(orig_conv);
42925 uint32_t ret_ref = (uintptr_t)ret_copy;
42929 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
42931 LDKCVec_u8Z program_ref;
42932 program_ref.datalen = program->arr_len;
42933 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
42934 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
42935 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42936 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
42937 uint32_t ret_ref = (uintptr_t)ret_copy;
42941 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
42942 LDKTwentyBytes a_ref;
42943 CHECK(a->arr_len == 20);
42944 memcpy(a_ref.data, a->elems, 20); FREE(a);
42945 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42946 *ret_copy = Fallback_pub_key_hash(a_ref);
42947 uint32_t ret_ref = (uintptr_t)ret_copy;
42951 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
42952 LDKTwentyBytes a_ref;
42953 CHECK(a->arr_len == 20);
42954 memcpy(a_ref.data, a->elems, 20); FREE(a);
42955 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42956 *ret_copy = Fallback_script_hash(a_ref);
42957 uint32_t ret_ref = (uintptr_t)ret_copy;
42961 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
42962 LDKFallback* o_conv = (LDKFallback*)o;
42963 int64_t ret_conv = Fallback_hash(o_conv);
42967 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
42968 LDKFallback* a_conv = (LDKFallback*)a;
42969 LDKFallback* b_conv = (LDKFallback*)b;
42970 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
42974 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
42975 LDKInvoiceSignature this_obj_conv;
42976 this_obj_conv.inner = (void*)(this_obj & (~1));
42977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42979 InvoiceSignature_free(this_obj_conv);
42982 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
42983 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
42984 uint32_t ret_ref = 0;
42985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42988 ret_ref = (uintptr_t)ret_var.inner;
42989 if (ret_var.is_owned) {
42994 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
42995 LDKInvoiceSignature arg_conv;
42996 arg_conv.inner = (void*)(arg & (~1));
42997 arg_conv.is_owned = false;
42998 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42999 uint32_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
43003 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
43004 LDKInvoiceSignature orig_conv;
43005 orig_conv.inner = (void*)(orig & (~1));
43006 orig_conv.is_owned = false;
43007 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43008 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
43009 uint32_t ret_ref = 0;
43010 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43011 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43013 ret_ref = (uintptr_t)ret_var.inner;
43014 if (ret_var.is_owned) {
43020 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
43021 LDKInvoiceSignature a_conv;
43022 a_conv.inner = (void*)(a & (~1));
43023 a_conv.is_owned = false;
43024 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43025 LDKInvoiceSignature b_conv;
43026 b_conv.inner = (void*)(b & (~1));
43027 b_conv.is_owned = false;
43028 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43029 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
43033 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
43034 LDKPrivateRoute this_obj_conv;
43035 this_obj_conv.inner = (void*)(this_obj & (~1));
43036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43038 PrivateRoute_free(this_obj_conv);
43041 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
43042 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
43043 uint32_t ret_ref = 0;
43044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43047 ret_ref = (uintptr_t)ret_var.inner;
43048 if (ret_var.is_owned) {
43053 uint32_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
43054 LDKPrivateRoute arg_conv;
43055 arg_conv.inner = (void*)(arg & (~1));
43056 arg_conv.is_owned = false;
43057 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43058 uint32_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
43062 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
43063 LDKPrivateRoute orig_conv;
43064 orig_conv.inner = (void*)(orig & (~1));
43065 orig_conv.is_owned = false;
43066 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43067 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
43068 uint32_t ret_ref = 0;
43069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43072 ret_ref = (uintptr_t)ret_var.inner;
43073 if (ret_var.is_owned) {
43079 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
43080 LDKPrivateRoute o_conv;
43081 o_conv.inner = (void*)(o & (~1));
43082 o_conv.is_owned = false;
43083 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43084 int64_t ret_conv = PrivateRoute_hash(&o_conv);
43088 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
43089 LDKPrivateRoute a_conv;
43090 a_conv.inner = (void*)(a & (~1));
43091 a_conv.is_owned = false;
43092 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43093 LDKPrivateRoute b_conv;
43094 b_conv.inner = (void*)(b & (~1));
43095 b_conv.is_owned = false;
43096 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43097 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
43101 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
43102 LDKSignedRawInvoice this_arg_conv;
43103 this_arg_conv.inner = (void*)(this_arg & (~1));
43104 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43106 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
43107 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
43108 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
43109 return ((uint32_t)ret_conv);
43112 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
43113 LDKSignedRawInvoice this_arg_conv;
43114 this_arg_conv.inner = (void*)(this_arg & (~1));
43115 this_arg_conv.is_owned = false;
43116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43117 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
43118 uint32_t ret_ref = 0;
43119 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43120 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43122 ret_ref = (uintptr_t)ret_var.inner;
43123 if (ret_var.is_owned) {
43129 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
43130 LDKSignedRawInvoice this_arg_conv;
43131 this_arg_conv.inner = (void*)(this_arg & (~1));
43132 this_arg_conv.is_owned = false;
43133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43134 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43135 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
43139 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
43140 LDKSignedRawInvoice this_arg_conv;
43141 this_arg_conv.inner = (void*)(this_arg & (~1));
43142 this_arg_conv.is_owned = false;
43143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43144 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
43145 uint32_t ret_ref = 0;
43146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43149 ret_ref = (uintptr_t)ret_var.inner;
43150 if (ret_var.is_owned) {
43156 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
43157 LDKSignedRawInvoice this_arg_conv;
43158 this_arg_conv.inner = (void*)(this_arg & (~1));
43159 this_arg_conv.is_owned = false;
43160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43161 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
43162 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
43163 return (uint32_t)ret_conv;
43166 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
43167 LDKSignedRawInvoice this_arg_conv;
43168 this_arg_conv.inner = (void*)(this_arg & (~1));
43169 this_arg_conv.is_owned = false;
43170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43171 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
43175 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
43176 LDKRawInvoice this_arg_conv;
43177 this_arg_conv.inner = (void*)(this_arg & (~1));
43178 this_arg_conv.is_owned = false;
43179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43180 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43181 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
43185 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
43186 LDKRawInvoice this_arg_conv;
43187 this_arg_conv.inner = (void*)(this_arg & (~1));
43188 this_arg_conv.is_owned = false;
43189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43190 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
43191 uint32_t ret_ref = 0;
43192 if ((uintptr_t)ret_var.inner > 4096) {
43193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43196 ret_ref = (uintptr_t)ret_var.inner;
43197 if (ret_var.is_owned) {
43204 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
43205 LDKRawInvoice this_arg_conv;
43206 this_arg_conv.inner = (void*)(this_arg & (~1));
43207 this_arg_conv.is_owned = false;
43208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43209 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
43210 uint32_t ret_ref = 0;
43211 if ((uintptr_t)ret_var.inner > 4096) {
43212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43215 ret_ref = (uintptr_t)ret_var.inner;
43216 if (ret_var.is_owned) {
43223 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
43224 LDKRawInvoice this_arg_conv;
43225 this_arg_conv.inner = (void*)(this_arg & (~1));
43226 this_arg_conv.is_owned = false;
43227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43228 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
43229 uint32_t ret_ref = 0;
43230 if ((uintptr_t)ret_var.inner > 4096) {
43231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43234 ret_ref = (uintptr_t)ret_var.inner;
43235 if (ret_var.is_owned) {
43242 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
43243 LDKRawInvoice this_arg_conv;
43244 this_arg_conv.inner = (void*)(this_arg & (~1));
43245 this_arg_conv.is_owned = false;
43246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43247 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
43248 uint32_t ret_ref = 0;
43249 if ((uintptr_t)ret_var.inner > 4096) {
43250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43253 ret_ref = (uintptr_t)ret_var.inner;
43254 if (ret_var.is_owned) {
43261 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
43262 LDKRawInvoice this_arg_conv;
43263 this_arg_conv.inner = (void*)(this_arg & (~1));
43264 this_arg_conv.is_owned = false;
43265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43266 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
43267 uint32_t ret_ref = 0;
43268 if ((uintptr_t)ret_var.inner > 4096) {
43269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43272 ret_ref = (uintptr_t)ret_var.inner;
43273 if (ret_var.is_owned) {
43280 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
43281 LDKRawInvoice this_arg_conv;
43282 this_arg_conv.inner = (void*)(this_arg & (~1));
43283 this_arg_conv.is_owned = false;
43284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43285 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
43286 uint32_t ret_ref = 0;
43287 if ((uintptr_t)ret_var.inner > 4096) {
43288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43291 ret_ref = (uintptr_t)ret_var.inner;
43292 if (ret_var.is_owned) {
43299 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
43300 LDKRawInvoice this_arg_conv;
43301 this_arg_conv.inner = (void*)(this_arg & (~1));
43302 this_arg_conv.is_owned = false;
43303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43304 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43305 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
43309 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
43310 LDKRawInvoice this_arg_conv;
43311 this_arg_conv.inner = (void*)(this_arg & (~1));
43312 this_arg_conv.is_owned = false;
43313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43314 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
43315 uint32_t ret_ref = 0;
43316 if ((uintptr_t)ret_var.inner > 4096) {
43317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43320 ret_ref = (uintptr_t)ret_var.inner;
43321 if (ret_var.is_owned) {
43328 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
43329 LDKRawInvoice this_arg_conv;
43330 this_arg_conv.inner = (void*)(this_arg & (~1));
43331 this_arg_conv.is_owned = false;
43332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43333 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
43334 uint32_tArray ret_arr = NULL;
43335 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43336 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43337 for (size_t o = 0; o < ret_var.datalen; o++) {
43338 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43339 uint32_t ret_conv_14_ref = 0;
43340 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43341 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43343 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43344 if (ret_conv_14_var.is_owned) {
43345 ret_conv_14_ref |= 1;
43347 ret_arr_ptr[o] = ret_conv_14_ref;
43350 FREE(ret_var.data);
43354 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
43355 LDKRawInvoice this_arg_conv;
43356 this_arg_conv.inner = (void*)(this_arg & (~1));
43357 this_arg_conv.is_owned = false;
43358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43359 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43360 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
43361 uint32_t ret_ref = (uintptr_t)ret_copy;
43365 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
43366 LDKRawInvoice this_arg_conv;
43367 this_arg_conv.inner = (void*)(this_arg & (~1));
43368 this_arg_conv.is_owned = false;
43369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43370 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
43374 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
43375 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43376 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
43377 return (uint32_t)ret_conv;
43380 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
43381 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43382 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
43383 return (uint32_t)ret_conv;
43386 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
43387 LDKPositiveTimestamp this_arg_conv;
43388 this_arg_conv.inner = (void*)(this_arg & (~1));
43389 this_arg_conv.is_owned = false;
43390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43391 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
43395 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
43396 LDKPositiveTimestamp this_arg_conv;
43397 this_arg_conv.inner = (void*)(this_arg & (~1));
43398 this_arg_conv.is_owned = false;
43399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43400 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
43404 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
43405 LDKInvoice this_arg_conv;
43406 this_arg_conv.inner = (void*)(this_arg & (~1));
43407 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43409 this_arg_conv = Invoice_clone(&this_arg_conv);
43410 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
43411 uint32_t ret_ref = 0;
43412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43415 ret_ref = (uintptr_t)ret_var.inner;
43416 if (ret_var.is_owned) {
43422 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
43423 LDKInvoice this_arg_conv;
43424 this_arg_conv.inner = (void*)(this_arg & (~1));
43425 this_arg_conv.is_owned = false;
43426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43427 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
43428 *ret_conv = Invoice_check_signature(&this_arg_conv);
43429 return (uint32_t)ret_conv;
43432 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
43433 LDKSignedRawInvoice signed_invoice_conv;
43434 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
43435 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
43436 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
43437 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
43438 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
43439 *ret_conv = Invoice_from_signed(signed_invoice_conv);
43440 return (uint32_t)ret_conv;
43443 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
43444 LDKInvoice this_arg_conv;
43445 this_arg_conv.inner = (void*)(this_arg & (~1));
43446 this_arg_conv.is_owned = false;
43447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43448 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
43452 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
43453 LDKInvoice this_arg_conv;
43454 this_arg_conv.inner = (void*)(this_arg & (~1));
43455 this_arg_conv.is_owned = false;
43456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43457 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43458 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
43462 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
43463 LDKInvoice this_arg_conv;
43464 this_arg_conv.inner = (void*)(this_arg & (~1));
43465 this_arg_conv.is_owned = false;
43466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43467 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43468 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
43472 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
43473 LDKInvoice this_arg_conv;
43474 this_arg_conv.inner = (void*)(this_arg & (~1));
43475 this_arg_conv.is_owned = false;
43476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43477 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43478 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
43482 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
43483 LDKInvoice this_arg_conv;
43484 this_arg_conv.inner = (void*)(this_arg & (~1));
43485 this_arg_conv.is_owned = false;
43486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43487 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
43488 uint32_t ret_ref = 0;
43489 if ((uintptr_t)ret_var.inner > 4096) {
43490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43493 ret_ref = (uintptr_t)ret_var.inner;
43494 if (ret_var.is_owned) {
43501 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
43502 LDKInvoice this_arg_conv;
43503 this_arg_conv.inner = (void*)(this_arg & (~1));
43504 this_arg_conv.is_owned = false;
43505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43506 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43507 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
43511 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
43512 LDKInvoice this_arg_conv;
43513 this_arg_conv.inner = (void*)(this_arg & (~1));
43514 this_arg_conv.is_owned = false;
43515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43516 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
43520 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
43521 LDKInvoice this_arg_conv;
43522 this_arg_conv.inner = (void*)(this_arg & (~1));
43523 this_arg_conv.is_owned = false;
43524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43525 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
43529 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
43530 LDKInvoice this_arg_conv;
43531 this_arg_conv.inner = (void*)(this_arg & (~1));
43532 this_arg_conv.is_owned = false;
43533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43534 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
43538 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
43539 LDKInvoice this_arg_conv;
43540 this_arg_conv.inner = (void*)(this_arg & (~1));
43541 this_arg_conv.is_owned = false;
43542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43543 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
43544 uint32_tArray ret_arr = NULL;
43545 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43546 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43547 for (size_t o = 0; o < ret_var.datalen; o++) {
43548 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43549 uint32_t ret_conv_14_ref = 0;
43550 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43551 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43553 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43554 if (ret_conv_14_var.is_owned) {
43555 ret_conv_14_ref |= 1;
43557 ret_arr_ptr[o] = ret_conv_14_ref;
43560 FREE(ret_var.data);
43564 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
43565 LDKInvoice this_arg_conv;
43566 this_arg_conv.inner = (void*)(this_arg & (~1));
43567 this_arg_conv.is_owned = false;
43568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43569 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
43570 uint32_tArray ret_arr = NULL;
43571 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43572 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43573 for (size_t l = 0; l < ret_var.datalen; l++) {
43574 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43575 uint32_t ret_conv_11_ref = 0;
43576 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43577 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43579 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
43580 if (ret_conv_11_var.is_owned) {
43581 ret_conv_11_ref |= 1;
43583 ret_arr_ptr[l] = ret_conv_11_ref;
43586 FREE(ret_var.data);
43590 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
43591 LDKInvoice this_arg_conv;
43592 this_arg_conv.inner = (void*)(this_arg & (~1));
43593 this_arg_conv.is_owned = false;
43594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43595 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
43599 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
43600 LDKInvoice this_arg_conv;
43601 this_arg_conv.inner = (void*)(this_arg & (~1));
43602 this_arg_conv.is_owned = false;
43603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43604 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43605 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
43606 uint32_t ret_ref = (uintptr_t)ret_copy;
43610 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
43611 LDKStr description_conv = str_ref_to_owned_c(description);
43612 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
43613 *ret_conv = Description_new(description_conv);
43614 return (uint32_t)ret_conv;
43617 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
43618 LDKDescription this_arg_conv;
43619 this_arg_conv.inner = (void*)(this_arg & (~1));
43620 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43622 this_arg_conv = Description_clone(&this_arg_conv);
43623 LDKStr ret_str = Description_into_inner(this_arg_conv);
43624 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43629 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
43630 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
43631 uint32_t ret_ref = 0;
43632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43635 ret_ref = (uintptr_t)ret_var.inner;
43636 if (ret_var.is_owned) {
43642 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
43643 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
43644 uint32_t ret_ref = 0;
43645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43648 ret_ref = (uintptr_t)ret_var.inner;
43649 if (ret_var.is_owned) {
43655 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
43656 LDKExpiryTime this_arg_conv;
43657 this_arg_conv.inner = (void*)(this_arg & (~1));
43658 this_arg_conv.is_owned = false;
43659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43660 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
43664 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
43665 LDKExpiryTime this_arg_conv;
43666 this_arg_conv.inner = (void*)(this_arg & (~1));
43667 this_arg_conv.is_owned = false;
43668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43669 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
43673 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
43674 LDKRouteHint hops_conv;
43675 hops_conv.inner = (void*)(hops & (~1));
43676 hops_conv.is_owned = (hops & 1) || (hops == 0);
43677 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
43678 hops_conv = RouteHint_clone(&hops_conv);
43679 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
43680 *ret_conv = PrivateRoute_new(hops_conv);
43681 return (uint32_t)ret_conv;
43684 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
43685 LDKPrivateRoute this_arg_conv;
43686 this_arg_conv.inner = (void*)(this_arg & (~1));
43687 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43689 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
43690 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
43691 uint32_t ret_ref = 0;
43692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43695 ret_ref = (uintptr_t)ret_var.inner;
43696 if (ret_var.is_owned) {
43702 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
43703 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
43704 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
43708 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
43709 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
43713 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
43714 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
43718 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
43719 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
43723 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
43724 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
43728 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
43729 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
43733 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
43734 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
43735 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
43736 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
43740 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
43741 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
43742 LDKStr ret_str = CreationError_to_str(o_conv);
43743 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43748 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
43749 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
43750 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
43754 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
43755 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
43759 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
43760 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
43764 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
43765 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
43769 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
43770 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
43774 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
43775 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
43779 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
43780 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
43784 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
43785 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
43789 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
43790 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
43794 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
43795 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
43799 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
43800 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
43804 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
43805 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
43806 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
43807 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
43811 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
43812 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
43813 LDKStr ret_str = SemanticError_to_str(o_conv);
43814 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43819 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
43820 if ((this_ptr & 1) != 0) return;
43821 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43822 CHECK_ACCESS(this_ptr_ptr);
43823 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
43824 FREE((void*)this_ptr);
43825 SignOrCreationError_free(this_ptr_conv);
43828 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
43829 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43830 *ret_copy = SignOrCreationError_clone(arg);
43831 uint32_t ret_ref = (uintptr_t)ret_copy;
43834 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
43835 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
43836 uint32_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
43840 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
43841 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
43842 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43843 *ret_copy = SignOrCreationError_clone(orig_conv);
43844 uint32_t ret_ref = (uintptr_t)ret_copy;
43848 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
43849 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43850 *ret_copy = SignOrCreationError_sign_error();
43851 uint32_t ret_ref = (uintptr_t)ret_copy;
43855 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
43856 LDKCreationError a_conv = LDKCreationError_from_js(a);
43857 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43858 *ret_copy = SignOrCreationError_creation_error(a_conv);
43859 uint32_t ret_ref = (uintptr_t)ret_copy;
43863 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
43864 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
43865 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
43866 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
43870 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
43871 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
43872 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
43873 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43878 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
43879 LDKInvoicePayer this_obj_conv;
43880 this_obj_conv.inner = (void*)(this_obj & (~1));
43881 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43883 InvoicePayer_free(this_obj_conv);
43886 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
43887 if ((this_ptr & 1) != 0) return;
43888 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43889 CHECK_ACCESS(this_ptr_ptr);
43890 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
43891 FREE((void*)this_ptr);
43892 Payer_free(this_ptr_conv);
43895 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
43896 if ((this_ptr & 1) != 0) return;
43897 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43898 CHECK_ACCESS(this_ptr_ptr);
43899 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43900 FREE((void*)this_ptr);
43901 Router_free(this_ptr_conv);
43904 void __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint32_t this_ptr) {
43905 if ((this_ptr & 1) != 0) return;
43906 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43907 CHECK_ACCESS(this_ptr_ptr);
43908 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
43909 FREE((void*)this_ptr);
43910 Retry_free(this_ptr_conv);
43913 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
43914 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43915 *ret_copy = Retry_clone(arg);
43916 uint32_t ret_ref = (uintptr_t)ret_copy;
43919 uint32_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint32_t arg) {
43920 LDKRetry* arg_conv = (LDKRetry*)arg;
43921 uint32_t ret_conv = Retry_clone_ptr(arg_conv);
43925 uint32_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint32_t orig) {
43926 LDKRetry* orig_conv = (LDKRetry*)orig;
43927 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43928 *ret_copy = Retry_clone(orig_conv);
43929 uint32_t ret_ref = (uintptr_t)ret_copy;
43933 uint32_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
43934 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43935 *ret_copy = Retry_attempts(a);
43936 uint32_t ret_ref = (uintptr_t)ret_copy;
43940 jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint32_t a, uint32_t b) {
43941 LDKRetry* a_conv = (LDKRetry*)a;
43942 LDKRetry* b_conv = (LDKRetry*)b;
43943 jboolean ret_conv = Retry_eq(a_conv, b_conv);
43947 int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint32_t o) {
43948 LDKRetry* o_conv = (LDKRetry*)o;
43949 int64_t ret_conv = Retry_hash(o_conv);
43953 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
43954 if ((this_ptr & 1) != 0) return;
43955 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43956 CHECK_ACCESS(this_ptr_ptr);
43957 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
43958 FREE((void*)this_ptr);
43959 PaymentError_free(this_ptr_conv);
43962 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
43963 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43964 *ret_copy = PaymentError_clone(arg);
43965 uint32_t ret_ref = (uintptr_t)ret_copy;
43968 uint32_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
43969 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
43970 uint32_t ret_conv = PaymentError_clone_ptr(arg_conv);
43974 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
43975 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
43976 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43977 *ret_copy = PaymentError_clone(orig_conv);
43978 uint32_t ret_ref = (uintptr_t)ret_copy;
43982 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
43983 LDKStr a_conv = str_ref_to_owned_c(a);
43984 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43985 *ret_copy = PaymentError_invoice(a_conv);
43986 uint32_t ret_ref = (uintptr_t)ret_copy;
43990 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
43991 LDKLightningError a_conv;
43992 a_conv.inner = (void*)(a & (~1));
43993 a_conv.is_owned = (a & 1) || (a == 0);
43994 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43995 a_conv = LightningError_clone(&a_conv);
43996 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43997 *ret_copy = PaymentError_routing(a_conv);
43998 uint32_t ret_ref = (uintptr_t)ret_copy;
44002 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
44003 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
44004 CHECK_ACCESS(a_ptr);
44005 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
44006 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
44007 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44008 *ret_copy = PaymentError_sending(a_conv);
44009 uint32_t ret_ref = (uintptr_t)ret_copy;
44013 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) {
44014 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
44015 CHECK_ACCESS(payer_ptr);
44016 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
44017 if (payer_conv.free == LDKPayer_JCalls_free) {
44018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44019 LDKPayer_JCalls_cloned(&payer_conv);
44021 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
44022 CHECK_ACCESS(router_ptr);
44023 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
44024 if (router_conv.free == LDKRouter_JCalls_free) {
44025 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44026 LDKRouter_JCalls_cloned(&router_conv);
44028 LDKMultiThreadedLockableScore scorer_conv;
44029 scorer_conv.inner = (void*)(scorer & (~1));
44030 scorer_conv.is_owned = false;
44031 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
44032 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44033 CHECK_ACCESS(logger_ptr);
44034 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44035 if (logger_conv.free == LDKLogger_JCalls_free) {
44036 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44037 LDKLogger_JCalls_cloned(&logger_conv);
44039 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
44040 CHECK_ACCESS(event_handler_ptr);
44041 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
44042 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
44043 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44044 LDKEventHandler_JCalls_cloned(&event_handler_conv);
44046 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
44047 CHECK_ACCESS(retry_ptr);
44048 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
44049 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
44050 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
44051 uint32_t ret_ref = 0;
44052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44055 ret_ref = (uintptr_t)ret_var.inner;
44056 if (ret_var.is_owned) {
44062 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
44063 LDKInvoicePayer this_arg_conv;
44064 this_arg_conv.inner = (void*)(this_arg & (~1));
44065 this_arg_conv.is_owned = false;
44066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44067 LDKInvoice invoice_conv;
44068 invoice_conv.inner = (void*)(invoice & (~1));
44069 invoice_conv.is_owned = false;
44070 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44071 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44072 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
44073 return (uint32_t)ret_conv;
44076 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) {
44077 LDKInvoicePayer this_arg_conv;
44078 this_arg_conv.inner = (void*)(this_arg & (~1));
44079 this_arg_conv.is_owned = false;
44080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44081 LDKInvoice invoice_conv;
44082 invoice_conv.inner = (void*)(invoice & (~1));
44083 invoice_conv.is_owned = false;
44084 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44085 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44086 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
44087 return (uint32_t)ret_conv;
44090 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) {
44091 LDKInvoicePayer this_arg_conv;
44092 this_arg_conv.inner = (void*)(this_arg & (~1));
44093 this_arg_conv.is_owned = false;
44094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44095 LDKPublicKey pubkey_ref;
44096 CHECK(pubkey->arr_len == 33);
44097 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
44098 LDKThirtyTwoBytes payment_preimage_ref;
44099 CHECK(payment_preimage->arr_len == 32);
44100 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
44101 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44102 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
44103 return (uint32_t)ret_conv;
44106 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
44107 LDKInvoicePayer this_arg_conv;
44108 this_arg_conv.inner = (void*)(this_arg & (~1));
44109 this_arg_conv.is_owned = false;
44110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44111 unsigned char payment_hash_arr[32];
44112 CHECK(payment_hash->arr_len == 32);
44113 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
44114 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
44115 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
44118 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
44119 LDKInvoicePayer this_arg_conv;
44120 this_arg_conv.inner = (void*)(this_arg & (~1));
44121 this_arg_conv.is_owned = false;
44122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44123 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
44124 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
44125 return (uint32_t)ret_ret;
44128 uint32_t __attribute__((export_name("TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(uint32_t channelmanager, uint32_t keys_manager, uint32_t network, uint32_t amt_msat, uint32_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
44129 LDKChannelManager channelmanager_conv;
44130 channelmanager_conv.inner = (void*)(channelmanager & (~1));
44131 channelmanager_conv.is_owned = false;
44132 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
44133 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
44134 CHECK_ACCESS(keys_manager_ptr);
44135 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44136 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44137 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44138 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44140 LDKCurrency network_conv = LDKCurrency_from_js(network);
44141 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
44142 CHECK_ACCESS(amt_msat_ptr);
44143 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
44144 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
44145 LDKSha256 description_hash_conv;
44146 description_hash_conv.inner = (void*)(description_hash & (~1));
44147 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
44148 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
44149 description_hash_conv = Sha256_clone(&description_hash_conv);
44150 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
44151 *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs);
44152 return (uint32_t)ret_conv;
44155 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, int32_t invoice_expiry_delta_secs) {
44156 LDKChannelManager channelmanager_conv;
44157 channelmanager_conv.inner = (void*)(channelmanager & (~1));
44158 channelmanager_conv.is_owned = false;
44159 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
44160 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
44161 CHECK_ACCESS(keys_manager_ptr);
44162 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44163 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44164 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44165 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44167 LDKCurrency network_conv = LDKCurrency_from_js(network);
44168 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
44169 CHECK_ACCESS(amt_msat_ptr);
44170 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
44171 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
44172 LDKStr description_conv = str_ref_to_owned_c(description);
44173 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
44174 *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, invoice_expiry_delta_secs);
44175 return (uint32_t)ret_conv;
44178 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
44179 LDKDefaultRouter this_obj_conv;
44180 this_obj_conv.inner = (void*)(this_obj & (~1));
44181 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44183 DefaultRouter_free(this_obj_conv);
44186 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger, int8_tArray random_seed_bytes) {
44187 LDKNetworkGraph network_graph_conv;
44188 network_graph_conv.inner = (void*)(network_graph & (~1));
44189 network_graph_conv.is_owned = false;
44190 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44191 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44192 CHECK_ACCESS(logger_ptr);
44193 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44194 if (logger_conv.free == LDKLogger_JCalls_free) {
44195 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44196 LDKLogger_JCalls_cloned(&logger_conv);
44198 LDKThirtyTwoBytes random_seed_bytes_ref;
44199 CHECK(random_seed_bytes->arr_len == 32);
44200 memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
44201 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
44202 uint32_t ret_ref = 0;
44203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44206 ret_ref = (uintptr_t)ret_var.inner;
44207 if (ret_var.is_owned) {
44213 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
44214 LDKDefaultRouter this_arg_conv;
44215 this_arg_conv.inner = (void*)(this_arg & (~1));
44216 this_arg_conv.is_owned = false;
44217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44218 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44219 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44220 return (uint32_t)ret_ret;
44223 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
44224 LDKChannelManager this_arg_conv;
44225 this_arg_conv.inner = (void*)(this_arg & (~1));
44226 this_arg_conv.is_owned = false;
44227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44228 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
44229 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
44230 return (uint32_t)ret_ret;
44233 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
44234 LDKStr s_conv = str_ref_to_owned_c(s);
44235 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
44236 *ret_conv = SiPrefix_from_str(s_conv);
44237 return (uint32_t)ret_conv;
44240 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
44241 LDKStr s_conv = str_ref_to_owned_c(s);
44242 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
44243 *ret_conv = Invoice_from_str(s_conv);
44244 return (uint32_t)ret_conv;
44247 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
44248 LDKStr s_conv = str_ref_to_owned_c(s);
44249 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
44250 *ret_conv = SignedRawInvoice_from_str(s_conv);
44251 return (uint32_t)ret_conv;
44254 jstring __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint32_t o) {
44255 LDKParseError* o_conv = (LDKParseError*)o;
44256 LDKStr ret_str = ParseError_to_str(o_conv);
44257 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44262 jstring __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint32_t o) {
44263 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
44264 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
44265 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44270 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
44272 o_conv.inner = (void*)(o & (~1));
44273 o_conv.is_owned = false;
44274 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44275 LDKStr ret_str = Invoice_to_str(&o_conv);
44276 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44281 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
44282 LDKSignedRawInvoice o_conv;
44283 o_conv.inner = (void*)(o & (~1));
44284 o_conv.is_owned = false;
44285 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44286 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
44287 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44292 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
44293 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
44294 LDKStr ret_str = Currency_to_str(o_conv);
44295 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44300 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
44301 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
44302 LDKStr ret_str = SiPrefix_to_str(o_conv);
44303 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);