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 LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1138 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1139 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1142 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1143 CHECK(owner->result_ok);
1144 return PaymentParameters_clone(&*owner->contents.result);
1146 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint32_t owner) {
1147 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1148 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1149 uint32_t ret_ref = 0;
1150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1153 ret_ref = (uintptr_t)ret_var.inner;
1154 if (ret_var.is_owned) {
1160 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1161 CHECK(!owner->result_ok);
1162 return DecodeError_clone(&*owner->contents.err);
1164 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint32_t owner) {
1165 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1166 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1167 uint32_t ret_ref = 0;
1168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1171 ret_ref = (uintptr_t)ret_var.inner;
1172 if (ret_var.is_owned) {
1178 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1179 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1180 for (size_t i = 0; i < ret.datalen; i++) {
1181 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1185 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1186 CHECK(owner->result_ok);
1187 return RouteHint_clone(&*owner->contents.result);
1189 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
1190 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1191 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1192 uint32_t ret_ref = 0;
1193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1196 ret_ref = (uintptr_t)ret_var.inner;
1197 if (ret_var.is_owned) {
1203 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1204 CHECK(!owner->result_ok);
1205 return DecodeError_clone(&*owner->contents.err);
1207 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
1208 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1209 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1210 uint32_t ret_ref = 0;
1211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1214 ret_ref = (uintptr_t)ret_var.inner;
1215 if (ret_var.is_owned) {
1221 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1222 CHECK(owner->result_ok);
1223 return RouteHintHop_clone(&*owner->contents.result);
1225 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
1226 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1227 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1228 uint32_t ret_ref = 0;
1229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1232 ret_ref = (uintptr_t)ret_var.inner;
1233 if (ret_var.is_owned) {
1239 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1240 CHECK(!owner->result_ok);
1241 return DecodeError_clone(&*owner->contents.err);
1243 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
1244 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1245 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1246 uint32_t ret_ref = 0;
1247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1250 ret_ref = (uintptr_t)ret_var.inner;
1251 if (ret_var.is_owned) {
1257 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1258 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1259 for (size_t i = 0; i < ret.datalen; i++) {
1260 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1264 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1265 CHECK(owner->result_ok);
1266 return Route_clone(&*owner->contents.result);
1268 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
1269 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1270 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1271 uint32_t ret_ref = 0;
1272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1275 ret_ref = (uintptr_t)ret_var.inner;
1276 if (ret_var.is_owned) {
1282 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1283 CHECK(!owner->result_ok);
1284 return LightningError_clone(&*owner->contents.err);
1286 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
1287 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1288 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1289 uint32_t ret_ref = 0;
1290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1293 ret_ref = (uintptr_t)ret_var.inner;
1294 if (ret_var.is_owned) {
1300 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1301 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1303 case LDKPaymentPurpose_InvoicePayment: return 0;
1304 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1308 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1309 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1310 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1311 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1312 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1313 return payment_preimage_arr;
1315 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1316 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1317 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1318 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1319 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1320 return payment_secret_arr;
1322 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1323 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1324 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1325 int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1326 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1327 return spontaneous_payment_arr;
1329 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1330 CHECK(owner->result_ok);
1331 return PaymentPurpose_clone(&*owner->contents.result);
1333 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint32_t owner) {
1334 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1335 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1336 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1337 uint32_t ret_ref = (uintptr_t)ret_copy;
1341 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1342 CHECK(!owner->result_ok);
1343 return DecodeError_clone(&*owner->contents.err);
1345 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint32_t owner) {
1346 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1347 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1348 uint32_t ret_ref = 0;
1349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1352 ret_ref = (uintptr_t)ret_var.inner;
1353 if (ret_var.is_owned) {
1359 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1360 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1362 case LDKClosureReason_CounterpartyForceClosed: return 0;
1363 case LDKClosureReason_HolderForceClosed: return 1;
1364 case LDKClosureReason_CooperativeClosure: return 2;
1365 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1366 case LDKClosureReason_FundingTimedOut: return 4;
1367 case LDKClosureReason_ProcessingError: return 5;
1368 case LDKClosureReason_DisconnectedPeer: return 6;
1369 case LDKClosureReason_OutdatedChannelManager: return 7;
1373 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1374 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1375 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1376 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1377 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1378 return peer_msg_conv;
1380 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1381 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1382 assert(obj->tag == LDKClosureReason_ProcessingError);
1383 LDKStr err_str = obj->processing_error.err;
1384 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1387 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
1388 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1390 case LDKCOption_ClosureReasonZ_Some: return 0;
1391 case LDKCOption_ClosureReasonZ_None: return 1;
1395 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
1396 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1397 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1398 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1401 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1402 CHECK(owner->result_ok);
1403 return COption_ClosureReasonZ_clone(&*owner->contents.result);
1405 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
1406 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1407 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1408 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1409 uint32_t ret_ref = (uintptr_t)ret_copy;
1413 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1414 CHECK(!owner->result_ok);
1415 return DecodeError_clone(&*owner->contents.err);
1417 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
1418 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1419 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1420 uint32_t ret_ref = 0;
1421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1424 ret_ref = (uintptr_t)ret_var.inner;
1425 if (ret_var.is_owned) {
1431 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint32_t ptr) {
1432 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
1434 case LDKHTLCDestination_NextHopChannel: return 0;
1435 case LDKHTLCDestination_UnknownNextHop: return 1;
1436 case LDKHTLCDestination_FailedPayment: return 2;
1440 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint32_t ptr) {
1441 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
1442 assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1443 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1444 memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1447 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint32_t ptr) {
1448 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
1449 assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1450 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1451 memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1452 return channel_id_arr;
1454 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint32_t ptr) {
1455 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
1456 assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1457 int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1458 return requested_forward_scid_conv;
1460 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint32_t ptr) {
1461 LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
1462 assert(obj->tag == LDKHTLCDestination_FailedPayment);
1463 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1464 memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1465 return payment_hash_arr;
1467 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint32_t ptr) {
1468 LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1);
1470 case LDKCOption_HTLCDestinationZ_Some: return 0;
1471 case LDKCOption_HTLCDestinationZ_None: return 1;
1475 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint32_t ptr) {
1476 LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1);
1477 assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1478 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1481 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1482 CHECK(owner->result_ok);
1483 return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1485 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint32_t owner) {
1486 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
1487 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1488 *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1489 uint32_t ret_ref = (uintptr_t)ret_copy;
1493 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1494 CHECK(!owner->result_ok);
1495 return DecodeError_clone(&*owner->contents.err);
1497 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint32_t owner) {
1498 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
1499 LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1500 uint32_t ret_ref = 0;
1501 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1502 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1503 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1504 ret_ref = (uintptr_t)ret_var.inner;
1505 if (ret_var.is_owned) {
1511 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1512 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1514 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1515 case LDKNetworkUpdate_ChannelFailure: return 1;
1516 case LDKNetworkUpdate_NodeFailure: return 2;
1520 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1521 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1522 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1523 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1524 uint32_t msg_ref = 0;
1525 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1526 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1527 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1528 msg_ref = (uintptr_t)msg_var.inner & ~1;
1531 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint32_t ptr) {
1532 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1533 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1534 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1535 return short_channel_id_conv;
1537 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint32_t ptr) {
1538 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1539 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1540 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1541 return is_permanent_conv;
1543 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1544 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1545 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1546 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1547 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1550 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1551 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1552 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1553 jboolean is_permanent_conv = obj->node_failure.is_permanent;
1554 return is_permanent_conv;
1556 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1557 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1559 case LDKCOption_NetworkUpdateZ_Some: return 0;
1560 case LDKCOption_NetworkUpdateZ_None: return 1;
1564 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1565 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1566 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1567 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1570 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1571 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1573 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1574 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1575 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1579 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1580 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1581 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1582 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1583 uint32_t outpoint_ref = 0;
1584 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1585 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1586 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1587 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
1588 return outpoint_ref;
1590 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1591 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1592 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1593 uint32_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1594 return (uint32_t)output_ref;
1596 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1597 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1598 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1599 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1600 uint32_t delayed_payment_output_ref = 0;
1601 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1602 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1603 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1604 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
1605 return delayed_payment_output_ref;
1607 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1608 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1609 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1610 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1611 uint32_t static_payment_output_ref = 0;
1612 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1613 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1614 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1615 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
1616 return static_payment_output_ref;
1618 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1619 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1620 for (size_t i = 0; i < ret.datalen; i++) {
1621 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1625 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1626 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1628 case LDKEvent_FundingGenerationReady: return 0;
1629 case LDKEvent_PaymentReceived: return 1;
1630 case LDKEvent_PaymentClaimed: return 2;
1631 case LDKEvent_PaymentSent: return 3;
1632 case LDKEvent_PaymentFailed: return 4;
1633 case LDKEvent_PaymentPathSuccessful: return 5;
1634 case LDKEvent_PaymentPathFailed: return 6;
1635 case LDKEvent_ProbeSuccessful: return 7;
1636 case LDKEvent_ProbeFailed: return 8;
1637 case LDKEvent_PendingHTLCsForwardable: return 9;
1638 case LDKEvent_SpendableOutputs: return 10;
1639 case LDKEvent_PaymentForwarded: return 11;
1640 case LDKEvent_ChannelClosed: return 12;
1641 case LDKEvent_DiscardFunding: return 13;
1642 case LDKEvent_OpenChannelRequest: return 14;
1643 case LDKEvent_HTLCHandlingFailed: return 15;
1647 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1648 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1649 assert(obj->tag == LDKEvent_FundingGenerationReady);
1650 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1651 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1652 return temporary_channel_id_arr;
1654 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint32_t ptr) {
1655 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1656 assert(obj->tag == LDKEvent_FundingGenerationReady);
1657 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1658 memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1659 return counterparty_node_id_arr;
1661 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1662 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1663 assert(obj->tag == LDKEvent_FundingGenerationReady);
1664 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1665 return channel_value_satoshis_conv;
1667 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1668 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1669 assert(obj->tag == LDKEvent_FundingGenerationReady);
1670 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1671 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1672 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1673 return output_script_arr;
1675 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1676 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1677 assert(obj->tag == LDKEvent_FundingGenerationReady);
1678 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1679 return user_channel_id_conv;
1681 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1682 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1683 assert(obj->tag == LDKEvent_PaymentReceived);
1684 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1685 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1686 return payment_hash_arr;
1688 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint32_t ptr) {
1689 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1690 assert(obj->tag == LDKEvent_PaymentReceived);
1691 int64_t amount_msat_conv = obj->payment_received.amount_msat;
1692 return amount_msat_conv;
1694 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1695 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1696 assert(obj->tag == LDKEvent_PaymentReceived);
1697 uint32_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
1700 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint32_t ptr) {
1701 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1702 assert(obj->tag == LDKEvent_PaymentClaimed);
1703 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1704 memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1705 return payment_hash_arr;
1707 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint32_t ptr) {
1708 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1709 assert(obj->tag == LDKEvent_PaymentClaimed);
1710 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1711 return amount_msat_conv;
1713 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint32_t ptr) {
1714 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1715 assert(obj->tag == LDKEvent_PaymentClaimed);
1716 uint32_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
1719 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1720 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1721 assert(obj->tag == LDKEvent_PaymentSent);
1722 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1723 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1724 return payment_id_arr;
1726 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1727 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1728 assert(obj->tag == LDKEvent_PaymentSent);
1729 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1730 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1731 return payment_preimage_arr;
1733 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1734 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1735 assert(obj->tag == LDKEvent_PaymentSent);
1736 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1737 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1738 return payment_hash_arr;
1740 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1741 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1742 assert(obj->tag == LDKEvent_PaymentSent);
1743 uint32_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
1744 return fee_paid_msat_ref;
1746 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1747 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1748 assert(obj->tag == LDKEvent_PaymentFailed);
1749 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1750 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1751 return payment_id_arr;
1753 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1754 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1755 assert(obj->tag == LDKEvent_PaymentFailed);
1756 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1757 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1758 return payment_hash_arr;
1760 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1761 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1762 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1763 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1764 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1765 return payment_id_arr;
1767 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1768 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1769 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1770 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1771 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1772 return payment_hash_arr;
1774 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1775 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1776 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1777 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1778 uint32_tArray path_arr = NULL;
1779 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1780 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1781 for (size_t k = 0; k < path_var.datalen; k++) {
1782 LDKRouteHop path_conv_10_var = path_var.data[k];
1783 uint32_t path_conv_10_ref = 0;
1784 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1785 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1786 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1787 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1788 path_arr_ptr[k] = path_conv_10_ref;
1793 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1794 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1795 assert(obj->tag == LDKEvent_PaymentPathFailed);
1796 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1797 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1798 return payment_id_arr;
1800 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1801 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1802 assert(obj->tag == LDKEvent_PaymentPathFailed);
1803 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1804 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1805 return payment_hash_arr;
1807 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1808 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1809 assert(obj->tag == LDKEvent_PaymentPathFailed);
1810 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1811 return rejected_by_dest_conv;
1813 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1814 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1815 assert(obj->tag == LDKEvent_PaymentPathFailed);
1816 uint32_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
1817 return network_update_ref;
1819 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1820 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1821 assert(obj->tag == LDKEvent_PaymentPathFailed);
1822 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1823 return all_paths_failed_conv;
1825 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1826 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1827 assert(obj->tag == LDKEvent_PaymentPathFailed);
1828 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1829 uint32_tArray path_arr = NULL;
1830 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1831 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1832 for (size_t k = 0; k < path_var.datalen; k++) {
1833 LDKRouteHop path_conv_10_var = path_var.data[k];
1834 uint32_t path_conv_10_ref = 0;
1835 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1836 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1837 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1838 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1839 path_arr_ptr[k] = path_conv_10_ref;
1844 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1845 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1846 assert(obj->tag == LDKEvent_PaymentPathFailed);
1847 uint32_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
1848 return short_channel_id_ref;
1850 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1851 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1852 assert(obj->tag == LDKEvent_PaymentPathFailed);
1853 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1854 uint32_t retry_ref = 0;
1855 if ((uintptr_t)retry_var.inner > 4096) {
1856 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1857 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1858 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1859 retry_ref = (uintptr_t)retry_var.inner & ~1;
1863 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint32_t ptr) {
1864 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1865 assert(obj->tag == LDKEvent_ProbeSuccessful);
1866 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1867 memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1868 return payment_id_arr;
1870 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint32_t ptr) {
1871 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1872 assert(obj->tag == LDKEvent_ProbeSuccessful);
1873 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1874 memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1875 return payment_hash_arr;
1877 uint32_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint32_t ptr) {
1878 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1879 assert(obj->tag == LDKEvent_ProbeSuccessful);
1880 LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1881 uint32_tArray path_arr = NULL;
1882 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1883 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1884 for (size_t k = 0; k < path_var.datalen; k++) {
1885 LDKRouteHop path_conv_10_var = path_var.data[k];
1886 uint32_t path_conv_10_ref = 0;
1887 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1888 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1889 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1890 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1891 path_arr_ptr[k] = path_conv_10_ref;
1896 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint32_t ptr) {
1897 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1898 assert(obj->tag == LDKEvent_ProbeFailed);
1899 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1900 memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1901 return payment_id_arr;
1903 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint32_t ptr) {
1904 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1905 assert(obj->tag == LDKEvent_ProbeFailed);
1906 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1907 memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1908 return payment_hash_arr;
1910 uint32_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint32_t ptr) {
1911 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1912 assert(obj->tag == LDKEvent_ProbeFailed);
1913 LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1914 uint32_tArray path_arr = NULL;
1915 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1916 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1917 for (size_t k = 0; k < path_var.datalen; k++) {
1918 LDKRouteHop path_conv_10_var = path_var.data[k];
1919 uint32_t path_conv_10_ref = 0;
1920 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1921 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1922 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1923 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1924 path_arr_ptr[k] = path_conv_10_ref;
1929 uint32_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint32_t ptr) {
1930 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1931 assert(obj->tag == LDKEvent_ProbeFailed);
1932 uint32_t short_channel_id_ref = ((uintptr_t)&obj->probe_failed.short_channel_id) | 1;
1933 return short_channel_id_ref;
1935 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1936 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1937 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1938 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1939 return time_forwardable_conv;
1941 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1942 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1943 assert(obj->tag == LDKEvent_SpendableOutputs);
1944 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1945 uint32_tArray outputs_arr = NULL;
1946 outputs_arr = init_uint32_tArray(outputs_var.datalen, __LINE__);
1947 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1948 for (size_t b = 0; b < outputs_var.datalen; b++) {
1949 uint32_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
1950 outputs_arr_ptr[b] = outputs_conv_27_ref;
1955 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint32_t ptr) {
1956 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1957 assert(obj->tag == LDKEvent_PaymentForwarded);
1958 int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1959 memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1960 return prev_channel_id_arr;
1962 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint32_t ptr) {
1963 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1964 assert(obj->tag == LDKEvent_PaymentForwarded);
1965 int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1966 memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1967 return next_channel_id_arr;
1969 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1970 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1971 assert(obj->tag == LDKEvent_PaymentForwarded);
1972 uint32_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1973 return fee_earned_msat_ref;
1975 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1976 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1977 assert(obj->tag == LDKEvent_PaymentForwarded);
1978 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1979 return claim_from_onchain_tx_conv;
1981 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1982 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1983 assert(obj->tag == LDKEvent_ChannelClosed);
1984 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1985 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1986 return channel_id_arr;
1988 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1989 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1990 assert(obj->tag == LDKEvent_ChannelClosed);
1991 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1992 return user_channel_id_conv;
1994 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1995 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1996 assert(obj->tag == LDKEvent_ChannelClosed);
1997 uint32_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2000 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
2001 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2002 assert(obj->tag == LDKEvent_DiscardFunding);
2003 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2004 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2005 return channel_id_arr;
2007 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
2008 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2009 assert(obj->tag == LDKEvent_DiscardFunding);
2010 LDKTransaction transaction_var = obj->discard_funding.transaction;
2011 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2012 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2013 return transaction_arr;
2015 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint32_t ptr) {
2016 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2017 assert(obj->tag == LDKEvent_OpenChannelRequest);
2018 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2019 memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2020 return temporary_channel_id_arr;
2022 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint32_t ptr) {
2023 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2024 assert(obj->tag == LDKEvent_OpenChannelRequest);
2025 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2026 memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2027 return counterparty_node_id_arr;
2029 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint32_t ptr) {
2030 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2031 assert(obj->tag == LDKEvent_OpenChannelRequest);
2032 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2033 return funding_satoshis_conv;
2035 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint32_t ptr) {
2036 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2037 assert(obj->tag == LDKEvent_OpenChannelRequest);
2038 int64_t push_msat_conv = obj->open_channel_request.push_msat;
2039 return push_msat_conv;
2041 uint32_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint32_t ptr) {
2042 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2043 assert(obj->tag == LDKEvent_OpenChannelRequest);
2044 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2045 uint32_t channel_type_ref = 0;
2046 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2047 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2048 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2049 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2050 return channel_type_ref;
2052 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint32_t ptr) {
2053 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2054 assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2055 int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2056 memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2057 return prev_channel_id_arr;
2059 uint32_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint32_t ptr) {
2060 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2061 assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2062 uint32_t failed_next_destination_ref = ((uintptr_t)&obj->htlc_handling_failed.failed_next_destination) | 1;
2063 return failed_next_destination_ref;
2065 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
2066 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2068 case LDKCOption_EventZ_Some: return 0;
2069 case LDKCOption_EventZ_None: return 1;
2073 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
2074 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2075 assert(obj->tag == LDKCOption_EventZ_Some);
2076 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
2079 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2080 CHECK(owner->result_ok);
2081 return COption_EventZ_clone(&*owner->contents.result);
2083 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
2084 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2085 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2086 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2087 uint32_t ret_ref = (uintptr_t)ret_copy;
2091 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2092 CHECK(!owner->result_ok);
2093 return DecodeError_clone(&*owner->contents.err);
2095 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
2096 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2097 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2098 uint32_t ret_ref = 0;
2099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2102 ret_ref = (uintptr_t)ret_var.inner;
2103 if (ret_var.is_owned) {
2109 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
2110 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2112 case LDKErrorAction_DisconnectPeer: return 0;
2113 case LDKErrorAction_IgnoreError: return 1;
2114 case LDKErrorAction_IgnoreAndLog: return 2;
2115 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2116 case LDKErrorAction_SendErrorMessage: return 4;
2117 case LDKErrorAction_SendWarningMessage: return 5;
2121 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
2122 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2123 assert(obj->tag == LDKErrorAction_DisconnectPeer);
2124 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2125 uint32_t msg_ref = 0;
2126 if ((uintptr_t)msg_var.inner > 4096) {
2127 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2128 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2129 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2130 msg_ref = (uintptr_t)msg_var.inner & ~1;
2134 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
2135 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2136 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2137 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2138 return ignore_and_log_conv;
2140 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
2141 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2142 assert(obj->tag == LDKErrorAction_SendErrorMessage);
2143 LDKErrorMessage msg_var = obj->send_error_message.msg;
2144 uint32_t msg_ref = 0;
2145 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2146 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2147 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2148 msg_ref = (uintptr_t)msg_var.inner & ~1;
2151 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint32_t ptr) {
2152 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2153 assert(obj->tag == LDKErrorAction_SendWarningMessage);
2154 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2155 uint32_t msg_ref = 0;
2156 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2157 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2158 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2159 msg_ref = (uintptr_t)msg_var.inner & ~1;
2162 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint32_t ptr) {
2163 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2164 assert(obj->tag == LDKErrorAction_SendWarningMessage);
2165 uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2166 return log_level_conv;
2168 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
2169 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2171 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2172 case LDKMessageSendEvent_SendOpenChannel: return 1;
2173 case LDKMessageSendEvent_SendFundingCreated: return 2;
2174 case LDKMessageSendEvent_SendFundingSigned: return 3;
2175 case LDKMessageSendEvent_SendChannelReady: return 4;
2176 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2177 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2178 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2179 case LDKMessageSendEvent_SendClosingSigned: return 8;
2180 case LDKMessageSendEvent_SendShutdown: return 9;
2181 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2182 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2183 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2184 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2185 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2186 case LDKMessageSendEvent_HandleError: return 15;
2187 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2188 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2189 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2190 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2194 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2195 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2196 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2197 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2198 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2201 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2202 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2203 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2204 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2205 uint32_t msg_ref = 0;
2206 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2207 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2208 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2209 msg_ref = (uintptr_t)msg_var.inner & ~1;
2212 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2213 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2214 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2215 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2216 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2219 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2220 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2221 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2222 LDKOpenChannel msg_var = obj->send_open_channel.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 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2231 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2232 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2233 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2234 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2237 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2238 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2239 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2240 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2241 uint32_t msg_ref = 0;
2242 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2243 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2244 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2245 msg_ref = (uintptr_t)msg_var.inner & ~1;
2248 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2249 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2250 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2251 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2252 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2255 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2256 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2257 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2258 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2259 uint32_t msg_ref = 0;
2260 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2261 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2262 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2263 msg_ref = (uintptr_t)msg_var.inner & ~1;
2266 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint32_t ptr) {
2267 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2268 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2269 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2270 memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2273 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint32_t ptr) {
2274 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2275 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2276 LDKChannelReady msg_var = obj->send_channel_ready.msg;
2277 uint32_t msg_ref = 0;
2278 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2279 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2280 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2281 msg_ref = (uintptr_t)msg_var.inner & ~1;
2284 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2285 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2286 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2287 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2288 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2291 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2292 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2293 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2294 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2295 uint32_t msg_ref = 0;
2296 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2297 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2298 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2299 msg_ref = (uintptr_t)msg_var.inner & ~1;
2302 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
2303 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2304 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2305 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2306 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2309 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
2310 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2311 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2312 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2313 uint32_t updates_ref = 0;
2314 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2315 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2316 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2317 updates_ref = (uintptr_t)updates_var.inner & ~1;
2320 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
2321 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2322 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2323 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2324 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2327 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
2328 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2329 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2330 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2331 uint32_t msg_ref = 0;
2332 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2333 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2334 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2335 msg_ref = (uintptr_t)msg_var.inner & ~1;
2338 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
2339 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2340 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2341 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2342 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2345 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
2346 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2347 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2348 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2349 uint32_t msg_ref = 0;
2350 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2351 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2352 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2353 msg_ref = (uintptr_t)msg_var.inner & ~1;
2356 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
2357 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2358 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2359 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2360 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2363 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
2364 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2365 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2366 LDKShutdown msg_var = obj->send_shutdown.msg;
2367 uint32_t msg_ref = 0;
2368 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2371 msg_ref = (uintptr_t)msg_var.inner & ~1;
2374 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
2375 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2376 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2377 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2378 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2381 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
2382 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2383 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2384 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2385 uint32_t msg_ref = 0;
2386 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2387 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2388 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2389 msg_ref = (uintptr_t)msg_var.inner & ~1;
2392 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
2393 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2394 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2395 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2396 uint32_t msg_ref = 0;
2397 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2398 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2399 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2400 msg_ref = (uintptr_t)msg_var.inner & ~1;
2403 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
2404 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2405 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2406 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2407 uint32_t update_msg_ref = 0;
2408 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2409 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2410 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2411 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2412 return update_msg_ref;
2414 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
2415 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2416 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2417 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2418 uint32_t msg_ref = 0;
2419 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2420 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2421 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2422 msg_ref = (uintptr_t)msg_var.inner & ~1;
2425 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
2426 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2427 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2428 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2429 uint32_t msg_ref = 0;
2430 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2431 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2432 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2433 msg_ref = (uintptr_t)msg_var.inner & ~1;
2436 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
2437 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2438 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2439 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2440 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2443 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
2444 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2445 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2446 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2447 uint32_t msg_ref = 0;
2448 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2449 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2451 msg_ref = (uintptr_t)msg_var.inner & ~1;
2454 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
2455 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2456 assert(obj->tag == LDKMessageSendEvent_HandleError);
2457 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2458 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2461 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
2462 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2463 assert(obj->tag == LDKMessageSendEvent_HandleError);
2464 uint32_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2467 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
2468 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2469 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2470 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2471 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2474 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
2475 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2476 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2477 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2478 uint32_t msg_ref = 0;
2479 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2480 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2481 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2482 msg_ref = (uintptr_t)msg_var.inner & ~1;
2485 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
2486 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2487 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2488 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2489 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2492 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
2493 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2494 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2495 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2496 uint32_t msg_ref = 0;
2497 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2498 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2499 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2500 msg_ref = (uintptr_t)msg_var.inner & ~1;
2503 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
2504 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2505 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2506 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2507 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2510 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
2511 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2512 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2513 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2514 uint32_t msg_ref = 0;
2515 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2516 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2517 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2518 msg_ref = (uintptr_t)msg_var.inner & ~1;
2521 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint32_t ptr) {
2522 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2523 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2524 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2525 memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2528 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint32_t ptr) {
2529 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2530 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2531 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2532 uint32_t msg_ref = 0;
2533 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2534 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2535 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2536 msg_ref = (uintptr_t)msg_var.inner & ~1;
2539 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2540 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2541 for (size_t i = 0; i < ret.datalen; i++) {
2542 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2546 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2547 CHECK(owner->result_ok);
2548 return TxOut_clone(&*owner->contents.result);
2550 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
2551 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2552 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2553 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2554 return (uint32_t)ret_ref;
2557 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2558 CHECK(!owner->result_ok);
2559 return AccessError_clone(&*owner->contents.err);
2561 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
2562 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2563 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2567 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2570 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
2571 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2572 uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2576 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2579 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
2580 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2581 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2582 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2583 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2587 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2588 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2589 for (size_t i = 0; i < ret.datalen; i++) {
2590 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2594 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2595 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2596 for (size_t i = 0; i < ret.datalen; i++) {
2597 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2601 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2602 CHECK(owner->result_ok);
2603 return *owner->contents.result;
2605 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
2606 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2607 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2610 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2611 CHECK(!owner->result_ok);
2612 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2614 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
2615 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2616 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2620 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
2621 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2623 case LDKMonitorEvent_HTLCEvent: return 0;
2624 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2625 case LDKMonitorEvent_UpdateCompleted: return 2;
2626 case LDKMonitorEvent_UpdateFailed: return 3;
2630 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
2631 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2632 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2633 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2634 uint32_t htlc_event_ref = 0;
2635 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2636 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2637 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2638 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2639 return htlc_event_ref;
2641 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
2642 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2643 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2644 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2645 uint32_t commitment_tx_confirmed_ref = 0;
2646 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2647 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2648 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2649 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2650 return commitment_tx_confirmed_ref;
2652 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
2653 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2654 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2655 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2656 uint32_t funding_txo_ref = 0;
2657 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2658 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2659 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2660 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2661 return funding_txo_ref;
2663 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
2664 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2665 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2666 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2667 return monitor_update_id_conv;
2669 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
2670 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2671 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2672 LDKOutPoint update_failed_var = obj->update_failed;
2673 uint32_t update_failed_ref = 0;
2674 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2675 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2676 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2677 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2678 return update_failed_ref;
2680 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2681 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2682 for (size_t i = 0; i < ret.datalen; i++) {
2683 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2687 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2688 return OutPoint_clone(&owner->a);
2690 uint32_t __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint32_t owner) {
2691 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
2692 LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2693 uint32_t ret_ref = 0;
2694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2697 ret_ref = (uintptr_t)ret_var.inner;
2698 if (ret_var.is_owned) {
2704 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2705 return CVec_MonitorEventZ_clone(&owner->b);
2707 uint32_tArray __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint32_t owner) {
2708 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
2709 LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2710 uint32_tArray ret_arr = NULL;
2711 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
2712 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
2713 for (size_t o = 0; o < ret_var.datalen; o++) {
2714 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2715 *ret_conv_14_copy = ret_var.data[o];
2716 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
2717 ret_arr_ptr[o] = ret_conv_14_ref;
2724 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2727 int8_tArray __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint32_t owner) {
2728 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1);
2729 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2730 memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2734 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2735 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2736 for (size_t i = 0; i < ret.datalen; i++) {
2737 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2741 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
2742 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2744 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2745 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2749 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
2750 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2751 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2752 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2753 *some_conv = obj->some;
2754 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2755 return ((uint32_t)some_conv);
2757 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2758 CHECK(owner->result_ok);
2759 return FixedPenaltyScorer_clone(&*owner->contents.result);
2761 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint32_t owner) {
2762 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2763 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2764 uint32_t ret_ref = 0;
2765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2768 ret_ref = (uintptr_t)ret_var.inner;
2769 if (ret_var.is_owned) {
2775 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2776 CHECK(!owner->result_ok);
2777 return DecodeError_clone(&*owner->contents.err);
2779 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint32_t owner) {
2780 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2781 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2782 uint32_t ret_ref = 0;
2783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2786 ret_ref = (uintptr_t)ret_var.inner;
2787 if (ret_var.is_owned) {
2793 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2796 int64_t __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint32_t owner) {
2797 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
2798 int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2802 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2805 int64_t __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint32_t owner) {
2806 LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)(owner & ~1);
2807 int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2811 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint32_t ptr) {
2812 LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)(ptr & ~1);
2814 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2815 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2819 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint32_t ptr) {
2820 LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)(ptr & ~1);
2821 assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2822 LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2823 *some_conv = obj->some;
2824 *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2825 return ((uint32_t)some_conv);
2827 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2828 LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2829 for (size_t i = 0; i < ret.datalen; i++) {
2830 ret.data[i] = NodeId_clone(&orig->data[i]);
2834 typedef struct LDKLogger_JCalls {
2835 atomic_size_t refcnt;
2836 uint32_t instance_ptr;
2838 static void LDKLogger_JCalls_free(void* this_arg) {
2839 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2840 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2844 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2845 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2846 LDKRecord record_var = *record;
2847 uint32_t record_ref = 0;
2848 record_var = Record_clone(&record_var);
2849 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2850 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2851 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2852 record_ref = (uintptr_t)record_var.inner;
2853 if (record_var.is_owned) {
2856 js_invoke_function_u_u(j_calls->instance_ptr, 0, (uint32_t)record_ref);
2858 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2859 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2860 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2862 static inline LDKLogger LDKLogger_init (JSValue o) {
2863 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2864 atomic_init(&calls->refcnt, 1);
2865 calls->instance_ptr = o;
2868 .this_arg = (void*) calls,
2869 .log = log_LDKLogger_jcall,
2870 .free = LDKLogger_JCalls_free,
2874 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2875 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2876 *res_ptr = LDKLogger_init(o);
2877 return (long)res_ptr;
2879 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2880 CHECK(owner->result_ok);
2881 return &*owner->contents.result;
2883 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint32_t owner) {
2884 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2885 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2886 uint32_t ret_ref = 0;
2887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2890 ret_ref = (uintptr_t)ret_var.inner & ~1;
2894 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2895 CHECK(!owner->result_ok);
2896 return DecodeError_clone(&*owner->contents.err);
2898 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint32_t owner) {
2899 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2900 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2901 uint32_t ret_ref = 0;
2902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2905 ret_ref = (uintptr_t)ret_var.inner;
2906 if (ret_var.is_owned) {
2912 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2913 CHECK(owner->result_ok);
2914 return InitFeatures_clone(&*owner->contents.result);
2916 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2917 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2918 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2919 uint32_t ret_ref = 0;
2920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2923 ret_ref = (uintptr_t)ret_var.inner;
2924 if (ret_var.is_owned) {
2930 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2931 CHECK(!owner->result_ok);
2932 return DecodeError_clone(&*owner->contents.err);
2934 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2935 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2936 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2937 uint32_t ret_ref = 0;
2938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2941 ret_ref = (uintptr_t)ret_var.inner;
2942 if (ret_var.is_owned) {
2948 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2949 CHECK(owner->result_ok);
2950 return ChannelFeatures_clone(&*owner->contents.result);
2952 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2953 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2954 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2955 uint32_t ret_ref = 0;
2956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2959 ret_ref = (uintptr_t)ret_var.inner;
2960 if (ret_var.is_owned) {
2966 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2967 CHECK(!owner->result_ok);
2968 return DecodeError_clone(&*owner->contents.err);
2970 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2971 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2972 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2973 uint32_t ret_ref = 0;
2974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2977 ret_ref = (uintptr_t)ret_var.inner;
2978 if (ret_var.is_owned) {
2984 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2985 CHECK(owner->result_ok);
2986 return NodeFeatures_clone(&*owner->contents.result);
2988 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2989 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2990 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2991 uint32_t ret_ref = 0;
2992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2995 ret_ref = (uintptr_t)ret_var.inner;
2996 if (ret_var.is_owned) {
3002 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3003 CHECK(!owner->result_ok);
3004 return DecodeError_clone(&*owner->contents.err);
3006 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3007 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3008 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3009 uint32_t ret_ref = 0;
3010 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3013 ret_ref = (uintptr_t)ret_var.inner;
3014 if (ret_var.is_owned) {
3020 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3021 CHECK(owner->result_ok);
3022 return InvoiceFeatures_clone(&*owner->contents.result);
3024 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3025 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3026 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(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 LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3039 CHECK(!owner->result_ok);
3040 return DecodeError_clone(&*owner->contents.err);
3042 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3043 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3044 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3045 uint32_t ret_ref = 0;
3046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3049 ret_ref = (uintptr_t)ret_var.inner;
3050 if (ret_var.is_owned) {
3056 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3057 CHECK(owner->result_ok);
3058 return ChannelTypeFeatures_clone(&*owner->contents.result);
3060 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3061 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3062 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3063 uint32_t ret_ref = 0;
3064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3067 ret_ref = (uintptr_t)ret_var.inner;
3068 if (ret_var.is_owned) {
3074 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3075 CHECK(!owner->result_ok);
3076 return DecodeError_clone(&*owner->contents.err);
3078 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3079 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3080 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3081 uint32_t ret_ref = 0;
3082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3085 ret_ref = (uintptr_t)ret_var.inner;
3086 if (ret_var.is_owned) {
3092 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3093 CHECK(owner->result_ok);
3094 return NodeId_clone(&*owner->contents.result);
3096 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
3097 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3098 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3099 uint32_t ret_ref = 0;
3100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3103 ret_ref = (uintptr_t)ret_var.inner;
3104 if (ret_var.is_owned) {
3110 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3111 CHECK(!owner->result_ok);
3112 return DecodeError_clone(&*owner->contents.err);
3114 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
3115 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3116 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3117 uint32_t ret_ref = 0;
3118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3121 ret_ref = (uintptr_t)ret_var.inner;
3122 if (ret_var.is_owned) {
3128 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3129 CHECK(owner->result_ok);
3130 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3132 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
3133 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3134 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3135 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3136 uint32_t ret_ref = (uintptr_t)ret_copy;
3140 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3141 CHECK(!owner->result_ok);
3142 return DecodeError_clone(&*owner->contents.err);
3144 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
3145 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3146 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3147 uint32_t ret_ref = 0;
3148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3151 ret_ref = (uintptr_t)ret_var.inner;
3152 if (ret_var.is_owned) {
3158 typedef struct LDKAccess_JCalls {
3159 atomic_size_t refcnt;
3160 uint32_t instance_ptr;
3162 static void LDKAccess_JCalls_free(void* this_arg) {
3163 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3164 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3168 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3169 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3170 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3171 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3172 int64_t short_channel_id_conv = short_channel_id;
3173 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id_conv);
3174 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3175 CHECK_ACCESS(ret_ptr);
3176 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3180 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3181 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3182 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3184 static inline LDKAccess LDKAccess_init (JSValue o) {
3185 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3186 atomic_init(&calls->refcnt, 1);
3187 calls->instance_ptr = o;
3190 .this_arg = (void*) calls,
3191 .get_utxo = get_utxo_LDKAccess_jcall,
3192 .free = LDKAccess_JCalls_free,
3196 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3197 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3198 *res_ptr = LDKAccess_init(o);
3199 return (long)res_ptr;
3201 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) {
3202 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3203 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3204 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3205 unsigned char genesis_hash_arr[32];
3206 CHECK(genesis_hash->arr_len == 32);
3207 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3208 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3209 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3210 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3211 return (uint32_t)ret_conv;
3214 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
3215 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3217 case LDKCOption_AccessZ_Some: return 0;
3218 case LDKCOption_AccessZ_None: return 1;
3222 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
3223 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3224 assert(obj->tag == LDKCOption_AccessZ_Some);
3225 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3226 *some_ret = obj->some;
3227 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3228 if ((*some_ret).free == LDKAccess_JCalls_free) {
3229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3230 LDKAccess_JCalls_cloned(&(*some_ret));
3232 return (uint32_t)some_ret;
3234 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3235 CHECK(owner->result_ok);
3236 return *owner->contents.result;
3238 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3239 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3240 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3244 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3245 CHECK(!owner->result_ok);
3246 return LightningError_clone(&*owner->contents.err);
3248 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3249 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3250 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3251 uint32_t ret_ref = 0;
3252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3255 ret_ref = (uintptr_t)ret_var.inner;
3256 if (ret_var.is_owned) {
3262 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3263 return ChannelAnnouncement_clone(&owner->a);
3265 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3266 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3267 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3268 uint32_t ret_ref = 0;
3269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3272 ret_ref = (uintptr_t)ret_var.inner;
3273 if (ret_var.is_owned) {
3279 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3280 return ChannelUpdate_clone(&owner->b);
3282 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3283 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3284 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3285 uint32_t ret_ref = 0;
3286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3289 ret_ref = (uintptr_t)ret_var.inner;
3290 if (ret_var.is_owned) {
3296 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3297 return ChannelUpdate_clone(&owner->c);
3299 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3300 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3301 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3302 uint32_t ret_ref = 0;
3303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3306 ret_ref = (uintptr_t)ret_var.inner;
3307 if (ret_var.is_owned) {
3313 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3314 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3315 for (size_t i = 0; i < ret.datalen; i++) {
3316 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3320 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3321 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3322 for (size_t i = 0; i < ret.datalen; i++) {
3323 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3327 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3328 CHECK(owner->result_ok);
3329 return *owner->contents.result;
3331 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
3332 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3333 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3336 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3337 CHECK(!owner->result_ok);
3338 return LightningError_clone(&*owner->contents.err);
3340 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
3341 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3342 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3343 uint32_t ret_ref = 0;
3344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3347 ret_ref = (uintptr_t)ret_var.inner;
3348 if (ret_var.is_owned) {
3354 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3355 CHECK(owner->result_ok);
3356 return ChannelUpdateInfo_clone(&*owner->contents.result);
3358 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
3359 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3360 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_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_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3373 CHECK(!owner->result_ok);
3374 return DecodeError_clone(&*owner->contents.err);
3376 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
3377 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3378 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_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 LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3391 CHECK(owner->result_ok);
3392 return ChannelInfo_clone(&*owner->contents.result);
3394 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3395 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3396 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_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;
3402 if (ret_var.is_owned) {
3408 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3409 CHECK(!owner->result_ok);
3410 return DecodeError_clone(&*owner->contents.err);
3412 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3413 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3414 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3415 uint32_t ret_ref = 0;
3416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3419 ret_ref = (uintptr_t)ret_var.inner;
3420 if (ret_var.is_owned) {
3426 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3427 CHECK(owner->result_ok);
3428 return RoutingFees_clone(&*owner->contents.result);
3430 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3431 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3432 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3433 uint32_t ret_ref = 0;
3434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3437 ret_ref = (uintptr_t)ret_var.inner;
3438 if (ret_var.is_owned) {
3444 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3445 CHECK(!owner->result_ok);
3446 return DecodeError_clone(&*owner->contents.err);
3448 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3449 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3450 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3451 uint32_t ret_ref = 0;
3452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3455 ret_ref = (uintptr_t)ret_var.inner;
3456 if (ret_var.is_owned) {
3462 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3463 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3465 case LDKNetAddress_IPv4: return 0;
3466 case LDKNetAddress_IPv6: return 1;
3467 case LDKNetAddress_OnionV2: return 2;
3468 case LDKNetAddress_OnionV3: return 3;
3469 case LDKNetAddress_Hostname: return 4;
3473 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3474 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3475 assert(obj->tag == LDKNetAddress_IPv4);
3476 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3477 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3480 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3481 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3482 assert(obj->tag == LDKNetAddress_IPv4);
3483 int16_t port_conv = obj->i_pv4.port;
3486 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3487 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3488 assert(obj->tag == LDKNetAddress_IPv6);
3489 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3490 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3493 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3494 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3495 assert(obj->tag == LDKNetAddress_IPv6);
3496 int16_t port_conv = obj->i_pv6.port;
3499 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3500 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3501 assert(obj->tag == LDKNetAddress_OnionV2);
3502 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3503 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3504 return onion_v2_arr;
3506 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3507 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3508 assert(obj->tag == LDKNetAddress_OnionV3);
3509 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3510 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3511 return ed25519_pubkey_arr;
3513 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3514 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3515 assert(obj->tag == LDKNetAddress_OnionV3);
3516 int16_t checksum_conv = obj->onion_v3.checksum;
3517 return checksum_conv;
3519 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3520 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3521 assert(obj->tag == LDKNetAddress_OnionV3);
3522 int8_t version_conv = obj->onion_v3.version;
3523 return version_conv;
3525 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3526 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3527 assert(obj->tag == LDKNetAddress_OnionV3);
3528 int16_t port_conv = obj->onion_v3.port;
3531 uint32_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint32_t ptr) {
3532 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3533 assert(obj->tag == LDKNetAddress_Hostname);
3534 LDKHostname hostname_var = obj->hostname.hostname;
3535 uint32_t hostname_ref = 0;
3536 CHECK((((uintptr_t)hostname_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3537 CHECK((((uintptr_t)&hostname_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3538 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3539 hostname_ref = (uintptr_t)hostname_var.inner & ~1;
3540 return hostname_ref;
3542 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint32_t ptr) {
3543 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3544 assert(obj->tag == LDKNetAddress_Hostname);
3545 int16_t port_conv = obj->hostname.port;
3548 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3549 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3550 for (size_t i = 0; i < ret.datalen; i++) {
3551 ret.data[i] = NetAddress_clone(&orig->data[i]);
3555 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3556 CHECK(owner->result_ok);
3557 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3559 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3560 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3561 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3562 uint32_t ret_ref = 0;
3563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3566 ret_ref = (uintptr_t)ret_var.inner;
3567 if (ret_var.is_owned) {
3573 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3574 CHECK(!owner->result_ok);
3575 return DecodeError_clone(&*owner->contents.err);
3577 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3578 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3579 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3580 uint32_t ret_ref = 0;
3581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3584 ret_ref = (uintptr_t)ret_var.inner;
3585 if (ret_var.is_owned) {
3591 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3592 CHECK(owner->result_ok);
3593 return NodeAlias_clone(&*owner->contents.result);
3595 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint32_t owner) {
3596 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
3597 LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3598 uint32_t ret_ref = 0;
3599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3602 ret_ref = (uintptr_t)ret_var.inner;
3603 if (ret_var.is_owned) {
3609 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3610 CHECK(!owner->result_ok);
3611 return DecodeError_clone(&*owner->contents.err);
3613 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint32_t owner) {
3614 LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(owner & ~1);
3615 LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3616 uint32_t ret_ref = 0;
3617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3620 ret_ref = (uintptr_t)ret_var.inner;
3621 if (ret_var.is_owned) {
3627 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3628 CHECK(owner->result_ok);
3629 return NodeInfo_clone(&*owner->contents.result);
3631 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3632 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3633 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3634 uint32_t ret_ref = 0;
3635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3638 ret_ref = (uintptr_t)ret_var.inner;
3639 if (ret_var.is_owned) {
3645 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3646 CHECK(!owner->result_ok);
3647 return DecodeError_clone(&*owner->contents.err);
3649 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3650 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3651 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3652 uint32_t ret_ref = 0;
3653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3656 ret_ref = (uintptr_t)ret_var.inner;
3657 if (ret_var.is_owned) {
3663 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3664 CHECK(owner->result_ok);
3665 return &*owner->contents.result;
3667 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3668 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3669 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3670 uint32_t ret_ref = 0;
3671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3674 ret_ref = (uintptr_t)ret_var.inner & ~1;
3678 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3679 CHECK(!owner->result_ok);
3680 return DecodeError_clone(&*owner->contents.err);
3682 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3683 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3684 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3685 uint32_t ret_ref = 0;
3686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3689 ret_ref = (uintptr_t)ret_var.inner;
3690 if (ret_var.is_owned) {
3696 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3697 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3699 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3700 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3704 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3705 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3706 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3707 LDKCVec_NetAddressZ some_var = obj->some;
3708 uint32_tArray some_arr = NULL;
3709 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
3710 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3711 for (size_t m = 0; m < some_var.datalen; m++) {
3712 uint32_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
3713 some_arr_ptr[m] = some_conv_12_ref;
3718 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3719 CHECK(owner->result_ok);
3720 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3722 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3723 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3724 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3725 uint32_t ret_ref = 0;
3726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3729 ret_ref = (uintptr_t)ret_var.inner;
3730 if (ret_var.is_owned) {
3736 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3737 CHECK(!owner->result_ok);
3738 return DecodeError_clone(&*owner->contents.err);
3740 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3741 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3742 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3743 uint32_t ret_ref = 0;
3744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3747 ret_ref = (uintptr_t)ret_var.inner;
3748 if (ret_var.is_owned) {
3754 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3755 CHECK(owner->result_ok);
3756 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3758 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3759 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3760 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3761 uint32_t ret_ref = 0;
3762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3765 ret_ref = (uintptr_t)ret_var.inner;
3766 if (ret_var.is_owned) {
3772 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3773 CHECK(!owner->result_ok);
3774 return DecodeError_clone(&*owner->contents.err);
3776 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3777 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3778 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3779 uint32_t ret_ref = 0;
3780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3783 ret_ref = (uintptr_t)ret_var.inner;
3784 if (ret_var.is_owned) {
3790 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3791 CHECK(owner->result_ok);
3792 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3794 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3795 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3796 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3797 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3798 uint32_t ret_ref = (uintptr_t)ret_copy;
3802 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3803 CHECK(!owner->result_ok);
3804 return DecodeError_clone(&*owner->contents.err);
3806 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3807 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3808 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3809 uint32_t ret_ref = 0;
3810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3813 ret_ref = (uintptr_t)ret_var.inner;
3814 if (ret_var.is_owned) {
3820 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3821 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3822 for (size_t i = 0; i < ret.datalen; i++) {
3823 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3827 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3830 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
3831 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3832 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3833 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3837 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3840 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
3841 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3842 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3843 ptrArray ret_arr = NULL;
3844 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3845 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3846 for (size_t m = 0; m < ret_var.datalen; m++) {
3847 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3848 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3849 ret_arr_ptr[m] = ret_conv_12_arr;
3855 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3856 CHECK(owner->result_ok);
3857 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3859 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
3860 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3861 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3862 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3863 return ((uint32_t)ret_conv);
3866 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3867 CHECK(!owner->result_ok);
3868 return *owner->contents.err;
3870 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
3871 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3872 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3875 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3876 CHECK(owner->result_ok);
3877 return *owner->contents.result;
3879 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
3880 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3881 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3882 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3886 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3887 CHECK(!owner->result_ok);
3888 return *owner->contents.err;
3890 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
3891 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3892 CResult_SignatureNoneZ_get_err(owner_conv);
3895 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3898 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
3899 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3900 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3901 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3905 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3908 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
3909 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3910 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3911 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3915 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3916 CHECK(owner->result_ok);
3917 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3919 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
3920 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3921 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3922 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3923 return ((uint32_t)ret_conv);
3926 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3927 CHECK(!owner->result_ok);
3928 return *owner->contents.err;
3930 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
3931 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3932 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3935 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3936 CHECK(owner->result_ok);
3937 return *owner->contents.result;
3939 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
3940 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3941 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3942 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3946 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3947 CHECK(!owner->result_ok);
3948 return *owner->contents.err;
3950 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
3951 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3952 CResult_SecretKeyNoneZ_get_err(owner_conv);
3955 typedef struct LDKBaseSign_JCalls {
3956 atomic_size_t refcnt;
3957 uint32_t instance_ptr;
3958 } LDKBaseSign_JCalls;
3959 static void LDKBaseSign_JCalls_free(void* this_arg) {
3960 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3961 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3965 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3966 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3967 int64_t idx_conv = idx;
3968 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 2, (uint32_t)idx_conv);
3969 LDKPublicKey ret_ref;
3970 CHECK(ret->arr_len == 33);
3971 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3974 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3975 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3976 int64_t idx_conv = idx;
3977 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 3, (uint32_t)idx_conv);
3978 LDKThirtyTwoBytes ret_ref;
3979 CHECK(ret->arr_len == 32);
3980 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3983 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3984 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3985 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3986 uint32_t holder_tx_ref = 0;
3987 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3988 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3989 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3990 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3991 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3992 if (holder_tx_var.is_owned) {
3995 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3996 ptrArray preimages_arr = NULL;
3997 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3998 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3999 for (size_t m = 0; m < preimages_var.datalen; m++) {
4000 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4001 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4002 preimages_arr_ptr[m] = preimages_conv_12_arr;
4005 FREE(preimages_var.data);
4006 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 4, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
4007 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4008 CHECK_ACCESS(ret_ptr);
4009 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4013 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4014 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4015 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 5);
4016 LDKThirtyTwoBytes ret_ref;
4017 CHECK(ret->arr_len == 32);
4018 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4021 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4022 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4023 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4024 uint32_t commitment_tx_ref = 0;
4025 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4026 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4027 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4028 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4029 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4030 if (commitment_tx_var.is_owned) {
4031 commitment_tx_ref |= 1;
4033 LDKCVec_PaymentPreimageZ preimages_var = preimages;
4034 ptrArray preimages_arr = NULL;
4035 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
4036 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
4037 for (size_t m = 0; m < preimages_var.datalen; m++) {
4038 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
4039 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
4040 preimages_arr_ptr[m] = preimages_conv_12_arr;
4043 FREE(preimages_var.data);
4044 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
4045 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4046 CHECK_ACCESS(ret_ptr);
4047 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4051 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4052 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4053 int64_t idx_conv = idx;
4054 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
4055 memcpy(secret_arr->elems, *secret, 32);
4056 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 7, (uint32_t)idx_conv, (uint32_t)secret_arr);
4057 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4058 CHECK_ACCESS(ret_ptr);
4059 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4063 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4064 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4065 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4066 uint32_t commitment_tx_ref = 0;
4067 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4068 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4069 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4070 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4071 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
4072 if (commitment_tx_var.is_owned) {
4073 commitment_tx_ref |= 1;
4075 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 8, (uint32_t)commitment_tx_ref);
4076 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4077 CHECK_ACCESS(ret_ptr);
4078 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4082 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]) {
4083 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4084 LDKTransaction justice_tx_var = justice_tx;
4085 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4086 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4087 Transaction_free(justice_tx_var);
4088 uint32_t input_conv = input;
4089 int64_t amount_conv = amount;
4090 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4091 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4092 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);
4093 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4094 CHECK_ACCESS(ret_ptr);
4095 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4099 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) {
4100 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4101 LDKTransaction justice_tx_var = justice_tx;
4102 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
4103 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
4104 Transaction_free(justice_tx_var);
4105 uint32_t input_conv = input;
4106 int64_t amount_conv = amount;
4107 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
4108 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
4109 LDKHTLCOutputInCommitment htlc_var = *htlc;
4110 uint32_t htlc_ref = 0;
4111 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4112 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4113 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4114 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4115 htlc_ref = (uintptr_t)htlc_var.inner;
4116 if (htlc_var.is_owned) {
4119 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);
4120 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4121 CHECK_ACCESS(ret_ptr);
4122 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4126 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) {
4127 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4128 LDKTransaction htlc_tx_var = htlc_tx;
4129 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4130 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4131 Transaction_free(htlc_tx_var);
4132 uint32_t input_conv = input;
4133 int64_t amount_conv = amount;
4134 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4135 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4136 LDKHTLCOutputInCommitment htlc_var = *htlc;
4137 uint32_t htlc_ref = 0;
4138 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4139 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4140 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4141 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4142 htlc_ref = (uintptr_t)htlc_var.inner;
4143 if (htlc_var.is_owned) {
4146 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);
4147 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4148 CHECK_ACCESS(ret_ptr);
4149 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4153 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4154 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4155 LDKClosingTransaction closing_tx_var = *closing_tx;
4156 uint32_t closing_tx_ref = 0;
4157 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4158 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4159 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4160 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4161 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4162 if (closing_tx_var.is_owned) {
4163 closing_tx_ref |= 1;
4165 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 12, (uint32_t)closing_tx_ref);
4166 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4167 CHECK_ACCESS(ret_ptr);
4168 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4172 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4173 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4174 LDKUnsignedChannelAnnouncement msg_var = *msg;
4175 uint32_t msg_ref = 0;
4176 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4177 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4178 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4180 msg_ref = (uintptr_t)msg_var.inner;
4181 if (msg_var.is_owned) {
4184 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 13, (uint32_t)msg_ref);
4185 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4186 CHECK_ACCESS(ret_ptr);
4187 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4191 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4192 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4193 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4194 uint32_t channel_parameters_ref = 0;
4195 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4196 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4199 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4200 if (channel_parameters_var.is_owned) {
4201 channel_parameters_ref |= 1;
4203 js_invoke_function_u_u(j_calls->instance_ptr, 14, (uint32_t)channel_parameters_ref);
4205 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
4206 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
4207 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4209 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
4210 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4211 atomic_init(&calls->refcnt, 1);
4212 calls->instance_ptr = o;
4214 LDKChannelPublicKeys pubkeys_conv;
4215 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4216 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4217 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4220 .this_arg = (void*) calls,
4221 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4222 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4223 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4224 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4225 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4226 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4227 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4228 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4229 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4230 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4231 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4232 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4233 .ready_channel = ready_channel_LDKBaseSign_jcall,
4234 .free = LDKBaseSign_JCalls_free,
4235 .pubkeys = pubkeys_conv,
4236 .set_pubkeys = NULL,
4240 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
4241 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4242 *res_ptr = LDKBaseSign_init(o, pubkeys);
4243 return (long)res_ptr;
4245 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
4246 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4247 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4248 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4249 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4250 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4254 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
4255 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4256 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4257 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4258 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4259 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4263 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) {
4264 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4265 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4266 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4267 LDKHolderCommitmentTransaction holder_tx_conv;
4268 holder_tx_conv.inner = (void*)(holder_tx & (~1));
4269 holder_tx_conv.is_owned = false;
4270 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4271 LDKCVec_PaymentPreimageZ preimages_constr;
4272 preimages_constr.datalen = preimages->arr_len;
4273 if (preimages_constr.datalen > 0)
4274 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4276 preimages_constr.data = NULL;
4277 int8_tArray* preimages_vals = (void*) preimages->elems;
4278 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4279 int8_tArray preimages_conv_12 = preimages_vals[m];
4280 LDKThirtyTwoBytes preimages_conv_12_ref;
4281 CHECK(preimages_conv_12->arr_len == 32);
4282 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4283 preimages_constr.data[m] = preimages_conv_12_ref;
4286 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4287 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4288 return (uint32_t)ret_conv;
4291 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
4292 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4294 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4295 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4296 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4300 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) {
4301 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4302 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4303 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4304 LDKCommitmentTransaction commitment_tx_conv;
4305 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4306 commitment_tx_conv.is_owned = false;
4307 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4308 LDKCVec_PaymentPreimageZ preimages_constr;
4309 preimages_constr.datalen = preimages->arr_len;
4310 if (preimages_constr.datalen > 0)
4311 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4313 preimages_constr.data = NULL;
4314 int8_tArray* preimages_vals = (void*) preimages->elems;
4315 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4316 int8_tArray preimages_conv_12 = preimages_vals[m];
4317 LDKThirtyTwoBytes preimages_conv_12_ref;
4318 CHECK(preimages_conv_12->arr_len == 32);
4319 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4320 preimages_constr.data[m] = preimages_conv_12_ref;
4323 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4324 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4325 return (uint32_t)ret_conv;
4328 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) {
4329 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4330 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4331 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4332 unsigned char secret_arr[32];
4333 CHECK(secret->arr_len == 32);
4334 memcpy(secret_arr, secret->elems, 32); FREE(secret);
4335 unsigned char (*secret_ref)[32] = &secret_arr;
4336 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4337 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4338 return (uint32_t)ret_conv;
4341 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) {
4342 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4343 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4344 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4345 LDKHolderCommitmentTransaction commitment_tx_conv;
4346 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4347 commitment_tx_conv.is_owned = false;
4348 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4349 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4350 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4351 return (uint32_t)ret_conv;
4354 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) {
4355 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4357 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4358 LDKTransaction justice_tx_ref;
4359 justice_tx_ref.datalen = justice_tx->arr_len;
4360 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4361 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4362 justice_tx_ref.data_is_owned = true;
4363 unsigned char per_commitment_key_arr[32];
4364 CHECK(per_commitment_key->arr_len == 32);
4365 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4366 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4367 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4368 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4369 return (uint32_t)ret_conv;
4372 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) {
4373 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4374 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4375 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4376 LDKTransaction justice_tx_ref;
4377 justice_tx_ref.datalen = justice_tx->arr_len;
4378 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4379 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4380 justice_tx_ref.data_is_owned = true;
4381 unsigned char per_commitment_key_arr[32];
4382 CHECK(per_commitment_key->arr_len == 32);
4383 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4384 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4385 LDKHTLCOutputInCommitment htlc_conv;
4386 htlc_conv.inner = (void*)(htlc & (~1));
4387 htlc_conv.is_owned = false;
4388 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4389 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4390 *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);
4391 return (uint32_t)ret_conv;
4394 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) {
4395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4397 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4398 LDKTransaction htlc_tx_ref;
4399 htlc_tx_ref.datalen = htlc_tx->arr_len;
4400 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4401 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4402 htlc_tx_ref.data_is_owned = true;
4403 LDKPublicKey per_commitment_point_ref;
4404 CHECK(per_commitment_point->arr_len == 33);
4405 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4406 LDKHTLCOutputInCommitment htlc_conv;
4407 htlc_conv.inner = (void*)(htlc & (~1));
4408 htlc_conv.is_owned = false;
4409 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4410 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4411 *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);
4412 return (uint32_t)ret_conv;
4415 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
4416 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4417 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4418 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4419 LDKClosingTransaction closing_tx_conv;
4420 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4421 closing_tx_conv.is_owned = false;
4422 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4423 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4424 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4425 return (uint32_t)ret_conv;
4428 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
4429 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4430 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4431 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4432 LDKUnsignedChannelAnnouncement msg_conv;
4433 msg_conv.inner = (void*)(msg & (~1));
4434 msg_conv.is_owned = false;
4435 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4436 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4437 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4438 return (uint32_t)ret_conv;
4441 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
4442 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4443 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4444 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4445 LDKChannelTransactionParameters channel_parameters_conv;
4446 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4447 channel_parameters_conv.is_owned = false;
4448 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4449 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4452 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4453 if (this_arg->set_pubkeys != NULL)
4454 this_arg->set_pubkeys(this_arg);
4455 return this_arg->pubkeys;
4457 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
4458 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4459 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4460 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4461 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4462 uint32_t ret_ref = 0;
4463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4466 ret_ref = (uintptr_t)ret_var.inner;
4467 if (ret_var.is_owned) {
4473 typedef struct LDKSign_JCalls {
4474 atomic_size_t refcnt;
4475 uint32_t instance_ptr;
4476 LDKBaseSign_JCalls* BaseSign;
4478 static void LDKSign_JCalls_free(void* this_arg) {
4479 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4480 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4484 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4485 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4486 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 15);
4487 LDKCVec_u8Z ret_ref;
4488 ret_ref.datalen = ret->arr_len;
4489 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4490 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4493 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4494 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4495 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4496 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4498 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4499 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4500 atomic_init(&calls->refcnt, 1);
4501 calls->instance_ptr = o;
4503 LDKChannelPublicKeys pubkeys_conv;
4504 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4505 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4506 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4509 .this_arg = (void*) calls,
4510 .write = write_LDKSign_jcall,
4511 .cloned = LDKSign_JCalls_cloned,
4512 .free = LDKSign_JCalls_free,
4513 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4515 calls->BaseSign = ret.BaseSign.this_arg;
4518 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4519 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4520 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4521 return (long)res_ptr;
4523 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
4524 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4525 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4526 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4527 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4528 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4529 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4530 CVec_u8Z_free(ret_var);
4534 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4535 CHECK(owner->result_ok);
4536 return Sign_clone(&*owner->contents.result);
4538 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
4539 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4540 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4541 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4542 return (uint32_t)ret_ret;
4545 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4546 CHECK(!owner->result_ok);
4547 return DecodeError_clone(&*owner->contents.err);
4549 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
4550 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4551 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4552 uint32_t ret_ref = 0;
4553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4556 ret_ref = (uintptr_t)ret_var.inner;
4557 if (ret_var.is_owned) {
4563 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4564 CHECK(owner->result_ok);
4565 return *owner->contents.result;
4567 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
4568 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4569 int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4570 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4574 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4575 CHECK(!owner->result_ok);
4576 return *owner->contents.err;
4578 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
4579 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4580 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4583 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4584 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4585 for (size_t i = 0; i < ret.datalen; i++) {
4586 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4590 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4591 CHECK(owner->result_ok);
4592 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4594 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
4595 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4596 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4597 ptrArray ret_arr = NULL;
4598 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4599 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
4600 for (size_t m = 0; m < ret_var.datalen; m++) {
4601 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4602 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4603 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4604 CVec_u8Z_free(ret_conv_12_var);
4605 ret_arr_ptr[m] = ret_conv_12_arr;
4612 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4613 CHECK(!owner->result_ok);
4614 return *owner->contents.err;
4616 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
4617 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4618 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4621 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4622 CHECK(owner->result_ok);
4623 return InMemorySigner_clone(&*owner->contents.result);
4625 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
4626 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4627 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4628 uint32_t ret_ref = 0;
4629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4632 ret_ref = (uintptr_t)ret_var.inner;
4633 if (ret_var.is_owned) {
4639 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4640 CHECK(!owner->result_ok);
4641 return DecodeError_clone(&*owner->contents.err);
4643 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
4644 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4645 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4646 uint32_t ret_ref = 0;
4647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4650 ret_ref = (uintptr_t)ret_var.inner;
4651 if (ret_var.is_owned) {
4657 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4658 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4659 for (size_t i = 0; i < ret.datalen; i++) {
4660 ret.data[i] = TxOut_clone(&orig->data[i]);
4664 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4665 CHECK(owner->result_ok);
4666 return *owner->contents.result;
4668 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
4669 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4670 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4671 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4672 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4676 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4677 CHECK(!owner->result_ok);
4678 return *owner->contents.err;
4680 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
4681 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4682 CResult_TransactionNoneZ_get_err(owner_conv);
4685 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
4686 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4688 case LDKCOption_u16Z_Some: return 0;
4689 case LDKCOption_u16Z_None: return 1;
4693 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
4694 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4695 assert(obj->tag == LDKCOption_u16Z_Some);
4696 int16_t some_conv = obj->some;
4699 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
4700 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4702 case LDKAPIError_APIMisuseError: return 0;
4703 case LDKAPIError_FeeRateTooHigh: return 1;
4704 case LDKAPIError_RouteError: return 2;
4705 case LDKAPIError_ChannelUnavailable: return 3;
4706 case LDKAPIError_MonitorUpdateFailed: return 4;
4707 case LDKAPIError_IncompatibleShutdownScript: return 5;
4711 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
4712 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4713 assert(obj->tag == LDKAPIError_APIMisuseError);
4714 LDKStr err_str = obj->api_misuse_error.err;
4715 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4718 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
4719 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4720 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4721 LDKStr err_str = obj->fee_rate_too_high.err;
4722 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4725 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
4726 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4727 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4728 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4729 return feerate_conv;
4731 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
4732 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4733 assert(obj->tag == LDKAPIError_RouteError);
4734 LDKStr err_str = obj->route_error.err;
4735 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4738 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
4739 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4740 assert(obj->tag == LDKAPIError_ChannelUnavailable);
4741 LDKStr err_str = obj->channel_unavailable.err;
4742 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4745 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
4746 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4747 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4748 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4749 uint32_t script_ref = 0;
4750 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4751 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4752 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4753 script_ref = (uintptr_t)script_var.inner & ~1;
4756 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4757 CHECK(owner->result_ok);
4758 return *owner->contents.result;
4760 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
4761 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4762 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4765 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4766 CHECK(!owner->result_ok);
4767 return APIError_clone(&*owner->contents.err);
4769 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
4770 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4771 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4772 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4773 uint32_t ret_ref = (uintptr_t)ret_copy;
4777 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4778 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4779 for (size_t i = 0; i < ret.datalen; i++) {
4780 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4784 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4785 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4786 for (size_t i = 0; i < ret.datalen; i++) {
4787 ret.data[i] = APIError_clone(&orig->data[i]);
4791 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4792 CHECK(owner->result_ok);
4793 return ThirtyTwoBytes_clone(&*owner->contents.result);
4795 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
4796 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4797 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4798 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4802 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4803 CHECK(!owner->result_ok);
4804 return APIError_clone(&*owner->contents.err);
4806 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
4807 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4808 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4809 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4810 uint32_t ret_ref = (uintptr_t)ret_copy;
4814 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
4815 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4817 case LDKPaymentSendFailure_ParameterError: return 0;
4818 case LDKPaymentSendFailure_PathParameterError: return 1;
4819 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4820 case LDKPaymentSendFailure_PartialFailure: return 3;
4824 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
4825 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4826 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4827 uint32_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4828 return parameter_error_ref;
4830 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
4831 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4832 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4833 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4834 uint32_tArray path_parameter_error_arr = NULL;
4835 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen, __LINE__);
4836 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
4837 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4838 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4839 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4840 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4841 path_parameter_error_arr_ptr[w] = (uint32_t)path_parameter_error_conv_22_conv;
4844 return path_parameter_error_arr;
4846 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
4847 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4848 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4849 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4850 uint32_tArray all_failed_retry_safe_arr = NULL;
4851 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4852 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
4853 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4854 uint32_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4855 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4858 return all_failed_retry_safe_arr;
4860 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
4861 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4862 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4863 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4864 uint32_tArray results_arr = NULL;
4865 results_arr = init_uint32_tArray(results_var.datalen, __LINE__);
4866 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
4867 for (size_t w = 0; w < results_var.datalen; w++) {
4868 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4869 *results_conv_22_conv = results_var.data[w];
4870 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4871 results_arr_ptr[w] = (uint32_t)results_conv_22_conv;
4876 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
4877 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4878 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4879 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4880 uint32_t failed_paths_retry_ref = 0;
4881 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4882 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4883 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4884 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4885 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4887 return failed_paths_retry_ref;
4889 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
4890 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4891 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4892 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4893 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4894 return payment_id_arr;
4896 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4897 CHECK(owner->result_ok);
4898 return ThirtyTwoBytes_clone(&*owner->contents.result);
4900 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
4901 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4902 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4903 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4907 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4908 CHECK(!owner->result_ok);
4909 return PaymentSendFailure_clone(&*owner->contents.err);
4911 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
4912 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4913 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4914 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4915 uint32_t ret_ref = (uintptr_t)ret_copy;
4919 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4920 CHECK(owner->result_ok);
4921 return *owner->contents.result;
4923 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
4924 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4925 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4928 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4929 CHECK(!owner->result_ok);
4930 return PaymentSendFailure_clone(&*owner->contents.err);
4932 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
4933 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4934 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4935 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4936 uint32_t ret_ref = (uintptr_t)ret_copy;
4940 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4941 return ThirtyTwoBytes_clone(&owner->a);
4943 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
4944 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4945 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4946 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4950 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4951 return ThirtyTwoBytes_clone(&owner->b);
4953 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
4954 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4955 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4956 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4960 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4961 CHECK(owner->result_ok);
4962 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4964 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
4965 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4966 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4967 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4968 return ((uint32_t)ret_conv);
4971 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4972 CHECK(!owner->result_ok);
4973 return PaymentSendFailure_clone(&*owner->contents.err);
4975 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
4976 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4977 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4978 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4979 uint32_t ret_ref = (uintptr_t)ret_copy;
4983 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4984 LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4985 for (size_t i = 0; i < ret.datalen; i++) {
4986 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4990 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4991 return ThirtyTwoBytes_clone(&owner->a);
4993 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
4994 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4995 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4996 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5000 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5001 return ThirtyTwoBytes_clone(&owner->b);
5003 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
5004 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5005 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5006 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5010 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5011 CHECK(owner->result_ok);
5012 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5014 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
5015 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5016 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5017 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5018 return ((uint32_t)ret_conv);
5021 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5022 CHECK(!owner->result_ok);
5023 return *owner->contents.err;
5025 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
5026 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5027 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5030 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5031 CHECK(owner->result_ok);
5032 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5034 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
5035 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5036 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5037 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5038 return ((uint32_t)ret_conv);
5041 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5042 CHECK(!owner->result_ok);
5043 return APIError_clone(&*owner->contents.err);
5045 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
5046 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5047 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5048 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5049 uint32_t ret_ref = (uintptr_t)ret_copy;
5053 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5054 CHECK(owner->result_ok);
5055 return ThirtyTwoBytes_clone(&*owner->contents.result);
5057 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
5058 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5059 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5060 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5064 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5065 CHECK(!owner->result_ok);
5066 return *owner->contents.err;
5068 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
5069 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5070 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5073 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5074 CHECK(owner->result_ok);
5075 return ThirtyTwoBytes_clone(&*owner->contents.result);
5077 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
5078 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5079 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5080 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5084 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5085 CHECK(!owner->result_ok);
5086 return APIError_clone(&*owner->contents.err);
5088 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
5089 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5090 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5091 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5092 uint32_t ret_ref = (uintptr_t)ret_copy;
5096 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5097 CHECK(owner->result_ok);
5098 return ThirtyTwoBytes_clone(&*owner->contents.result);
5100 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
5101 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5102 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5103 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5107 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5108 CHECK(!owner->result_ok);
5109 return APIError_clone(&*owner->contents.err);
5111 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
5112 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5113 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5114 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5115 uint32_t ret_ref = (uintptr_t)ret_copy;
5119 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5120 CHECK(owner->result_ok);
5121 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5123 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint32_t owner) {
5124 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5125 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5126 uint32_t ret_ref = 0;
5127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5130 ret_ref = (uintptr_t)ret_var.inner;
5131 if (ret_var.is_owned) {
5137 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5138 CHECK(!owner->result_ok);
5139 return DecodeError_clone(&*owner->contents.err);
5141 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint32_t owner) {
5142 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5143 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5144 uint32_t ret_ref = 0;
5145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5148 ret_ref = (uintptr_t)ret_var.inner;
5149 if (ret_var.is_owned) {
5155 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5156 CHECK(owner->result_ok);
5157 return ChannelCounterparty_clone(&*owner->contents.result);
5159 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint32_t owner) {
5160 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5161 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5162 uint32_t ret_ref = 0;
5163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5166 ret_ref = (uintptr_t)ret_var.inner;
5167 if (ret_var.is_owned) {
5173 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5174 CHECK(!owner->result_ok);
5175 return DecodeError_clone(&*owner->contents.err);
5177 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint32_t owner) {
5178 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5179 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5180 uint32_t ret_ref = 0;
5181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5184 ret_ref = (uintptr_t)ret_var.inner;
5185 if (ret_var.is_owned) {
5191 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5192 CHECK(owner->result_ok);
5193 return ChannelDetails_clone(&*owner->contents.result);
5195 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint32_t owner) {
5196 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5197 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5198 uint32_t ret_ref = 0;
5199 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5200 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5201 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5202 ret_ref = (uintptr_t)ret_var.inner;
5203 if (ret_var.is_owned) {
5209 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5210 CHECK(!owner->result_ok);
5211 return DecodeError_clone(&*owner->contents.err);
5213 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint32_t owner) {
5214 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5215 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5216 uint32_t ret_ref = 0;
5217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5220 ret_ref = (uintptr_t)ret_var.inner;
5221 if (ret_var.is_owned) {
5227 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5228 CHECK(owner->result_ok);
5229 return PhantomRouteHints_clone(&*owner->contents.result);
5231 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint32_t owner) {
5232 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5233 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5234 uint32_t ret_ref = 0;
5235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5238 ret_ref = (uintptr_t)ret_var.inner;
5239 if (ret_var.is_owned) {
5245 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5246 CHECK(!owner->result_ok);
5247 return DecodeError_clone(&*owner->contents.err);
5249 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint32_t owner) {
5250 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5251 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5252 uint32_t ret_ref = 0;
5253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5256 ret_ref = (uintptr_t)ret_var.inner;
5257 if (ret_var.is_owned) {
5263 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5264 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5265 for (size_t i = 0; i < ret.datalen; i++) {
5266 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5270 typedef struct LDKWatch_JCalls {
5271 atomic_size_t refcnt;
5272 uint32_t instance_ptr;
5274 static void LDKWatch_JCalls_free(void* this_arg) {
5275 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5276 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5280 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5281 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5282 LDKOutPoint funding_txo_var = funding_txo;
5283 uint32_t funding_txo_ref = 0;
5284 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5285 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5286 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5287 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5288 if (funding_txo_var.is_owned) {
5289 funding_txo_ref |= 1;
5291 LDKChannelMonitor monitor_var = monitor;
5292 uint32_t monitor_ref = 0;
5293 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5294 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5295 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5296 monitor_ref = (uintptr_t)monitor_var.inner;
5297 if (monitor_var.is_owned) {
5300 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 16, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
5301 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5302 CHECK_ACCESS(ret_ptr);
5303 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5307 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5308 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5309 LDKOutPoint funding_txo_var = funding_txo;
5310 uint32_t funding_txo_ref = 0;
5311 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5312 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5313 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5314 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5315 if (funding_txo_var.is_owned) {
5316 funding_txo_ref |= 1;
5318 LDKChannelMonitorUpdate update_var = update;
5319 uint32_t update_ref = 0;
5320 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5321 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5322 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5323 update_ref = (uintptr_t)update_var.inner;
5324 if (update_var.is_owned) {
5327 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 17, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
5328 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5329 CHECK_ACCESS(ret_ptr);
5330 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5334 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5335 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5336 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 18);
5337 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5338 ret_constr.datalen = ret->arr_len;
5339 if (ret_constr.datalen > 0)
5340 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5342 ret_constr.data = NULL;
5343 uint32_t* ret_vals = ret->elems;
5344 for (size_t x = 0; x < ret_constr.datalen; x++) {
5345 uint32_t ret_conv_49 = ret_vals[x];
5346 void* ret_conv_49_ptr = (void*)(((uintptr_t)ret_conv_49) & ~1);
5347 CHECK_ACCESS(ret_conv_49_ptr);
5348 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5349 FREE((void*)ret_conv_49);
5350 ret_constr.data[x] = ret_conv_49_conv;
5355 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5356 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5357 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5359 static inline LDKWatch LDKWatch_init (JSValue o) {
5360 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5361 atomic_init(&calls->refcnt, 1);
5362 calls->instance_ptr = o;
5365 .this_arg = (void*) calls,
5366 .watch_channel = watch_channel_LDKWatch_jcall,
5367 .update_channel = update_channel_LDKWatch_jcall,
5368 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5369 .free = LDKWatch_JCalls_free,
5373 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5374 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5375 *res_ptr = LDKWatch_init(o);
5376 return (long)res_ptr;
5378 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5379 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5380 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5381 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5382 LDKOutPoint funding_txo_conv;
5383 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5384 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5385 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5386 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5387 LDKChannelMonitor monitor_conv;
5388 monitor_conv.inner = (void*)(monitor & (~1));
5389 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5390 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5391 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5392 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5393 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5394 return (uint32_t)ret_conv;
5397 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5398 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5399 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5400 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5401 LDKOutPoint funding_txo_conv;
5402 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5403 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5404 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5405 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5406 LDKChannelMonitorUpdate update_conv;
5407 update_conv.inner = (void*)(update & (~1));
5408 update_conv.is_owned = (update & 1) || (update == 0);
5409 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5410 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5411 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5412 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5413 return (uint32_t)ret_conv;
5416 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5417 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5418 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5419 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5420 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5421 uint32_tArray ret_arr = NULL;
5422 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5423 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5424 for (size_t x = 0; x < ret_var.datalen; x++) {
5425 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5426 *ret_conv_49_conv = ret_var.data[x];
5427 ret_arr_ptr[x] = ((uint32_t)ret_conv_49_conv);
5434 typedef struct LDKBroadcasterInterface_JCalls {
5435 atomic_size_t refcnt;
5436 uint32_t instance_ptr;
5437 } LDKBroadcasterInterface_JCalls;
5438 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5439 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5440 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5444 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5445 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5446 LDKTransaction tx_var = tx;
5447 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5448 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5449 Transaction_free(tx_var);
5450 js_invoke_function_u_u(j_calls->instance_ptr, 19, (uint32_t)tx_arr);
5452 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5453 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5454 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5456 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5457 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5458 atomic_init(&calls->refcnt, 1);
5459 calls->instance_ptr = o;
5461 LDKBroadcasterInterface ret = {
5462 .this_arg = (void*) calls,
5463 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5464 .free = LDKBroadcasterInterface_JCalls_free,
5468 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5469 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5470 *res_ptr = LDKBroadcasterInterface_init(o);
5471 return (long)res_ptr;
5473 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
5474 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5475 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5476 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5477 LDKTransaction tx_ref;
5478 tx_ref.datalen = tx->arr_len;
5479 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5480 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5481 tx_ref.data_is_owned = true;
5482 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5485 typedef struct LDKKeysInterface_JCalls {
5486 atomic_size_t refcnt;
5487 uint32_t instance_ptr;
5488 } LDKKeysInterface_JCalls;
5489 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5490 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5491 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5495 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5496 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5497 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5498 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 20, (uint32_t)recipient_conv);
5499 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5500 CHECK_ACCESS(ret_ptr);
5501 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5505 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5506 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5507 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 21);
5508 LDKCVec_u8Z ret_ref;
5509 ret_ref.datalen = ret->arr_len;
5510 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5511 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5514 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5515 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5516 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 22);
5517 LDKShutdownScript ret_conv;
5518 ret_conv.inner = (void*)(ret & (~1));
5519 ret_conv.is_owned = (ret & 1) || (ret == 0);
5520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5523 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5524 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5525 jboolean inbound_conv = inbound;
5526 int64_t channel_value_satoshis_conv = channel_value_satoshis;
5527 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 23, (uint32_t)inbound_conv, (uint32_t)channel_value_satoshis_conv);
5528 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5529 CHECK_ACCESS(ret_ptr);
5530 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5534 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5535 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5536 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 24);
5537 LDKThirtyTwoBytes ret_ref;
5538 CHECK(ret->arr_len == 32);
5539 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5542 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5543 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5544 LDKu8slice reader_var = reader;
5545 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5546 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5547 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 25, (uint32_t)reader_arr);
5548 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5549 CHECK_ACCESS(ret_ptr);
5550 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5554 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5555 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5556 LDKu8slice hrp_bytes_var = hrp_bytes;
5557 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5558 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5559 LDKCVec_u5Z invoice_data_var = invoice_data;
5560 ptrArray invoice_data_arr = NULL;
5561 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5562 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
5563 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5564 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5565 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5568 FREE(invoice_data_var.data);
5569 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5570 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);
5571 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5572 CHECK_ACCESS(ret_ptr);
5573 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5577 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5578 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5579 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 27);
5580 LDKThirtyTwoBytes ret_ref;
5581 CHECK(ret->arr_len == 32);
5582 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5585 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5586 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5587 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5589 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5590 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5591 atomic_init(&calls->refcnt, 1);
5592 calls->instance_ptr = o;
5594 LDKKeysInterface ret = {
5595 .this_arg = (void*) calls,
5596 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5597 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5598 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5599 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5600 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5601 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5602 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5603 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5604 .free = LDKKeysInterface_JCalls_free,
5608 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5609 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5610 *res_ptr = LDKKeysInterface_init(o);
5611 return (long)res_ptr;
5613 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
5614 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5615 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5616 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5617 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5618 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5619 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5620 return (uint32_t)ret_conv;
5623 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
5624 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5625 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5626 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5627 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5628 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5629 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5630 CVec_u8Z_free(ret_var);
5634 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
5635 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5636 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5637 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5638 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5639 uint32_t ret_ref = 0;
5640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5643 ret_ref = (uintptr_t)ret_var.inner;
5644 if (ret_var.is_owned) {
5650 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) {
5651 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5652 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5653 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5654 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5655 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5656 return (uint32_t)ret_ret;
5659 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(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 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5663 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5664 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5668 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
5669 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5670 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5671 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5672 LDKu8slice reader_ref;
5673 reader_ref.datalen = reader->arr_len;
5674 reader_ref.data = reader->elems;
5675 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5676 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5678 return (uint32_t)ret_conv;
5681 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) {
5682 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5683 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5684 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5685 LDKu8slice hrp_bytes_ref;
5686 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5687 hrp_bytes_ref.data = hrp_bytes->elems;
5688 LDKCVec_u5Z invoice_data_constr;
5689 invoice_data_constr.datalen = invoice_data->arr_len;
5690 if (invoice_data_constr.datalen > 0)
5691 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5693 invoice_data_constr.data = NULL;
5694 int8_t* invoice_data_vals = (void*) invoice_data->elems;
5695 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5696 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5698 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5701 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5702 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5703 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5705 return (uint32_t)ret_conv;
5708 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
5709 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5710 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5711 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5712 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5713 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5717 typedef struct LDKFeeEstimator_JCalls {
5718 atomic_size_t refcnt;
5719 uint32_t instance_ptr;
5720 } LDKFeeEstimator_JCalls;
5721 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5722 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5723 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5727 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5728 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5729 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5730 return js_invoke_function_u_u(j_calls->instance_ptr, 28, (uint32_t)confirmation_target_conv);
5732 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5733 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5734 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5736 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5737 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5738 atomic_init(&calls->refcnt, 1);
5739 calls->instance_ptr = o;
5741 LDKFeeEstimator ret = {
5742 .this_arg = (void*) calls,
5743 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5744 .free = LDKFeeEstimator_JCalls_free,
5748 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5749 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5750 *res_ptr = LDKFeeEstimator_init(o);
5751 return (long)res_ptr;
5753 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) {
5754 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5755 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5756 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5757 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5758 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5762 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5763 return ThirtyTwoBytes_clone(&owner->a);
5765 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
5766 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5767 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5768 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5772 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5775 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
5776 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5777 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5778 uint32_t ret_ref = 0;
5779 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5780 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5782 ret_ref = (uintptr_t)ret_var.inner & ~1;
5786 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5787 CHECK(owner->result_ok);
5788 return &*owner->contents.result;
5790 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
5791 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5792 uint32_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
5796 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5797 CHECK(!owner->result_ok);
5798 return DecodeError_clone(&*owner->contents.err);
5800 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
5801 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5802 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5803 uint32_t ret_ref = 0;
5804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5807 ret_ref = (uintptr_t)ret_var.inner;
5808 if (ret_var.is_owned) {
5814 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5815 CHECK(owner->result_ok);
5816 return ChannelConfig_clone(&*owner->contents.result);
5818 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
5819 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5820 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5821 uint32_t ret_ref = 0;
5822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5825 ret_ref = (uintptr_t)ret_var.inner;
5826 if (ret_var.is_owned) {
5832 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5833 CHECK(!owner->result_ok);
5834 return DecodeError_clone(&*owner->contents.err);
5836 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
5837 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5838 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5839 uint32_t ret_ref = 0;
5840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5843 ret_ref = (uintptr_t)ret_var.inner;
5844 if (ret_var.is_owned) {
5850 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5851 CHECK(owner->result_ok);
5852 return OutPoint_clone(&*owner->contents.result);
5854 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
5855 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5856 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5857 uint32_t ret_ref = 0;
5858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5861 ret_ref = (uintptr_t)ret_var.inner;
5862 if (ret_var.is_owned) {
5868 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5869 CHECK(!owner->result_ok);
5870 return DecodeError_clone(&*owner->contents.err);
5872 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
5873 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5874 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5875 uint32_t ret_ref = 0;
5876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5879 ret_ref = (uintptr_t)ret_var.inner;
5880 if (ret_var.is_owned) {
5886 typedef struct LDKType_JCalls {
5887 atomic_size_t refcnt;
5888 uint32_t instance_ptr;
5890 static void LDKType_JCalls_free(void* this_arg) {
5891 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5892 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5896 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5897 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5898 return js_invoke_function_u_(j_calls->instance_ptr, 29);
5900 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5901 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5902 jstring ret = (jstring)js_invoke_function_u_(j_calls->instance_ptr, 30);
5903 LDKStr ret_conv = str_ref_to_owned_c(ret);
5906 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5907 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5908 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 31);
5909 LDKCVec_u8Z ret_ref;
5910 ret_ref.datalen = ret->arr_len;
5911 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5912 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5915 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5916 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5917 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5919 static inline LDKType LDKType_init (JSValue o) {
5920 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5921 atomic_init(&calls->refcnt, 1);
5922 calls->instance_ptr = o;
5925 .this_arg = (void*) calls,
5926 .type_id = type_id_LDKType_jcall,
5927 .debug_str = debug_str_LDKType_jcall,
5928 .write = write_LDKType_jcall,
5929 .cloned = LDKType_JCalls_cloned,
5930 .free = LDKType_JCalls_free,
5934 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5935 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5936 *res_ptr = LDKType_init(o);
5937 return (long)res_ptr;
5939 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
5940 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5941 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5942 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5943 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5947 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
5948 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5949 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5950 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5951 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5952 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5957 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
5958 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5960 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5961 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5962 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5963 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5964 CVec_u8Z_free(ret_var);
5968 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5969 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5971 case LDKCOption_TypeZ_Some: return 0;
5972 case LDKCOption_TypeZ_None: return 1;
5976 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5977 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5978 assert(obj->tag == LDKCOption_TypeZ_Some);
5979 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5980 *some_ret = Type_clone(&obj->some);
5981 return (uint32_t)some_ret;
5983 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5984 CHECK(owner->result_ok);
5985 return COption_TypeZ_clone(&*owner->contents.result);
5987 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5988 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5989 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5990 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5991 uint32_t ret_ref = (uintptr_t)ret_copy;
5995 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5996 CHECK(!owner->result_ok);
5997 return DecodeError_clone(&*owner->contents.err);
5999 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
6000 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6001 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6002 uint32_t ret_ref = 0;
6003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6006 ret_ref = (uintptr_t)ret_var.inner;
6007 if (ret_var.is_owned) {
6013 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
6014 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6016 case LDKPaymentError_Invoice: return 0;
6017 case LDKPaymentError_Routing: return 1;
6018 case LDKPaymentError_Sending: return 2;
6022 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
6023 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6024 assert(obj->tag == LDKPaymentError_Invoice);
6025 LDKStr invoice_str = obj->invoice;
6026 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
6027 return invoice_conv;
6029 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
6030 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6031 assert(obj->tag == LDKPaymentError_Routing);
6032 LDKLightningError routing_var = obj->routing;
6033 uint32_t routing_ref = 0;
6034 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6035 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6036 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6037 routing_ref = (uintptr_t)routing_var.inner & ~1;
6040 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
6041 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6042 assert(obj->tag == LDKPaymentError_Sending);
6043 uint32_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6046 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6047 CHECK(owner->result_ok);
6048 return ThirtyTwoBytes_clone(&*owner->contents.result);
6050 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
6051 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6052 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6053 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
6057 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6058 CHECK(!owner->result_ok);
6059 return PaymentError_clone(&*owner->contents.err);
6061 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
6062 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6063 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6064 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6065 uint32_t ret_ref = (uintptr_t)ret_copy;
6069 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint32_t ptr) {
6070 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6072 case LDKParseError_Bech32Error: return 0;
6073 case LDKParseError_ParseAmountError: return 1;
6074 case LDKParseError_MalformedSignature: return 2;
6075 case LDKParseError_BadPrefix: return 3;
6076 case LDKParseError_UnknownCurrency: return 4;
6077 case LDKParseError_UnknownSiPrefix: return 5;
6078 case LDKParseError_MalformedHRP: return 6;
6079 case LDKParseError_TooShortDataPart: return 7;
6080 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
6081 case LDKParseError_DescriptionDecodeError: return 9;
6082 case LDKParseError_PaddingError: return 10;
6083 case LDKParseError_IntegerOverflowError: return 11;
6084 case LDKParseError_InvalidSegWitProgramLength: return 12;
6085 case LDKParseError_InvalidPubKeyHashLength: return 13;
6086 case LDKParseError_InvalidScriptHashLength: return 14;
6087 case LDKParseError_InvalidRecoveryId: return 15;
6088 case LDKParseError_InvalidSliceLength: return 16;
6089 case LDKParseError_Skip: return 17;
6093 uint32_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint32_t ptr) {
6094 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6095 assert(obj->tag == LDKParseError_Bech32Error);
6096 uint32_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
6097 return bech32_error_ref;
6099 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint32_t ptr) {
6100 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6101 assert(obj->tag == LDKParseError_ParseAmountError);
6102 /*obj->parse_amount_error*/
6105 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint32_t ptr) {
6106 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6107 assert(obj->tag == LDKParseError_MalformedSignature);
6108 uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
6109 return malformed_signature_conv;
6111 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint32_t ptr) {
6112 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6113 assert(obj->tag == LDKParseError_DescriptionDecodeError);
6114 /*obj->description_decode_error*/
6117 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint32_t ptr) {
6118 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6119 assert(obj->tag == LDKParseError_InvalidSliceLength);
6120 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
6121 jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
6122 return invalid_slice_length_conv;
6124 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6125 CHECK(owner->result_ok);
6126 return SiPrefix_clone(&*owner->contents.result);
6128 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint32_t owner) {
6129 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6130 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
6134 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6135 CHECK(!owner->result_ok);
6136 return ParseError_clone(&*owner->contents.err);
6138 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint32_t owner) {
6139 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6140 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6141 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
6142 uint32_t ret_ref = (uintptr_t)ret_copy;
6146 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint32_t ptr) {
6147 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
6149 case LDKParseOrSemanticError_ParseError: return 0;
6150 case LDKParseOrSemanticError_SemanticError: return 1;
6154 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint32_t ptr) {
6155 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
6156 assert(obj->tag == LDKParseOrSemanticError_ParseError);
6157 uint32_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
6158 return parse_error_ref;
6160 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint32_t ptr) {
6161 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
6162 assert(obj->tag == LDKParseOrSemanticError_SemanticError);
6163 uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
6164 return semantic_error_conv;
6166 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6167 CHECK(owner->result_ok);
6168 return Invoice_clone(&*owner->contents.result);
6170 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint32_t owner) {
6171 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
6172 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
6173 uint32_t ret_ref = 0;
6174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6177 ret_ref = (uintptr_t)ret_var.inner;
6178 if (ret_var.is_owned) {
6184 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6185 CHECK(!owner->result_ok);
6186 return ParseOrSemanticError_clone(&*owner->contents.err);
6188 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint32_t owner) {
6189 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
6190 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
6191 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
6192 uint32_t ret_ref = (uintptr_t)ret_copy;
6196 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6197 CHECK(owner->result_ok);
6198 return SignedRawInvoice_clone(&*owner->contents.result);
6200 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint32_t owner) {
6201 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
6202 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
6203 uint32_t ret_ref = 0;
6204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6207 ret_ref = (uintptr_t)ret_var.inner;
6208 if (ret_var.is_owned) {
6214 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6215 CHECK(!owner->result_ok);
6216 return ParseError_clone(&*owner->contents.err);
6218 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint32_t owner) {
6219 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
6220 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6221 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
6222 uint32_t ret_ref = (uintptr_t)ret_copy;
6226 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6227 return RawInvoice_clone(&owner->a);
6229 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
6230 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6231 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6232 uint32_t ret_ref = 0;
6233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6236 ret_ref = (uintptr_t)ret_var.inner;
6237 if (ret_var.is_owned) {
6243 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6244 return ThirtyTwoBytes_clone(&owner->b);
6246 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
6247 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6248 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6249 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
6253 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6254 return InvoiceSignature_clone(&owner->c);
6256 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
6257 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6258 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6259 uint32_t ret_ref = 0;
6260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6263 ret_ref = (uintptr_t)ret_var.inner;
6264 if (ret_var.is_owned) {
6270 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6271 CHECK(owner->result_ok);
6272 return PayeePubKey_clone(&*owner->contents.result);
6274 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
6275 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6276 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6277 uint32_t ret_ref = 0;
6278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6281 ret_ref = (uintptr_t)ret_var.inner;
6282 if (ret_var.is_owned) {
6288 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6289 CHECK(!owner->result_ok);
6290 return *owner->contents.err;
6292 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
6293 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6294 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6298 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6299 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6300 for (size_t i = 0; i < ret.datalen; i++) {
6301 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6305 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6306 CHECK(owner->result_ok);
6307 return PositiveTimestamp_clone(&*owner->contents.result);
6309 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
6310 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6311 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6312 uint32_t ret_ref = 0;
6313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6316 ret_ref = (uintptr_t)ret_var.inner;
6317 if (ret_var.is_owned) {
6323 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6324 CHECK(!owner->result_ok);
6325 return CreationError_clone(&*owner->contents.err);
6327 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
6328 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6329 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6333 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6334 CHECK(owner->result_ok);
6335 return *owner->contents.result;
6337 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
6338 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6339 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6342 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6343 CHECK(!owner->result_ok);
6344 return SemanticError_clone(&*owner->contents.err);
6346 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
6347 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6348 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6352 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6353 CHECK(owner->result_ok);
6354 return Invoice_clone(&*owner->contents.result);
6356 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
6357 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6358 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6359 uint32_t ret_ref = 0;
6360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6363 ret_ref = (uintptr_t)ret_var.inner;
6364 if (ret_var.is_owned) {
6370 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6371 CHECK(!owner->result_ok);
6372 return SemanticError_clone(&*owner->contents.err);
6374 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
6375 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6376 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6380 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6381 CHECK(owner->result_ok);
6382 return Description_clone(&*owner->contents.result);
6384 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
6385 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6386 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6387 uint32_t ret_ref = 0;
6388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6391 ret_ref = (uintptr_t)ret_var.inner;
6392 if (ret_var.is_owned) {
6398 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6399 CHECK(!owner->result_ok);
6400 return CreationError_clone(&*owner->contents.err);
6402 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
6403 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6404 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6408 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6409 CHECK(owner->result_ok);
6410 return PrivateRoute_clone(&*owner->contents.result);
6412 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
6413 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6414 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6415 uint32_t ret_ref = 0;
6416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6419 ret_ref = (uintptr_t)ret_var.inner;
6420 if (ret_var.is_owned) {
6426 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6427 CHECK(!owner->result_ok);
6428 return CreationError_clone(&*owner->contents.err);
6430 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
6431 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6432 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6436 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6437 CHECK(owner->result_ok);
6438 return *owner->contents.result;
6440 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
6441 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6442 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6443 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6447 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6448 CHECK(!owner->result_ok);
6449 return *owner->contents.err;
6451 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
6452 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6453 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6457 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6458 CHECK(owner->result_ok);
6459 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6461 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6462 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6463 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6464 uint32_t ret_ref = 0;
6465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6468 ret_ref = (uintptr_t)ret_var.inner;
6469 if (ret_var.is_owned) {
6475 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6476 CHECK(!owner->result_ok);
6477 return DecodeError_clone(&*owner->contents.err);
6479 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
6480 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6481 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6482 uint32_t ret_ref = 0;
6483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6486 ret_ref = (uintptr_t)ret_var.inner;
6487 if (ret_var.is_owned) {
6493 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
6494 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6496 case LDKCOption_MonitorEventZ_Some: return 0;
6497 case LDKCOption_MonitorEventZ_None: return 1;
6501 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
6502 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6503 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6504 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6507 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6508 CHECK(owner->result_ok);
6509 return COption_MonitorEventZ_clone(&*owner->contents.result);
6511 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
6512 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6513 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6514 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6515 uint32_t ret_ref = (uintptr_t)ret_copy;
6519 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6520 CHECK(!owner->result_ok);
6521 return DecodeError_clone(&*owner->contents.err);
6523 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
6524 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6525 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6526 uint32_t ret_ref = 0;
6527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6530 ret_ref = (uintptr_t)ret_var.inner;
6531 if (ret_var.is_owned) {
6537 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6538 CHECK(owner->result_ok);
6539 return HTLCUpdate_clone(&*owner->contents.result);
6541 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6542 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6543 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6544 uint32_t ret_ref = 0;
6545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6548 ret_ref = (uintptr_t)ret_var.inner;
6549 if (ret_var.is_owned) {
6555 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6556 CHECK(!owner->result_ok);
6557 return DecodeError_clone(&*owner->contents.err);
6559 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
6560 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6561 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6562 uint32_t ret_ref = 0;
6563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6566 ret_ref = (uintptr_t)ret_var.inner;
6567 if (ret_var.is_owned) {
6573 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6574 return OutPoint_clone(&owner->a);
6576 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
6577 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6578 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6579 uint32_t ret_ref = 0;
6580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6583 ret_ref = (uintptr_t)ret_var.inner;
6584 if (ret_var.is_owned) {
6590 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6591 return CVec_u8Z_clone(&owner->b);
6593 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
6594 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6595 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6596 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6597 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6598 CVec_u8Z_free(ret_var);
6602 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6605 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
6606 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6607 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6611 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6612 return CVec_u8Z_clone(&owner->b);
6614 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
6615 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6616 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6617 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6618 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6619 CVec_u8Z_free(ret_var);
6623 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6624 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6625 for (size_t i = 0; i < ret.datalen; i++) {
6626 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6630 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6631 return ThirtyTwoBytes_clone(&owner->a);
6633 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
6634 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6635 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6636 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6640 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6641 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6643 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
6644 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6645 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6646 uint32_tArray ret_arr = NULL;
6647 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6648 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6649 for (size_t v = 0; v < ret_var.datalen; v++) {
6650 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6651 *ret_conv_21_conv = ret_var.data[v];
6652 ret_arr_ptr[v] = ((uint32_t)ret_conv_21_conv);
6659 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6660 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 };
6661 for (size_t i = 0; i < ret.datalen; i++) {
6662 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6666 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6667 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6668 for (size_t i = 0; i < ret.datalen; i++) {
6669 ret.data[i] = Event_clone(&orig->data[i]);
6673 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6676 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
6677 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6678 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6682 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6683 return TxOut_clone(&owner->b);
6685 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
6686 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6687 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6688 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6689 return (uint32_t)ret_ref;
6692 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6693 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6694 for (size_t i = 0; i < ret.datalen; i++) {
6695 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6699 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6700 return ThirtyTwoBytes_clone(&owner->a);
6702 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
6703 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6704 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6705 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6709 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6710 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6712 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
6713 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6714 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6715 uint32_tArray ret_arr = NULL;
6716 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6717 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6718 for (size_t u = 0; u < ret_var.datalen; u++) {
6719 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6720 *ret_conv_20_conv = ret_var.data[u];
6721 ret_arr_ptr[u] = ((uint32_t)ret_conv_20_conv);
6728 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6729 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 };
6730 for (size_t i = 0; i < ret.datalen; i++) {
6731 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6735 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
6736 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6738 case LDKBalance_ClaimableOnChannelClose: return 0;
6739 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6740 case LDKBalance_ContentiousClaimable: return 2;
6741 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6745 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
6746 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6747 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6748 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6749 return claimable_amount_satoshis_conv;
6751 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
6752 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6753 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6754 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6755 return claimable_amount_satoshis_conv;
6757 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
6758 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6759 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6760 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6761 return confirmation_height_conv;
6763 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
6764 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6765 assert(obj->tag == LDKBalance_ContentiousClaimable);
6766 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6767 return claimable_amount_satoshis_conv;
6769 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
6770 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6771 assert(obj->tag == LDKBalance_ContentiousClaimable);
6772 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6773 return timeout_height_conv;
6775 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
6776 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6777 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6778 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6779 return claimable_amount_satoshis_conv;
6781 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
6782 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6783 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6784 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6785 return claimable_height_conv;
6787 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6788 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6789 for (size_t i = 0; i < ret.datalen; i++) {
6790 ret.data[i] = Balance_clone(&orig->data[i]);
6794 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6795 return ThirtyTwoBytes_clone(&owner->a);
6797 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
6798 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6799 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6800 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6804 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6805 return ChannelMonitor_clone(&owner->b);
6807 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
6808 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6809 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6810 uint32_t ret_ref = 0;
6811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6814 ret_ref = (uintptr_t)ret_var.inner;
6815 if (ret_var.is_owned) {
6821 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6822 CHECK(owner->result_ok);
6823 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6825 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
6826 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6827 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6828 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6829 return ((uint32_t)ret_conv);
6832 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6833 CHECK(!owner->result_ok);
6834 return DecodeError_clone(&*owner->contents.err);
6836 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
6837 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6838 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6839 uint32_t ret_ref = 0;
6840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6843 ret_ref = (uintptr_t)ret_var.inner;
6844 if (ret_var.is_owned) {
6850 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6853 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
6854 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6855 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6856 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6860 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6861 return Type_clone(&owner->b);
6863 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
6864 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6865 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6866 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6867 return (uint32_t)ret_ret;
6870 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6871 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6872 for (size_t i = 0; i < ret.datalen; i++) {
6873 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6877 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint32_t ptr) {
6878 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6880 case LDKCOption_NetAddressZ_Some: return 0;
6881 case LDKCOption_NetAddressZ_None: return 1;
6885 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint32_t ptr) {
6886 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6887 assert(obj->tag == LDKCOption_NetAddressZ_Some);
6888 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6891 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6892 CHECK(owner->result_ok);
6893 return CVec_u8Z_clone(&*owner->contents.result);
6895 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
6896 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6897 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6898 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6899 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6900 CVec_u8Z_free(ret_var);
6904 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6905 CHECK(!owner->result_ok);
6906 return PeerHandleError_clone(&*owner->contents.err);
6908 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
6909 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6910 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6911 uint32_t ret_ref = 0;
6912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6915 ret_ref = (uintptr_t)ret_var.inner;
6916 if (ret_var.is_owned) {
6922 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6923 CHECK(owner->result_ok);
6924 return *owner->contents.result;
6926 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
6927 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6928 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6931 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6932 CHECK(!owner->result_ok);
6933 return PeerHandleError_clone(&*owner->contents.err);
6935 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
6936 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6937 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6938 uint32_t ret_ref = 0;
6939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6942 ret_ref = (uintptr_t)ret_var.inner;
6943 if (ret_var.is_owned) {
6949 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6950 CHECK(owner->result_ok);
6951 return *owner->contents.result;
6953 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6954 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6955 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6959 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6960 CHECK(!owner->result_ok);
6961 return PeerHandleError_clone(&*owner->contents.err);
6963 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6964 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6965 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6966 uint32_t ret_ref = 0;
6967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6970 ret_ref = (uintptr_t)ret_var.inner;
6971 if (ret_var.is_owned) {
6977 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6978 CHECK(owner->result_ok);
6979 return *owner->contents.result;
6981 void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint32_t owner) {
6982 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6983 CResult_NoneErrorZ_get_ok(owner_conv);
6986 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6987 CHECK(!owner->result_ok);
6988 return *owner->contents.err;
6990 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint32_t owner) {
6991 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6992 uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6996 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6997 CHECK(owner->result_ok);
6998 return NetAddress_clone(&*owner->contents.result);
7000 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
7001 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
7002 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7003 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7004 uint32_t ret_ref = (uintptr_t)ret_copy;
7008 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7009 CHECK(!owner->result_ok);
7010 return DecodeError_clone(&*owner->contents.err);
7012 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
7013 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
7014 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_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 LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7027 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7028 for (size_t i = 0; i < ret.datalen; i++) {
7029 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7033 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7034 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7035 for (size_t i = 0; i < ret.datalen; i++) {
7036 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7040 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7041 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7042 for (size_t i = 0; i < ret.datalen; i++) {
7043 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7047 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7048 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7049 for (size_t i = 0; i < ret.datalen; i++) {
7050 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7054 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7055 CHECK(owner->result_ok);
7056 return AcceptChannel_clone(&*owner->contents.result);
7058 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
7059 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
7060 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7061 uint32_t ret_ref = 0;
7062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7065 ret_ref = (uintptr_t)ret_var.inner;
7066 if (ret_var.is_owned) {
7072 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7073 CHECK(!owner->result_ok);
7074 return DecodeError_clone(&*owner->contents.err);
7076 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
7077 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
7078 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7079 uint32_t ret_ref = 0;
7080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7083 ret_ref = (uintptr_t)ret_var.inner;
7084 if (ret_var.is_owned) {
7090 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7091 CHECK(owner->result_ok);
7092 return AnnouncementSignatures_clone(&*owner->contents.result);
7094 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
7095 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
7096 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7097 uint32_t ret_ref = 0;
7098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7101 ret_ref = (uintptr_t)ret_var.inner;
7102 if (ret_var.is_owned) {
7108 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7109 CHECK(!owner->result_ok);
7110 return DecodeError_clone(&*owner->contents.err);
7112 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
7113 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
7114 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7115 uint32_t ret_ref = 0;
7116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7119 ret_ref = (uintptr_t)ret_var.inner;
7120 if (ret_var.is_owned) {
7126 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7127 CHECK(owner->result_ok);
7128 return ChannelReestablish_clone(&*owner->contents.result);
7130 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
7131 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
7132 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7133 uint32_t ret_ref = 0;
7134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7137 ret_ref = (uintptr_t)ret_var.inner;
7138 if (ret_var.is_owned) {
7144 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7145 CHECK(!owner->result_ok);
7146 return DecodeError_clone(&*owner->contents.err);
7148 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
7149 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
7150 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7151 uint32_t ret_ref = 0;
7152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7155 ret_ref = (uintptr_t)ret_var.inner;
7156 if (ret_var.is_owned) {
7162 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7163 CHECK(owner->result_ok);
7164 return ClosingSigned_clone(&*owner->contents.result);
7166 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
7167 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
7168 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7169 uint32_t ret_ref = 0;
7170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7173 ret_ref = (uintptr_t)ret_var.inner;
7174 if (ret_var.is_owned) {
7180 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7181 CHECK(!owner->result_ok);
7182 return DecodeError_clone(&*owner->contents.err);
7184 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
7185 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
7186 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7187 uint32_t ret_ref = 0;
7188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7191 ret_ref = (uintptr_t)ret_var.inner;
7192 if (ret_var.is_owned) {
7198 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7199 CHECK(owner->result_ok);
7200 return ClosingSignedFeeRange_clone(&*owner->contents.result);
7202 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
7203 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
7204 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7205 uint32_t ret_ref = 0;
7206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7209 ret_ref = (uintptr_t)ret_var.inner;
7210 if (ret_var.is_owned) {
7216 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7217 CHECK(!owner->result_ok);
7218 return DecodeError_clone(&*owner->contents.err);
7220 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
7221 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
7222 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7223 uint32_t ret_ref = 0;
7224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7227 ret_ref = (uintptr_t)ret_var.inner;
7228 if (ret_var.is_owned) {
7234 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7235 CHECK(owner->result_ok);
7236 return CommitmentSigned_clone(&*owner->contents.result);
7238 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
7239 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
7240 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7241 uint32_t ret_ref = 0;
7242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7245 ret_ref = (uintptr_t)ret_var.inner;
7246 if (ret_var.is_owned) {
7252 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7253 CHECK(!owner->result_ok);
7254 return DecodeError_clone(&*owner->contents.err);
7256 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
7257 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
7258 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7259 uint32_t ret_ref = 0;
7260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7263 ret_ref = (uintptr_t)ret_var.inner;
7264 if (ret_var.is_owned) {
7270 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7271 CHECK(owner->result_ok);
7272 return FundingCreated_clone(&*owner->contents.result);
7274 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
7275 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7276 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7277 uint32_t ret_ref = 0;
7278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7281 ret_ref = (uintptr_t)ret_var.inner;
7282 if (ret_var.is_owned) {
7288 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7289 CHECK(!owner->result_ok);
7290 return DecodeError_clone(&*owner->contents.err);
7292 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
7293 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7294 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7295 uint32_t ret_ref = 0;
7296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7299 ret_ref = (uintptr_t)ret_var.inner;
7300 if (ret_var.is_owned) {
7306 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7307 CHECK(owner->result_ok);
7308 return FundingSigned_clone(&*owner->contents.result);
7310 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
7311 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7312 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7313 uint32_t ret_ref = 0;
7314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7317 ret_ref = (uintptr_t)ret_var.inner;
7318 if (ret_var.is_owned) {
7324 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7325 CHECK(!owner->result_ok);
7326 return DecodeError_clone(&*owner->contents.err);
7328 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
7329 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7330 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7331 uint32_t ret_ref = 0;
7332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7335 ret_ref = (uintptr_t)ret_var.inner;
7336 if (ret_var.is_owned) {
7342 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7343 CHECK(owner->result_ok);
7344 return ChannelReady_clone(&*owner->contents.result);
7346 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint32_t owner) {
7347 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7348 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7349 uint32_t ret_ref = 0;
7350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7353 ret_ref = (uintptr_t)ret_var.inner;
7354 if (ret_var.is_owned) {
7360 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7361 CHECK(!owner->result_ok);
7362 return DecodeError_clone(&*owner->contents.err);
7364 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint32_t owner) {
7365 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7366 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7367 uint32_t ret_ref = 0;
7368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7371 ret_ref = (uintptr_t)ret_var.inner;
7372 if (ret_var.is_owned) {
7378 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7379 CHECK(owner->result_ok);
7380 return Init_clone(&*owner->contents.result);
7382 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
7383 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7384 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7385 uint32_t ret_ref = 0;
7386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7389 ret_ref = (uintptr_t)ret_var.inner;
7390 if (ret_var.is_owned) {
7396 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7397 CHECK(!owner->result_ok);
7398 return DecodeError_clone(&*owner->contents.err);
7400 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
7401 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7402 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7403 uint32_t ret_ref = 0;
7404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7407 ret_ref = (uintptr_t)ret_var.inner;
7408 if (ret_var.is_owned) {
7414 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7415 CHECK(owner->result_ok);
7416 return OpenChannel_clone(&*owner->contents.result);
7418 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
7419 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7420 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7421 uint32_t ret_ref = 0;
7422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7425 ret_ref = (uintptr_t)ret_var.inner;
7426 if (ret_var.is_owned) {
7432 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7433 CHECK(!owner->result_ok);
7434 return DecodeError_clone(&*owner->contents.err);
7436 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
7437 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7438 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7439 uint32_t ret_ref = 0;
7440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7443 ret_ref = (uintptr_t)ret_var.inner;
7444 if (ret_var.is_owned) {
7450 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7451 CHECK(owner->result_ok);
7452 return RevokeAndACK_clone(&*owner->contents.result);
7454 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
7455 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7456 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7457 uint32_t ret_ref = 0;
7458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7461 ret_ref = (uintptr_t)ret_var.inner;
7462 if (ret_var.is_owned) {
7468 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7469 CHECK(!owner->result_ok);
7470 return DecodeError_clone(&*owner->contents.err);
7472 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
7473 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7474 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7475 uint32_t ret_ref = 0;
7476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7479 ret_ref = (uintptr_t)ret_var.inner;
7480 if (ret_var.is_owned) {
7486 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7487 CHECK(owner->result_ok);
7488 return Shutdown_clone(&*owner->contents.result);
7490 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
7491 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7492 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7493 uint32_t ret_ref = 0;
7494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7497 ret_ref = (uintptr_t)ret_var.inner;
7498 if (ret_var.is_owned) {
7504 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7505 CHECK(!owner->result_ok);
7506 return DecodeError_clone(&*owner->contents.err);
7508 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
7509 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7510 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7511 uint32_t ret_ref = 0;
7512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7515 ret_ref = (uintptr_t)ret_var.inner;
7516 if (ret_var.is_owned) {
7522 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7523 CHECK(owner->result_ok);
7524 return UpdateFailHTLC_clone(&*owner->contents.result);
7526 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7527 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7528 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7529 uint32_t ret_ref = 0;
7530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7533 ret_ref = (uintptr_t)ret_var.inner;
7534 if (ret_var.is_owned) {
7540 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7541 CHECK(!owner->result_ok);
7542 return DecodeError_clone(&*owner->contents.err);
7544 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
7545 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7546 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7547 uint32_t ret_ref = 0;
7548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7551 ret_ref = (uintptr_t)ret_var.inner;
7552 if (ret_var.is_owned) {
7558 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7559 CHECK(owner->result_ok);
7560 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
7562 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7563 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7564 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7565 uint32_t ret_ref = 0;
7566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7569 ret_ref = (uintptr_t)ret_var.inner;
7570 if (ret_var.is_owned) {
7576 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7577 CHECK(!owner->result_ok);
7578 return DecodeError_clone(&*owner->contents.err);
7580 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
7581 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7582 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7583 uint32_t ret_ref = 0;
7584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7587 ret_ref = (uintptr_t)ret_var.inner;
7588 if (ret_var.is_owned) {
7594 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7595 CHECK(owner->result_ok);
7596 return UpdateFee_clone(&*owner->contents.result);
7598 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7599 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7600 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7601 uint32_t ret_ref = 0;
7602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7605 ret_ref = (uintptr_t)ret_var.inner;
7606 if (ret_var.is_owned) {
7612 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7613 CHECK(!owner->result_ok);
7614 return DecodeError_clone(&*owner->contents.err);
7616 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7617 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7618 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7619 uint32_t ret_ref = 0;
7620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7623 ret_ref = (uintptr_t)ret_var.inner;
7624 if (ret_var.is_owned) {
7630 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7631 CHECK(owner->result_ok);
7632 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7634 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7635 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7636 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7637 uint32_t ret_ref = 0;
7638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7641 ret_ref = (uintptr_t)ret_var.inner;
7642 if (ret_var.is_owned) {
7648 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7649 CHECK(!owner->result_ok);
7650 return DecodeError_clone(&*owner->contents.err);
7652 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7653 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7654 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7655 uint32_t ret_ref = 0;
7656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7659 ret_ref = (uintptr_t)ret_var.inner;
7660 if (ret_var.is_owned) {
7666 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7667 CHECK(owner->result_ok);
7668 return UpdateAddHTLC_clone(&*owner->contents.result);
7670 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7671 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7672 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7673 uint32_t ret_ref = 0;
7674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7677 ret_ref = (uintptr_t)ret_var.inner;
7678 if (ret_var.is_owned) {
7684 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7685 CHECK(!owner->result_ok);
7686 return DecodeError_clone(&*owner->contents.err);
7688 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7689 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7690 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7691 uint32_t ret_ref = 0;
7692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7695 ret_ref = (uintptr_t)ret_var.inner;
7696 if (ret_var.is_owned) {
7702 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7703 CHECK(owner->result_ok);
7704 return Ping_clone(&*owner->contents.result);
7706 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7707 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7708 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7709 uint32_t ret_ref = 0;
7710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7713 ret_ref = (uintptr_t)ret_var.inner;
7714 if (ret_var.is_owned) {
7720 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7721 CHECK(!owner->result_ok);
7722 return DecodeError_clone(&*owner->contents.err);
7724 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7725 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7726 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7727 uint32_t ret_ref = 0;
7728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7731 ret_ref = (uintptr_t)ret_var.inner;
7732 if (ret_var.is_owned) {
7738 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7739 CHECK(owner->result_ok);
7740 return Pong_clone(&*owner->contents.result);
7742 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7743 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7744 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7745 uint32_t ret_ref = 0;
7746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7749 ret_ref = (uintptr_t)ret_var.inner;
7750 if (ret_var.is_owned) {
7756 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7757 CHECK(!owner->result_ok);
7758 return DecodeError_clone(&*owner->contents.err);
7760 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7761 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7762 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7763 uint32_t ret_ref = 0;
7764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7767 ret_ref = (uintptr_t)ret_var.inner;
7768 if (ret_var.is_owned) {
7774 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7775 CHECK(owner->result_ok);
7776 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7778 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7779 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7780 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7781 uint32_t ret_ref = 0;
7782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7785 ret_ref = (uintptr_t)ret_var.inner;
7786 if (ret_var.is_owned) {
7792 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7793 CHECK(!owner->result_ok);
7794 return DecodeError_clone(&*owner->contents.err);
7796 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7797 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7798 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7799 uint32_t ret_ref = 0;
7800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7803 ret_ref = (uintptr_t)ret_var.inner;
7804 if (ret_var.is_owned) {
7810 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7811 CHECK(owner->result_ok);
7812 return ChannelAnnouncement_clone(&*owner->contents.result);
7814 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7815 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7816 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7817 uint32_t ret_ref = 0;
7818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7821 ret_ref = (uintptr_t)ret_var.inner;
7822 if (ret_var.is_owned) {
7828 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7829 CHECK(!owner->result_ok);
7830 return DecodeError_clone(&*owner->contents.err);
7832 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7833 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7834 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7835 uint32_t ret_ref = 0;
7836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7839 ret_ref = (uintptr_t)ret_var.inner;
7840 if (ret_var.is_owned) {
7846 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7847 CHECK(owner->result_ok);
7848 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7850 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7851 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7852 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7853 uint32_t ret_ref = 0;
7854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7857 ret_ref = (uintptr_t)ret_var.inner;
7858 if (ret_var.is_owned) {
7864 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7865 CHECK(!owner->result_ok);
7866 return DecodeError_clone(&*owner->contents.err);
7868 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7869 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7870 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7871 uint32_t ret_ref = 0;
7872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7875 ret_ref = (uintptr_t)ret_var.inner;
7876 if (ret_var.is_owned) {
7882 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7883 CHECK(owner->result_ok);
7884 return ChannelUpdate_clone(&*owner->contents.result);
7886 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7887 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7888 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7889 uint32_t ret_ref = 0;
7890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7893 ret_ref = (uintptr_t)ret_var.inner;
7894 if (ret_var.is_owned) {
7900 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7901 CHECK(!owner->result_ok);
7902 return DecodeError_clone(&*owner->contents.err);
7904 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7905 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7906 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7907 uint32_t ret_ref = 0;
7908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7911 ret_ref = (uintptr_t)ret_var.inner;
7912 if (ret_var.is_owned) {
7918 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7919 CHECK(owner->result_ok);
7920 return ErrorMessage_clone(&*owner->contents.result);
7922 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7923 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7924 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7925 uint32_t ret_ref = 0;
7926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7929 ret_ref = (uintptr_t)ret_var.inner;
7930 if (ret_var.is_owned) {
7936 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7937 CHECK(!owner->result_ok);
7938 return DecodeError_clone(&*owner->contents.err);
7940 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7941 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7942 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7943 uint32_t ret_ref = 0;
7944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7947 ret_ref = (uintptr_t)ret_var.inner;
7948 if (ret_var.is_owned) {
7954 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7955 CHECK(owner->result_ok);
7956 return WarningMessage_clone(&*owner->contents.result);
7958 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7959 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7960 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7961 uint32_t ret_ref = 0;
7962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7965 ret_ref = (uintptr_t)ret_var.inner;
7966 if (ret_var.is_owned) {
7972 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7973 CHECK(!owner->result_ok);
7974 return DecodeError_clone(&*owner->contents.err);
7976 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7977 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7978 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7979 uint32_t ret_ref = 0;
7980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7983 ret_ref = (uintptr_t)ret_var.inner;
7984 if (ret_var.is_owned) {
7990 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7991 CHECK(owner->result_ok);
7992 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7994 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7995 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7996 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7997 uint32_t ret_ref = 0;
7998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8001 ret_ref = (uintptr_t)ret_var.inner;
8002 if (ret_var.is_owned) {
8008 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8009 CHECK(!owner->result_ok);
8010 return DecodeError_clone(&*owner->contents.err);
8012 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
8013 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
8014 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8015 uint32_t ret_ref = 0;
8016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8019 ret_ref = (uintptr_t)ret_var.inner;
8020 if (ret_var.is_owned) {
8026 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8027 CHECK(owner->result_ok);
8028 return NodeAnnouncement_clone(&*owner->contents.result);
8030 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
8031 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
8032 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8033 uint32_t ret_ref = 0;
8034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8037 ret_ref = (uintptr_t)ret_var.inner;
8038 if (ret_var.is_owned) {
8044 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8045 CHECK(!owner->result_ok);
8046 return DecodeError_clone(&*owner->contents.err);
8048 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
8049 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
8050 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8051 uint32_t ret_ref = 0;
8052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8055 ret_ref = (uintptr_t)ret_var.inner;
8056 if (ret_var.is_owned) {
8062 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8063 CHECK(owner->result_ok);
8064 return QueryShortChannelIds_clone(&*owner->contents.result);
8066 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
8067 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
8068 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8069 uint32_t ret_ref = 0;
8070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8073 ret_ref = (uintptr_t)ret_var.inner;
8074 if (ret_var.is_owned) {
8080 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8081 CHECK(!owner->result_ok);
8082 return DecodeError_clone(&*owner->contents.err);
8084 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
8085 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
8086 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8087 uint32_t ret_ref = 0;
8088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8091 ret_ref = (uintptr_t)ret_var.inner;
8092 if (ret_var.is_owned) {
8098 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8099 CHECK(owner->result_ok);
8100 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
8102 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
8103 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
8104 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8105 uint32_t ret_ref = 0;
8106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8109 ret_ref = (uintptr_t)ret_var.inner;
8110 if (ret_var.is_owned) {
8116 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8117 CHECK(!owner->result_ok);
8118 return DecodeError_clone(&*owner->contents.err);
8120 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
8121 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
8122 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8123 uint32_t ret_ref = 0;
8124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8127 ret_ref = (uintptr_t)ret_var.inner;
8128 if (ret_var.is_owned) {
8134 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8135 CHECK(owner->result_ok);
8136 return QueryChannelRange_clone(&*owner->contents.result);
8138 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
8139 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
8140 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8141 uint32_t ret_ref = 0;
8142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8145 ret_ref = (uintptr_t)ret_var.inner;
8146 if (ret_var.is_owned) {
8152 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8153 CHECK(!owner->result_ok);
8154 return DecodeError_clone(&*owner->contents.err);
8156 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
8157 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
8158 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8159 uint32_t ret_ref = 0;
8160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8163 ret_ref = (uintptr_t)ret_var.inner;
8164 if (ret_var.is_owned) {
8170 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8171 CHECK(owner->result_ok);
8172 return ReplyChannelRange_clone(&*owner->contents.result);
8174 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
8175 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
8176 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8177 uint32_t ret_ref = 0;
8178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8181 ret_ref = (uintptr_t)ret_var.inner;
8182 if (ret_var.is_owned) {
8188 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8189 CHECK(!owner->result_ok);
8190 return DecodeError_clone(&*owner->contents.err);
8192 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
8193 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
8194 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8195 uint32_t ret_ref = 0;
8196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8199 ret_ref = (uintptr_t)ret_var.inner;
8200 if (ret_var.is_owned) {
8206 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8207 CHECK(owner->result_ok);
8208 return GossipTimestampFilter_clone(&*owner->contents.result);
8210 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
8211 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
8212 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8213 uint32_t ret_ref = 0;
8214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8217 ret_ref = (uintptr_t)ret_var.inner;
8218 if (ret_var.is_owned) {
8224 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8225 CHECK(!owner->result_ok);
8226 return DecodeError_clone(&*owner->contents.err);
8228 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
8229 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
8230 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8231 uint32_t ret_ref = 0;
8232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8235 ret_ref = (uintptr_t)ret_var.inner;
8236 if (ret_var.is_owned) {
8242 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
8243 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
8245 case LDKSignOrCreationError_SignError: return 0;
8246 case LDKSignOrCreationError_CreationError: return 1;
8250 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
8251 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
8252 assert(obj->tag == LDKSignOrCreationError_CreationError);
8253 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8254 return creation_error_conv;
8256 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8257 CHECK(owner->result_ok);
8258 return Invoice_clone(&*owner->contents.result);
8260 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
8261 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
8262 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8263 uint32_t ret_ref = 0;
8264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8267 ret_ref = (uintptr_t)ret_var.inner;
8268 if (ret_var.is_owned) {
8274 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8275 CHECK(!owner->result_ok);
8276 return SignOrCreationError_clone(&*owner->contents.err);
8278 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
8279 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
8280 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8281 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8282 uint32_t ret_ref = (uintptr_t)ret_copy;
8286 typedef struct LDKFilter_JCalls {
8287 atomic_size_t refcnt;
8288 uint32_t instance_ptr;
8290 static void LDKFilter_JCalls_free(void* this_arg) {
8291 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8292 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8296 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8297 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8298 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8299 memcpy(txid_arr->elems, *txid, 32);
8300 LDKu8slice script_pubkey_var = script_pubkey;
8301 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8302 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8303 js_invoke_function_u_uu(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
8305 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8306 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8307 LDKWatchedOutput output_var = output;
8308 uint32_t output_ref = 0;
8309 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8310 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8311 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8312 output_ref = (uintptr_t)output_var.inner;
8313 if (output_var.is_owned) {
8316 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 33, (uint32_t)output_ref);
8317 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8318 CHECK_ACCESS(ret_ptr);
8319 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
8323 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8324 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8327 static inline LDKFilter LDKFilter_init (JSValue o) {
8328 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8329 atomic_init(&calls->refcnt, 1);
8330 calls->instance_ptr = o;
8333 .this_arg = (void*) calls,
8334 .register_tx = register_tx_LDKFilter_jcall,
8335 .register_output = register_output_LDKFilter_jcall,
8336 .free = LDKFilter_JCalls_free,
8340 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8341 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8342 *res_ptr = LDKFilter_init(o);
8343 return (long)res_ptr;
8345 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8346 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8348 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8349 unsigned char txid_arr[32];
8350 CHECK(txid->arr_len == 32);
8351 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8352 unsigned char (*txid_ref)[32] = &txid_arr;
8353 LDKu8slice script_pubkey_ref;
8354 script_pubkey_ref.datalen = script_pubkey->arr_len;
8355 script_pubkey_ref.data = script_pubkey->elems;
8356 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8357 FREE(script_pubkey);
8360 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
8361 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8362 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8363 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8364 LDKWatchedOutput output_conv;
8365 output_conv.inner = (void*)(output & (~1));
8366 output_conv.is_owned = (output & 1) || (output == 0);
8367 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8368 output_conv = WatchedOutput_clone(&output_conv);
8369 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8370 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8371 uint32_t ret_ref = (uintptr_t)ret_copy;
8375 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
8376 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8378 case LDKCOption_FilterZ_Some: return 0;
8379 case LDKCOption_FilterZ_None: return 1;
8383 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
8384 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8385 assert(obj->tag == LDKCOption_FilterZ_Some);
8386 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8387 *some_ret = obj->some;
8388 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8389 if ((*some_ret).free == LDKFilter_JCalls_free) {
8390 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8391 LDKFilter_JCalls_cloned(&(*some_ret));
8393 return (uint32_t)some_ret;
8395 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8396 CHECK(owner->result_ok);
8397 return &*owner->contents.result;
8399 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
8400 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8401 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8402 uint32_t ret_ref = 0;
8403 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8404 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8406 ret_ref = (uintptr_t)ret_var.inner & ~1;
8410 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8411 CHECK(!owner->result_ok);
8412 return *owner->contents.err;
8414 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
8415 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8416 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8419 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8420 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8421 for (size_t i = 0; i < ret.datalen; i++) {
8422 ret.data[i] = OutPoint_clone(&orig->data[i]);
8426 typedef struct LDKMessageSendEventsProvider_JCalls {
8427 atomic_size_t refcnt;
8428 uint32_t instance_ptr;
8429 } LDKMessageSendEventsProvider_JCalls;
8430 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8431 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8432 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8436 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8437 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8438 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 34);
8439 LDKCVec_MessageSendEventZ ret_constr;
8440 ret_constr.datalen = ret->arr_len;
8441 if (ret_constr.datalen > 0)
8442 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8444 ret_constr.data = NULL;
8445 uint32_t* ret_vals = ret->elems;
8446 for (size_t s = 0; s < ret_constr.datalen; s++) {
8447 uint32_t ret_conv_18 = ret_vals[s];
8448 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
8449 CHECK_ACCESS(ret_conv_18_ptr);
8450 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8451 FREE((void*)ret_conv_18);
8452 ret_constr.data[s] = ret_conv_18_conv;
8457 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8458 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8461 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8462 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8463 atomic_init(&calls->refcnt, 1);
8464 calls->instance_ptr = o;
8466 LDKMessageSendEventsProvider ret = {
8467 .this_arg = (void*) calls,
8468 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8469 .free = LDKMessageSendEventsProvider_JCalls_free,
8473 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8474 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8475 *res_ptr = LDKMessageSendEventsProvider_init(o);
8476 return (long)res_ptr;
8478 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) {
8479 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8480 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8481 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8482 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8483 uint32_tArray ret_arr = NULL;
8484 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
8485 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8486 for (size_t s = 0; s < ret_var.datalen; s++) {
8487 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8488 *ret_conv_18_copy = ret_var.data[s];
8489 uint32_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
8490 ret_arr_ptr[s] = ret_conv_18_ref;
8497 typedef struct LDKEventHandler_JCalls {
8498 atomic_size_t refcnt;
8499 uint32_t instance_ptr;
8500 } LDKEventHandler_JCalls;
8501 static void LDKEventHandler_JCalls_free(void* this_arg) {
8502 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8507 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8508 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8509 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8510 *ret_event = Event_clone(event);
8511 js_invoke_function_u_u(j_calls->instance_ptr, 35, (uint32_t)(uint32_t)ret_event);
8513 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8514 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8515 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8517 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8518 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8519 atomic_init(&calls->refcnt, 1);
8520 calls->instance_ptr = o;
8522 LDKEventHandler ret = {
8523 .this_arg = (void*) calls,
8524 .handle_event = handle_event_LDKEventHandler_jcall,
8525 .free = LDKEventHandler_JCalls_free,
8529 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8530 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8531 *res_ptr = LDKEventHandler_init(o);
8532 return (long)res_ptr;
8534 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
8535 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8536 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8537 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8538 LDKEvent* event_conv = (LDKEvent*)event;
8539 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8542 typedef struct LDKEventsProvider_JCalls {
8543 atomic_size_t refcnt;
8544 uint32_t instance_ptr;
8545 } LDKEventsProvider_JCalls;
8546 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8547 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8548 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8552 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8553 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8554 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8555 *handler_ret = handler;
8556 js_invoke_function_u_u(j_calls->instance_ptr, 36, (uint32_t)(uint32_t)handler_ret);
8558 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8559 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8560 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8562 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8563 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8564 atomic_init(&calls->refcnt, 1);
8565 calls->instance_ptr = o;
8567 LDKEventsProvider ret = {
8568 .this_arg = (void*) calls,
8569 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8570 .free = LDKEventsProvider_JCalls_free,
8574 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8575 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8576 *res_ptr = LDKEventsProvider_init(o);
8577 return (long)res_ptr;
8579 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
8580 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8581 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8582 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8583 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
8584 CHECK_ACCESS(handler_ptr);
8585 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8586 if (handler_conv.free == LDKEventHandler_JCalls_free) {
8587 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8588 LDKEventHandler_JCalls_cloned(&handler_conv);
8590 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8593 typedef struct LDKScore_JCalls {
8594 atomic_size_t refcnt;
8595 uint32_t instance_ptr;
8597 static void LDKScore_JCalls_free(void* this_arg) {
8598 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8603 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8604 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8605 int64_t short_channel_id_conv = short_channel_id;
8606 LDKNodeId source_var = *source;
8607 uint32_t source_ref = 0;
8608 source_var = NodeId_clone(&source_var);
8609 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8610 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8611 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8612 source_ref = (uintptr_t)source_var.inner;
8613 if (source_var.is_owned) {
8616 LDKNodeId target_var = *target;
8617 uint32_t target_ref = 0;
8618 target_var = NodeId_clone(&target_var);
8619 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8620 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8621 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8622 target_ref = (uintptr_t)target_var.inner;
8623 if (target_var.is_owned) {
8626 LDKChannelUsage usage_var = usage;
8627 uint32_t usage_ref = 0;
8628 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8629 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8630 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8631 usage_ref = (uintptr_t)usage_var.inner;
8632 if (usage_var.is_owned) {
8635 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);
8637 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8638 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8639 LDKCVec_RouteHopZ path_var = path;
8640 uint32_tArray path_arr = NULL;
8641 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8642 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8643 for (size_t k = 0; k < path_var.datalen; k++) {
8644 LDKRouteHop path_conv_10_var = path_var.data[k];
8645 uint32_t path_conv_10_ref = 0;
8646 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8647 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8648 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8649 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8650 if (path_conv_10_var.is_owned) {
8651 path_conv_10_ref |= 1;
8653 path_arr_ptr[k] = path_conv_10_ref;
8656 FREE(path_var.data);
8657 int64_t short_channel_id_conv = short_channel_id;
8658 js_invoke_function_u_bb(j_calls->instance_ptr, 38, (uint32_t)path_arr, (uint32_t)short_channel_id_conv);
8660 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8661 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8662 LDKCVec_RouteHopZ path_var = path;
8663 uint32_tArray path_arr = NULL;
8664 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8665 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8666 for (size_t k = 0; k < path_var.datalen; k++) {
8667 LDKRouteHop path_conv_10_var = path_var.data[k];
8668 uint32_t path_conv_10_ref = 0;
8669 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8670 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8671 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8672 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8673 if (path_conv_10_var.is_owned) {
8674 path_conv_10_ref |= 1;
8676 path_arr_ptr[k] = path_conv_10_ref;
8679 FREE(path_var.data);
8680 js_invoke_function_u_u(j_calls->instance_ptr, 39, (uint32_t)path_arr);
8682 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8683 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8684 LDKCVec_RouteHopZ path_var = path;
8685 uint32_tArray path_arr = NULL;
8686 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8687 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8688 for (size_t k = 0; k < path_var.datalen; k++) {
8689 LDKRouteHop path_conv_10_var = path_var.data[k];
8690 uint32_t path_conv_10_ref = 0;
8691 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8692 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8693 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8694 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8695 if (path_conv_10_var.is_owned) {
8696 path_conv_10_ref |= 1;
8698 path_arr_ptr[k] = path_conv_10_ref;
8701 FREE(path_var.data);
8702 int64_t short_channel_id_conv = short_channel_id;
8703 js_invoke_function_u_bb(j_calls->instance_ptr, 40, (uint32_t)path_arr, (uint32_t)short_channel_id_conv);
8705 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8706 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8707 LDKCVec_RouteHopZ path_var = path;
8708 uint32_tArray path_arr = NULL;
8709 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8710 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8711 for (size_t k = 0; k < path_var.datalen; k++) {
8712 LDKRouteHop path_conv_10_var = path_var.data[k];
8713 uint32_t path_conv_10_ref = 0;
8714 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8715 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8716 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8717 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8718 if (path_conv_10_var.is_owned) {
8719 path_conv_10_ref |= 1;
8721 path_arr_ptr[k] = path_conv_10_ref;
8724 FREE(path_var.data);
8725 js_invoke_function_u_u(j_calls->instance_ptr, 41, (uint32_t)path_arr);
8727 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8728 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8729 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 42);
8730 LDKCVec_u8Z ret_ref;
8731 ret_ref.datalen = ret->arr_len;
8732 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8733 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8736 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8737 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8738 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8740 static inline LDKScore LDKScore_init (JSValue o) {
8741 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8742 atomic_init(&calls->refcnt, 1);
8743 calls->instance_ptr = o;
8746 .this_arg = (void*) calls,
8747 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8748 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8749 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8750 .probe_failed = probe_failed_LDKScore_jcall,
8751 .probe_successful = probe_successful_LDKScore_jcall,
8752 .write = write_LDKScore_jcall,
8753 .free = LDKScore_JCalls_free,
8757 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8758 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8759 *res_ptr = LDKScore_init(o);
8760 return (long)res_ptr;
8762 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) {
8763 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8764 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8765 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8766 LDKNodeId source_conv;
8767 source_conv.inner = (void*)(source & (~1));
8768 source_conv.is_owned = false;
8769 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8770 LDKNodeId target_conv;
8771 target_conv.inner = (void*)(target & (~1));
8772 target_conv.is_owned = false;
8773 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8774 LDKChannelUsage usage_conv;
8775 usage_conv.inner = (void*)(usage & (~1));
8776 usage_conv.is_owned = (usage & 1) || (usage == 0);
8777 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8778 usage_conv = ChannelUsage_clone(&usage_conv);
8779 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8783 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) {
8784 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8785 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8786 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8787 LDKCVec_RouteHopZ path_constr;
8788 path_constr.datalen = path->arr_len;
8789 if (path_constr.datalen > 0)
8790 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8792 path_constr.data = NULL;
8793 uint32_t* path_vals = path->elems;
8794 for (size_t k = 0; k < path_constr.datalen; k++) {
8795 uint32_t path_conv_10 = path_vals[k];
8796 LDKRouteHop path_conv_10_conv;
8797 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8798 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8799 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8800 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8801 path_constr.data[k] = path_conv_10_conv;
8804 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8807 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8808 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8809 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8810 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8811 LDKCVec_RouteHopZ path_constr;
8812 path_constr.datalen = path->arr_len;
8813 if (path_constr.datalen > 0)
8814 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8816 path_constr.data = NULL;
8817 uint32_t* path_vals = path->elems;
8818 for (size_t k = 0; k < path_constr.datalen; k++) {
8819 uint32_t path_conv_10 = path_vals[k];
8820 LDKRouteHop path_conv_10_conv;
8821 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8822 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8823 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8824 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8825 path_constr.data[k] = path_conv_10_conv;
8828 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8831 void __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
8832 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8833 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8834 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8835 LDKCVec_RouteHopZ path_constr;
8836 path_constr.datalen = path->arr_len;
8837 if (path_constr.datalen > 0)
8838 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8840 path_constr.data = NULL;
8841 uint32_t* path_vals = path->elems;
8842 for (size_t k = 0; k < path_constr.datalen; k++) {
8843 uint32_t path_conv_10 = path_vals[k];
8844 LDKRouteHop path_conv_10_conv;
8845 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8846 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8847 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8848 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8849 path_constr.data[k] = path_conv_10_conv;
8852 (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8855 void __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint32_t this_arg, uint32_tArray path) {
8856 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8857 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8858 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8859 LDKCVec_RouteHopZ path_constr;
8860 path_constr.datalen = path->arr_len;
8861 if (path_constr.datalen > 0)
8862 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8864 path_constr.data = NULL;
8865 uint32_t* path_vals = path->elems;
8866 for (size_t k = 0; k < path_constr.datalen; k++) {
8867 uint32_t path_conv_10 = path_vals[k];
8868 LDKRouteHop path_conv_10_conv;
8869 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8870 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8871 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8872 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8873 path_constr.data[k] = path_conv_10_conv;
8876 (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8879 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8880 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8881 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8882 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8883 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8884 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8885 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8886 CVec_u8Z_free(ret_var);
8890 typedef struct LDKPersister_JCalls {
8891 atomic_size_t refcnt;
8892 uint32_t instance_ptr;
8893 } LDKPersister_JCalls;
8894 static void LDKPersister_JCalls_free(void* this_arg) {
8895 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8896 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8900 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8901 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8902 LDKChannelManager channel_manager_var = *channel_manager;
8903 uint32_t channel_manager_ref = 0;
8904 // WARNING: we may need a move here but no clone is available for LDKChannelManager
8905 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8906 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8907 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8908 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
8909 if (channel_manager_var.is_owned) {
8910 channel_manager_ref |= 1;
8912 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 43, (uint32_t)channel_manager_ref);
8913 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8914 CHECK_ACCESS(ret_ptr);
8915 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8919 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8920 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8921 LDKNetworkGraph network_graph_var = *network_graph;
8922 uint32_t network_graph_ref = 0;
8923 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8924 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8925 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8926 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8927 network_graph_ref = (uintptr_t)network_graph_var.inner;
8928 if (network_graph_var.is_owned) {
8929 network_graph_ref |= 1;
8931 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 44, (uint32_t)network_graph_ref);
8932 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8933 CHECK_ACCESS(ret_ptr);
8934 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8938 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
8939 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8940 LDKMultiThreadedLockableScore scorer_var = *scorer;
8941 uint32_t scorer_ref = 0;
8942 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
8943 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8944 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8945 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
8946 scorer_ref = (uintptr_t)scorer_var.inner;
8947 if (scorer_var.is_owned) {
8950 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 45, (uint32_t)scorer_ref);
8951 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8952 CHECK_ACCESS(ret_ptr);
8953 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8957 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8958 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8959 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8961 static inline LDKPersister LDKPersister_init (JSValue o) {
8962 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8963 atomic_init(&calls->refcnt, 1);
8964 calls->instance_ptr = o;
8966 LDKPersister ret = {
8967 .this_arg = (void*) calls,
8968 .persist_manager = persist_manager_LDKPersister_jcall,
8969 .persist_graph = persist_graph_LDKPersister_jcall,
8970 .persist_scorer = persist_scorer_LDKPersister_jcall,
8971 .free = LDKPersister_JCalls_free,
8975 long __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8976 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8977 *res_ptr = LDKPersister_init(o);
8978 return (long)res_ptr;
8980 uint32_t __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
8981 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8983 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8984 LDKChannelManager channel_manager_conv;
8985 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8986 channel_manager_conv.is_owned = false;
8987 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8988 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8989 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8990 return (uint32_t)ret_conv;
8993 uint32_t __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint32_t this_arg, uint32_t network_graph) {
8994 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8995 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8996 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8997 LDKNetworkGraph network_graph_conv;
8998 network_graph_conv.inner = (void*)(network_graph & (~1));
8999 network_graph_conv.is_owned = false;
9000 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
9001 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9002 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
9003 return (uint32_t)ret_conv;
9006 uint32_t __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint32_t this_arg, uint32_t scorer) {
9007 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9008 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9009 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
9010 LDKMultiThreadedLockableScore scorer_conv;
9011 scorer_conv.inner = (void*)(scorer & (~1));
9012 scorer_conv.is_owned = false;
9013 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
9014 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9015 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
9016 return (uint32_t)ret_conv;
9019 typedef struct LDKListen_JCalls {
9020 atomic_size_t refcnt;
9021 uint32_t instance_ptr;
9023 static void LDKListen_JCalls_free(void* this_arg) {
9024 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9025 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9029 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9030 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9031 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9032 memcpy(header_arr->elems, *header, 80);
9033 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9034 uint32_tArray txdata_arr = NULL;
9035 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
9036 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
9037 for (size_t c = 0; c < txdata_var.datalen; c++) {
9038 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9039 *txdata_conv_28_conv = txdata_var.data[c];
9040 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
9043 FREE(txdata_var.data);
9044 int32_t height_conv = height;
9045 js_invoke_function_u_uuu(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
9047 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9048 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9049 LDKu8slice block_var = block;
9050 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
9051 memcpy(block_arr->elems, block_var.data, block_var.datalen);
9052 int32_t height_conv = height;
9053 js_invoke_function_u_uu(j_calls->instance_ptr, 47, (uint32_t)block_arr, (uint32_t)height_conv);
9055 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9056 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9057 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9058 memcpy(header_arr->elems, *header, 80);
9059 int32_t height_conv = height;
9060 js_invoke_function_u_uu(j_calls->instance_ptr, 48, (uint32_t)header_arr, (uint32_t)height_conv);
9062 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9063 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9064 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9066 static inline LDKListen LDKListen_init (JSValue o) {
9067 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9068 atomic_init(&calls->refcnt, 1);
9069 calls->instance_ptr = o;
9072 .this_arg = (void*) calls,
9073 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
9074 .block_connected = block_connected_LDKListen_jcall,
9075 .block_disconnected = block_disconnected_LDKListen_jcall,
9076 .free = LDKListen_JCalls_free,
9080 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
9081 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9082 *res_ptr = LDKListen_init(o);
9083 return (long)res_ptr;
9085 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) {
9086 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9087 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9088 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9089 unsigned char header_arr[80];
9090 CHECK(header->arr_len == 80);
9091 memcpy(header_arr, header->elems, 80); FREE(header);
9092 unsigned char (*header_ref)[80] = &header_arr;
9093 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9094 txdata_constr.datalen = txdata->arr_len;
9095 if (txdata_constr.datalen > 0)
9096 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9098 txdata_constr.data = NULL;
9099 uint32_t* txdata_vals = txdata->elems;
9100 for (size_t c = 0; c < txdata_constr.datalen; c++) {
9101 uint32_t txdata_conv_28 = txdata_vals[c];
9102 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
9103 CHECK_ACCESS(txdata_conv_28_ptr);
9104 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9105 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
9106 txdata_constr.data[c] = txdata_conv_28_conv;
9109 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9112 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
9113 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9114 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9115 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9116 LDKu8slice block_ref;
9117 block_ref.datalen = block->arr_len;
9118 block_ref.data = block->elems;
9119 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9123 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
9124 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9125 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9126 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9127 unsigned char header_arr[80];
9128 CHECK(header->arr_len == 80);
9129 memcpy(header_arr, header->elems, 80); FREE(header);
9130 unsigned char (*header_ref)[80] = &header_arr;
9131 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9134 typedef struct LDKConfirm_JCalls {
9135 atomic_size_t refcnt;
9136 uint32_t instance_ptr;
9137 } LDKConfirm_JCalls;
9138 static void LDKConfirm_JCalls_free(void* this_arg) {
9139 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9140 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9144 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9145 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9146 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9147 memcpy(header_arr->elems, *header, 80);
9148 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9149 uint32_tArray txdata_arr = NULL;
9150 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
9151 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
9152 for (size_t c = 0; c < txdata_var.datalen; c++) {
9153 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9154 *txdata_conv_28_conv = txdata_var.data[c];
9155 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
9158 FREE(txdata_var.data);
9159 int32_t height_conv = height;
9160 js_invoke_function_u_uuu(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
9162 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9163 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9164 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9165 memcpy(txid_arr->elems, *txid, 32);
9166 js_invoke_function_u_u(j_calls->instance_ptr, 50, (uint32_t)txid_arr);
9168 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9169 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9170 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9171 memcpy(header_arr->elems, *header, 80);
9172 int32_t height_conv = height;
9173 js_invoke_function_u_uu(j_calls->instance_ptr, 51, (uint32_t)header_arr, (uint32_t)height_conv);
9175 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9176 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9177 ptrArray ret = (ptrArray)js_invoke_function_u_(j_calls->instance_ptr, 52);
9178 LDKCVec_TxidZ ret_constr;
9179 ret_constr.datalen = ret->arr_len;
9180 if (ret_constr.datalen > 0)
9181 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9183 ret_constr.data = NULL;
9184 int8_tArray* ret_vals = (void*) ret->elems;
9185 for (size_t m = 0; m < ret_constr.datalen; m++) {
9186 int8_tArray ret_conv_12 = ret_vals[m];
9187 LDKThirtyTwoBytes ret_conv_12_ref;
9188 CHECK(ret_conv_12->arr_len == 32);
9189 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
9190 ret_constr.data[m] = ret_conv_12_ref;
9195 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9196 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9197 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9199 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9200 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9201 atomic_init(&calls->refcnt, 1);
9202 calls->instance_ptr = o;
9205 .this_arg = (void*) calls,
9206 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9207 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9208 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9209 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9210 .free = LDKConfirm_JCalls_free,
9214 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9215 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9216 *res_ptr = LDKConfirm_init(o);
9217 return (long)res_ptr;
9219 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) {
9220 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9221 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9222 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9223 unsigned char header_arr[80];
9224 CHECK(header->arr_len == 80);
9225 memcpy(header_arr, header->elems, 80); FREE(header);
9226 unsigned char (*header_ref)[80] = &header_arr;
9227 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9228 txdata_constr.datalen = txdata->arr_len;
9229 if (txdata_constr.datalen > 0)
9230 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9232 txdata_constr.data = NULL;
9233 uint32_t* txdata_vals = txdata->elems;
9234 for (size_t c = 0; c < txdata_constr.datalen; c++) {
9235 uint32_t txdata_conv_28 = txdata_vals[c];
9236 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
9237 CHECK_ACCESS(txdata_conv_28_ptr);
9238 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9239 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
9240 txdata_constr.data[c] = txdata_conv_28_conv;
9243 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9246 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
9247 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9248 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9249 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9250 unsigned char txid_arr[32];
9251 CHECK(txid->arr_len == 32);
9252 memcpy(txid_arr, txid->elems, 32); FREE(txid);
9253 unsigned char (*txid_ref)[32] = &txid_arr;
9254 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9257 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
9258 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9259 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9260 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9261 unsigned char header_arr[80];
9262 CHECK(header->arr_len == 80);
9263 memcpy(header_arr, header->elems, 80); FREE(header);
9264 unsigned char (*header_ref)[80] = &header_arr;
9265 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9268 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
9269 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9270 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9271 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9272 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9273 ptrArray ret_arr = NULL;
9274 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9275 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
9276 for (size_t m = 0; m < ret_var.datalen; m++) {
9277 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
9278 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
9279 ret_arr_ptr[m] = ret_conv_12_arr;
9286 typedef struct LDKPersist_JCalls {
9287 atomic_size_t refcnt;
9288 uint32_t instance_ptr;
9289 } LDKPersist_JCalls;
9290 static void LDKPersist_JCalls_free(void* this_arg) {
9291 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9292 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9296 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9297 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9298 LDKOutPoint channel_id_var = channel_id;
9299 uint32_t channel_id_ref = 0;
9300 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9301 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9302 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9303 channel_id_ref = (uintptr_t)channel_id_var.inner;
9304 if (channel_id_var.is_owned) {
9305 channel_id_ref |= 1;
9307 LDKChannelMonitor data_var = *data;
9308 uint32_t data_ref = 0;
9309 data_var = ChannelMonitor_clone(&data_var);
9310 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9311 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9312 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9313 data_ref = (uintptr_t)data_var.inner;
9314 if (data_var.is_owned) {
9317 LDKMonitorUpdateId update_id_var = update_id;
9318 uint32_t update_id_ref = 0;
9319 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9320 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9321 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9322 update_id_ref = (uintptr_t)update_id_var.inner;
9323 if (update_id_var.is_owned) {
9326 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 53, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
9327 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9328 CHECK_ACCESS(ret_ptr);
9329 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9333 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9334 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9335 LDKOutPoint channel_id_var = channel_id;
9336 uint32_t channel_id_ref = 0;
9337 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9338 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9339 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9340 channel_id_ref = (uintptr_t)channel_id_var.inner;
9341 if (channel_id_var.is_owned) {
9342 channel_id_ref |= 1;
9344 LDKChannelMonitorUpdate update_var = *update;
9345 uint32_t update_ref = 0;
9346 if ((uintptr_t)update_var.inner > 4096) {
9347 update_var = ChannelMonitorUpdate_clone(&update_var);
9348 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9349 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9350 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9351 update_ref = (uintptr_t)update_var.inner;
9352 if (update_var.is_owned) {
9356 LDKChannelMonitor data_var = *data;
9357 uint32_t data_ref = 0;
9358 data_var = ChannelMonitor_clone(&data_var);
9359 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9360 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9361 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9362 data_ref = (uintptr_t)data_var.inner;
9363 if (data_var.is_owned) {
9366 LDKMonitorUpdateId update_id_var = update_id;
9367 uint32_t update_id_ref = 0;
9368 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9369 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9370 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9371 update_id_ref = (uintptr_t)update_id_var.inner;
9372 if (update_id_var.is_owned) {
9375 uint32_t ret = js_invoke_function_u_uuuu(j_calls->instance_ptr, 54, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
9376 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9377 CHECK_ACCESS(ret_ptr);
9378 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9382 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9383 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9384 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9386 static inline LDKPersist LDKPersist_init (JSValue o) {
9387 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9388 atomic_init(&calls->refcnt, 1);
9389 calls->instance_ptr = o;
9392 .this_arg = (void*) calls,
9393 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9394 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9395 .free = LDKPersist_JCalls_free,
9399 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9400 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9401 *res_ptr = LDKPersist_init(o);
9402 return (long)res_ptr;
9404 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) {
9405 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9406 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9407 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9408 LDKOutPoint channel_id_conv;
9409 channel_id_conv.inner = (void*)(channel_id & (~1));
9410 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9411 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9412 channel_id_conv = OutPoint_clone(&channel_id_conv);
9413 LDKChannelMonitor data_conv;
9414 data_conv.inner = (void*)(data & (~1));
9415 data_conv.is_owned = false;
9416 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9417 LDKMonitorUpdateId update_id_conv;
9418 update_id_conv.inner = (void*)(update_id & (~1));
9419 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9420 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9421 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9422 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9423 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9424 return (uint32_t)ret_conv;
9427 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) {
9428 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9429 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9430 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9431 LDKOutPoint channel_id_conv;
9432 channel_id_conv.inner = (void*)(channel_id & (~1));
9433 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9434 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9435 channel_id_conv = OutPoint_clone(&channel_id_conv);
9436 LDKChannelMonitorUpdate update_conv;
9437 update_conv.inner = (void*)(update & (~1));
9438 update_conv.is_owned = false;
9439 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9440 LDKChannelMonitor data_conv;
9441 data_conv.inner = (void*)(data & (~1));
9442 data_conv.is_owned = false;
9443 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9444 LDKMonitorUpdateId update_id_conv;
9445 update_id_conv.inner = (void*)(update_id & (~1));
9446 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9447 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9448 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9449 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9450 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9451 return (uint32_t)ret_conv;
9454 typedef struct LDKChannelMessageHandler_JCalls {
9455 atomic_size_t refcnt;
9456 uint32_t instance_ptr;
9457 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9458 } LDKChannelMessageHandler_JCalls;
9459 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9460 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9461 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9465 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9466 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9467 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9468 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9469 LDKInitFeatures their_features_var = their_features;
9470 uint32_t their_features_ref = 0;
9471 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9472 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9473 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9474 their_features_ref = (uintptr_t)their_features_var.inner;
9475 if (their_features_var.is_owned) {
9476 their_features_ref |= 1;
9478 LDKOpenChannel msg_var = *msg;
9479 uint32_t msg_ref = 0;
9480 msg_var = OpenChannel_clone(&msg_var);
9481 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9482 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9483 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9484 msg_ref = (uintptr_t)msg_var.inner;
9485 if (msg_var.is_owned) {
9488 js_invoke_function_u_uuu(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9490 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9491 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9492 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9493 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9494 LDKInitFeatures their_features_var = their_features;
9495 uint32_t their_features_ref = 0;
9496 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9497 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9498 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9499 their_features_ref = (uintptr_t)their_features_var.inner;
9500 if (their_features_var.is_owned) {
9501 their_features_ref |= 1;
9503 LDKAcceptChannel msg_var = *msg;
9504 uint32_t msg_ref = 0;
9505 msg_var = AcceptChannel_clone(&msg_var);
9506 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9507 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9508 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9509 msg_ref = (uintptr_t)msg_var.inner;
9510 if (msg_var.is_owned) {
9513 js_invoke_function_u_uuu(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9515 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9516 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9517 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9518 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9519 LDKFundingCreated msg_var = *msg;
9520 uint32_t msg_ref = 0;
9521 msg_var = FundingCreated_clone(&msg_var);
9522 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9523 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9525 msg_ref = (uintptr_t)msg_var.inner;
9526 if (msg_var.is_owned) {
9529 js_invoke_function_u_uu(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9531 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9532 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9533 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9534 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9535 LDKFundingSigned msg_var = *msg;
9536 uint32_t msg_ref = 0;
9537 msg_var = FundingSigned_clone(&msg_var);
9538 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9539 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9540 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9541 msg_ref = (uintptr_t)msg_var.inner;
9542 if (msg_var.is_owned) {
9545 js_invoke_function_u_uu(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9547 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9548 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9549 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9550 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9551 LDKChannelReady msg_var = *msg;
9552 uint32_t msg_ref = 0;
9553 msg_var = ChannelReady_clone(&msg_var);
9554 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9555 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9556 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9557 msg_ref = (uintptr_t)msg_var.inner;
9558 if (msg_var.is_owned) {
9561 js_invoke_function_u_uu(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9563 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9564 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9565 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9566 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9567 LDKInitFeatures their_features_var = *their_features;
9568 uint32_t their_features_ref = 0;
9569 their_features_var = InitFeatures_clone(&their_features_var);
9570 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9571 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9572 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9573 their_features_ref = (uintptr_t)their_features_var.inner;
9574 if (their_features_var.is_owned) {
9575 their_features_ref |= 1;
9577 LDKShutdown msg_var = *msg;
9578 uint32_t msg_ref = 0;
9579 msg_var = Shutdown_clone(&msg_var);
9580 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9581 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9582 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9583 msg_ref = (uintptr_t)msg_var.inner;
9584 if (msg_var.is_owned) {
9587 js_invoke_function_u_uuu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9589 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9590 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9591 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9592 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9593 LDKClosingSigned msg_var = *msg;
9594 uint32_t msg_ref = 0;
9595 msg_var = ClosingSigned_clone(&msg_var);
9596 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9597 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9598 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9599 msg_ref = (uintptr_t)msg_var.inner;
9600 if (msg_var.is_owned) {
9603 js_invoke_function_u_uu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9605 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9606 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9607 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9608 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9609 LDKUpdateAddHTLC msg_var = *msg;
9610 uint32_t msg_ref = 0;
9611 msg_var = UpdateAddHTLC_clone(&msg_var);
9612 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9613 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9614 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9615 msg_ref = (uintptr_t)msg_var.inner;
9616 if (msg_var.is_owned) {
9619 js_invoke_function_u_uu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9621 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9622 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9623 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9624 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9625 LDKUpdateFulfillHTLC msg_var = *msg;
9626 uint32_t msg_ref = 0;
9627 msg_var = UpdateFulfillHTLC_clone(&msg_var);
9628 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9629 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9630 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9631 msg_ref = (uintptr_t)msg_var.inner;
9632 if (msg_var.is_owned) {
9635 js_invoke_function_u_uu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9637 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9638 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9639 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9640 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9641 LDKUpdateFailHTLC msg_var = *msg;
9642 uint32_t msg_ref = 0;
9643 msg_var = UpdateFailHTLC_clone(&msg_var);
9644 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9645 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9646 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9647 msg_ref = (uintptr_t)msg_var.inner;
9648 if (msg_var.is_owned) {
9651 js_invoke_function_u_uu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9653 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9654 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9655 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9656 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9657 LDKUpdateFailMalformedHTLC msg_var = *msg;
9658 uint32_t msg_ref = 0;
9659 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9660 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9661 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9662 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9663 msg_ref = (uintptr_t)msg_var.inner;
9664 if (msg_var.is_owned) {
9667 js_invoke_function_u_uu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9669 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9670 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9671 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9672 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9673 LDKCommitmentSigned msg_var = *msg;
9674 uint32_t msg_ref = 0;
9675 msg_var = CommitmentSigned_clone(&msg_var);
9676 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9677 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9679 msg_ref = (uintptr_t)msg_var.inner;
9680 if (msg_var.is_owned) {
9683 js_invoke_function_u_uu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9685 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9686 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9687 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9688 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9689 LDKRevokeAndACK msg_var = *msg;
9690 uint32_t msg_ref = 0;
9691 msg_var = RevokeAndACK_clone(&msg_var);
9692 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9693 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9694 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9695 msg_ref = (uintptr_t)msg_var.inner;
9696 if (msg_var.is_owned) {
9699 js_invoke_function_u_uu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9701 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9702 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9703 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9704 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9705 LDKUpdateFee msg_var = *msg;
9706 uint32_t msg_ref = 0;
9707 msg_var = UpdateFee_clone(&msg_var);
9708 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9709 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9710 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9711 msg_ref = (uintptr_t)msg_var.inner;
9712 if (msg_var.is_owned) {
9715 js_invoke_function_u_uu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9717 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9718 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9719 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9720 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9721 LDKAnnouncementSignatures msg_var = *msg;
9722 uint32_t msg_ref = 0;
9723 msg_var = AnnouncementSignatures_clone(&msg_var);
9724 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9725 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9726 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9727 msg_ref = (uintptr_t)msg_var.inner;
9728 if (msg_var.is_owned) {
9731 js_invoke_function_u_uu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9733 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9734 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9735 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9736 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9737 jboolean no_connection_possible_conv = no_connection_possible;
9738 js_invoke_function_u_uu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible_conv);
9740 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9741 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9742 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9743 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9744 LDKInit msg_var = *msg;
9745 uint32_t msg_ref = 0;
9746 msg_var = Init_clone(&msg_var);
9747 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9750 msg_ref = (uintptr_t)msg_var.inner;
9751 if (msg_var.is_owned) {
9754 js_invoke_function_u_uu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9756 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9757 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9758 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9759 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9760 LDKChannelReestablish msg_var = *msg;
9761 uint32_t msg_ref = 0;
9762 msg_var = ChannelReestablish_clone(&msg_var);
9763 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9764 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9765 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9766 msg_ref = (uintptr_t)msg_var.inner;
9767 if (msg_var.is_owned) {
9770 js_invoke_function_u_uu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9772 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9773 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9774 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9775 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9776 LDKChannelUpdate msg_var = *msg;
9777 uint32_t msg_ref = 0;
9778 msg_var = ChannelUpdate_clone(&msg_var);
9779 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9780 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9781 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9782 msg_ref = (uintptr_t)msg_var.inner;
9783 if (msg_var.is_owned) {
9786 js_invoke_function_u_uu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9788 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9789 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9790 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9791 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9792 LDKErrorMessage msg_var = *msg;
9793 uint32_t msg_ref = 0;
9794 msg_var = ErrorMessage_clone(&msg_var);
9795 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9796 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9797 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9798 msg_ref = (uintptr_t)msg_var.inner;
9799 if (msg_var.is_owned) {
9802 js_invoke_function_u_uu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9804 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9805 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9806 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9807 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9809 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9810 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9811 atomic_init(&calls->refcnt, 1);
9812 calls->instance_ptr = o;
9814 LDKChannelMessageHandler ret = {
9815 .this_arg = (void*) calls,
9816 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9817 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9818 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9819 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9820 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9821 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9822 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9823 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9824 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9825 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9826 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9827 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9828 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9829 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9830 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9831 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9832 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9833 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9834 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9835 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9836 .free = LDKChannelMessageHandler_JCalls_free,
9837 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9839 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9842 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9843 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9844 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9845 return (long)res_ptr;
9847 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) {
9848 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9849 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9850 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9851 LDKPublicKey their_node_id_ref;
9852 CHECK(their_node_id->arr_len == 33);
9853 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9854 LDKInitFeatures their_features_conv;
9855 their_features_conv.inner = (void*)(their_features & (~1));
9856 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9857 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9858 their_features_conv = InitFeatures_clone(&their_features_conv);
9859 LDKOpenChannel msg_conv;
9860 msg_conv.inner = (void*)(msg & (~1));
9861 msg_conv.is_owned = false;
9862 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9863 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9866 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) {
9867 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9868 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9869 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9870 LDKPublicKey their_node_id_ref;
9871 CHECK(their_node_id->arr_len == 33);
9872 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9873 LDKInitFeatures their_features_conv;
9874 their_features_conv.inner = (void*)(their_features & (~1));
9875 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9876 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9877 their_features_conv = InitFeatures_clone(&their_features_conv);
9878 LDKAcceptChannel msg_conv;
9879 msg_conv.inner = (void*)(msg & (~1));
9880 msg_conv.is_owned = false;
9881 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9882 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9885 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) {
9886 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9887 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9888 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9889 LDKPublicKey their_node_id_ref;
9890 CHECK(their_node_id->arr_len == 33);
9891 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9892 LDKFundingCreated msg_conv;
9893 msg_conv.inner = (void*)(msg & (~1));
9894 msg_conv.is_owned = false;
9895 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9896 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9899 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) {
9900 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9901 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9902 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9903 LDKPublicKey their_node_id_ref;
9904 CHECK(their_node_id->arr_len == 33);
9905 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9906 LDKFundingSigned msg_conv;
9907 msg_conv.inner = (void*)(msg & (~1));
9908 msg_conv.is_owned = false;
9909 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9910 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9913 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) {
9914 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9915 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9916 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9917 LDKPublicKey their_node_id_ref;
9918 CHECK(their_node_id->arr_len == 33);
9919 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9920 LDKChannelReady msg_conv;
9921 msg_conv.inner = (void*)(msg & (~1));
9922 msg_conv.is_owned = false;
9923 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9924 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9927 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) {
9928 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9929 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9930 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9931 LDKPublicKey their_node_id_ref;
9932 CHECK(their_node_id->arr_len == 33);
9933 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9934 LDKInitFeatures their_features_conv;
9935 their_features_conv.inner = (void*)(their_features & (~1));
9936 their_features_conv.is_owned = false;
9937 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9938 LDKShutdown msg_conv;
9939 msg_conv.inner = (void*)(msg & (~1));
9940 msg_conv.is_owned = false;
9941 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9942 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9945 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) {
9946 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9947 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9948 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9949 LDKPublicKey their_node_id_ref;
9950 CHECK(their_node_id->arr_len == 33);
9951 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9952 LDKClosingSigned msg_conv;
9953 msg_conv.inner = (void*)(msg & (~1));
9954 msg_conv.is_owned = false;
9955 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9956 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9959 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) {
9960 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9961 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9962 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9963 LDKPublicKey their_node_id_ref;
9964 CHECK(their_node_id->arr_len == 33);
9965 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9966 LDKUpdateAddHTLC msg_conv;
9967 msg_conv.inner = (void*)(msg & (~1));
9968 msg_conv.is_owned = false;
9969 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9970 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9973 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) {
9974 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9975 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9976 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9977 LDKPublicKey their_node_id_ref;
9978 CHECK(their_node_id->arr_len == 33);
9979 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9980 LDKUpdateFulfillHTLC msg_conv;
9981 msg_conv.inner = (void*)(msg & (~1));
9982 msg_conv.is_owned = false;
9983 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9984 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9987 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) {
9988 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9989 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9990 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9991 LDKPublicKey their_node_id_ref;
9992 CHECK(their_node_id->arr_len == 33);
9993 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9994 LDKUpdateFailHTLC msg_conv;
9995 msg_conv.inner = (void*)(msg & (~1));
9996 msg_conv.is_owned = false;
9997 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9998 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10001 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) {
10002 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10003 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10004 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10005 LDKPublicKey their_node_id_ref;
10006 CHECK(their_node_id->arr_len == 33);
10007 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10008 LDKUpdateFailMalformedHTLC msg_conv;
10009 msg_conv.inner = (void*)(msg & (~1));
10010 msg_conv.is_owned = false;
10011 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10012 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10015 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) {
10016 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10017 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10018 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10019 LDKPublicKey their_node_id_ref;
10020 CHECK(their_node_id->arr_len == 33);
10021 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10022 LDKCommitmentSigned msg_conv;
10023 msg_conv.inner = (void*)(msg & (~1));
10024 msg_conv.is_owned = false;
10025 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10026 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10029 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) {
10030 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10032 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10033 LDKPublicKey their_node_id_ref;
10034 CHECK(their_node_id->arr_len == 33);
10035 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10036 LDKRevokeAndACK 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 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10043 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) {
10044 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10045 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10046 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10047 LDKPublicKey their_node_id_ref;
10048 CHECK(their_node_id->arr_len == 33);
10049 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10050 LDKUpdateFee msg_conv;
10051 msg_conv.inner = (void*)(msg & (~1));
10052 msg_conv.is_owned = false;
10053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10054 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10057 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) {
10058 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10059 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10060 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10061 LDKPublicKey their_node_id_ref;
10062 CHECK(their_node_id->arr_len == 33);
10063 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10064 LDKAnnouncementSignatures msg_conv;
10065 msg_conv.inner = (void*)(msg & (~1));
10066 msg_conv.is_owned = false;
10067 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10068 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10071 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) {
10072 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10073 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10074 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10075 LDKPublicKey their_node_id_ref;
10076 CHECK(their_node_id->arr_len == 33);
10077 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10078 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10081 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
10082 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10083 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10084 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10085 LDKPublicKey their_node_id_ref;
10086 CHECK(their_node_id->arr_len == 33);
10087 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10089 msg_conv.inner = (void*)(msg & (~1));
10090 msg_conv.is_owned = false;
10091 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10092 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10095 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) {
10096 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10097 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10098 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10099 LDKPublicKey their_node_id_ref;
10100 CHECK(their_node_id->arr_len == 33);
10101 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10102 LDKChannelReestablish msg_conv;
10103 msg_conv.inner = (void*)(msg & (~1));
10104 msg_conv.is_owned = false;
10105 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10106 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10109 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) {
10110 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10111 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10112 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10113 LDKPublicKey their_node_id_ref;
10114 CHECK(their_node_id->arr_len == 33);
10115 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10116 LDKChannelUpdate msg_conv;
10117 msg_conv.inner = (void*)(msg & (~1));
10118 msg_conv.is_owned = false;
10119 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10120 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10123 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
10124 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10125 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10126 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10127 LDKPublicKey their_node_id_ref;
10128 CHECK(their_node_id->arr_len == 33);
10129 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10130 LDKErrorMessage msg_conv;
10131 msg_conv.inner = (void*)(msg & (~1));
10132 msg_conv.is_owned = false;
10133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10134 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10137 typedef struct LDKRoutingMessageHandler_JCalls {
10138 atomic_size_t refcnt;
10139 uint32_t instance_ptr;
10140 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10141 } LDKRoutingMessageHandler_JCalls;
10142 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
10143 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10144 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10148 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
10149 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10150 LDKNodeAnnouncement msg_var = *msg;
10151 uint32_t msg_ref = 0;
10152 msg_var = NodeAnnouncement_clone(&msg_var);
10153 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10154 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10155 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10156 msg_ref = (uintptr_t)msg_var.inner;
10157 if (msg_var.is_owned) {
10160 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 75, (uint32_t)msg_ref);
10161 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10162 CHECK_ACCESS(ret_ptr);
10163 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10167 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
10168 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10169 LDKChannelAnnouncement msg_var = *msg;
10170 uint32_t msg_ref = 0;
10171 msg_var = ChannelAnnouncement_clone(&msg_var);
10172 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10173 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10174 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10175 msg_ref = (uintptr_t)msg_var.inner;
10176 if (msg_var.is_owned) {
10179 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 76, (uint32_t)msg_ref);
10180 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10181 CHECK_ACCESS(ret_ptr);
10182 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10186 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10187 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10188 LDKChannelUpdate msg_var = *msg;
10189 uint32_t msg_ref = 0;
10190 msg_var = ChannelUpdate_clone(&msg_var);
10191 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10192 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10194 msg_ref = (uintptr_t)msg_var.inner;
10195 if (msg_var.is_owned) {
10198 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 77, (uint32_t)msg_ref);
10199 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10200 CHECK_ACCESS(ret_ptr);
10201 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10205 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
10206 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10207 int64_t starting_point_conv = starting_point;
10208 int8_t batch_amount_conv = batch_amount;
10209 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 78, (uint32_t)starting_point_conv, (uint32_t)batch_amount_conv);
10210 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
10211 ret_constr.datalen = ret->arr_len;
10212 if (ret_constr.datalen > 0)
10213 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
10215 ret_constr.data = NULL;
10216 uint32_t* ret_vals = ret->elems;
10217 for (size_t h = 0; h < ret_constr.datalen; h++) {
10218 uint32_t ret_conv_59 = ret_vals[h];
10219 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
10220 CHECK_ACCESS(ret_conv_59_ptr);
10221 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
10222 FREE((void*)ret_conv_59);
10223 ret_constr.data[h] = ret_conv_59_conv;
10228 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
10229 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10230 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
10231 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
10232 int8_t batch_amount_conv = batch_amount;
10233 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 79, (uint32_t)starting_point_arr, (uint32_t)batch_amount_conv);
10234 LDKCVec_NodeAnnouncementZ ret_constr;
10235 ret_constr.datalen = ret->arr_len;
10236 if (ret_constr.datalen > 0)
10237 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
10239 ret_constr.data = NULL;
10240 uint32_t* ret_vals = ret->elems;
10241 for (size_t s = 0; s < ret_constr.datalen; s++) {
10242 uint32_t ret_conv_18 = ret_vals[s];
10243 LDKNodeAnnouncement ret_conv_18_conv;
10244 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
10245 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
10246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
10247 ret_constr.data[s] = ret_conv_18_conv;
10252 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10253 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10254 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10255 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10256 LDKInit init_var = *init;
10257 uint32_t init_ref = 0;
10258 init_var = Init_clone(&init_var);
10259 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10260 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10261 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10262 init_ref = (uintptr_t)init_var.inner;
10263 if (init_var.is_owned) {
10266 js_invoke_function_u_uu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
10268 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10269 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10270 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10271 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10272 LDKReplyChannelRange msg_var = msg;
10273 uint32_t msg_ref = 0;
10274 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10275 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10276 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10277 msg_ref = (uintptr_t)msg_var.inner;
10278 if (msg_var.is_owned) {
10281 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
10282 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10283 CHECK_ACCESS(ret_ptr);
10284 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10288 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10289 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10290 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10291 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10292 LDKReplyShortChannelIdsEnd msg_var = msg;
10293 uint32_t msg_ref = 0;
10294 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10295 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10296 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10297 msg_ref = (uintptr_t)msg_var.inner;
10298 if (msg_var.is_owned) {
10301 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
10302 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10303 CHECK_ACCESS(ret_ptr);
10304 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10308 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10309 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10310 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10311 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10312 LDKQueryChannelRange msg_var = msg;
10313 uint32_t msg_ref = 0;
10314 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10315 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10316 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10317 msg_ref = (uintptr_t)msg_var.inner;
10318 if (msg_var.is_owned) {
10321 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
10322 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10323 CHECK_ACCESS(ret_ptr);
10324 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10328 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10329 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10330 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10331 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10332 LDKQueryShortChannelIds msg_var = msg;
10333 uint32_t msg_ref = 0;
10334 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10335 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10336 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10337 msg_ref = (uintptr_t)msg_var.inner;
10338 if (msg_var.is_owned) {
10341 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
10342 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10343 CHECK_ACCESS(ret_ptr);
10344 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10348 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10349 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10350 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10351 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10353 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10354 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10355 atomic_init(&calls->refcnt, 1);
10356 calls->instance_ptr = o;
10358 LDKRoutingMessageHandler ret = {
10359 .this_arg = (void*) calls,
10360 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10361 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10362 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10363 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
10364 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
10365 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10366 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10367 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10368 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10369 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10370 .free = LDKRoutingMessageHandler_JCalls_free,
10371 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10373 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10376 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10377 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10378 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10379 return (long)res_ptr;
10381 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
10382 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10383 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10384 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10385 LDKNodeAnnouncement msg_conv;
10386 msg_conv.inner = (void*)(msg & (~1));
10387 msg_conv.is_owned = false;
10388 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10389 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10390 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10391 return (uint32_t)ret_conv;
10394 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
10395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10397 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10398 LDKChannelAnnouncement msg_conv;
10399 msg_conv.inner = (void*)(msg & (~1));
10400 msg_conv.is_owned = false;
10401 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10402 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10403 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10404 return (uint32_t)ret_conv;
10407 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
10408 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10409 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10410 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10411 LDKChannelUpdate msg_conv;
10412 msg_conv.inner = (void*)(msg & (~1));
10413 msg_conv.is_owned = false;
10414 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10415 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10416 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10417 return (uint32_t)ret_conv;
10420 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) {
10421 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10422 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10423 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10424 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
10425 uint32_tArray ret_arr = NULL;
10426 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10427 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10428 for (size_t h = 0; h < ret_var.datalen; h++) {
10429 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10430 *ret_conv_59_conv = ret_var.data[h];
10431 ret_arr_ptr[h] = ((uint32_t)ret_conv_59_conv);
10434 FREE(ret_var.data);
10438 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) {
10439 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10441 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10442 LDKPublicKey starting_point_ref;
10443 CHECK(starting_point->arr_len == 33);
10444 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10445 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
10446 uint32_tArray ret_arr = NULL;
10447 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10448 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10449 for (size_t s = 0; s < ret_var.datalen; s++) {
10450 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
10451 uint32_t ret_conv_18_ref = 0;
10452 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10453 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
10455 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
10456 if (ret_conv_18_var.is_owned) {
10457 ret_conv_18_ref |= 1;
10459 ret_arr_ptr[s] = ret_conv_18_ref;
10462 FREE(ret_var.data);
10466 void __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
10467 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10468 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10469 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10470 LDKPublicKey their_node_id_ref;
10471 CHECK(their_node_id->arr_len == 33);
10472 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10474 init_conv.inner = (void*)(init & (~1));
10475 init_conv.is_owned = false;
10476 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10477 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10480 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) {
10481 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10482 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10483 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10484 LDKPublicKey their_node_id_ref;
10485 CHECK(their_node_id->arr_len == 33);
10486 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10487 LDKReplyChannelRange msg_conv;
10488 msg_conv.inner = (void*)(msg & (~1));
10489 msg_conv.is_owned = (msg & 1) || (msg == 0);
10490 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10491 msg_conv = ReplyChannelRange_clone(&msg_conv);
10492 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10493 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10494 return (uint32_t)ret_conv;
10497 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) {
10498 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10499 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10500 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10501 LDKPublicKey their_node_id_ref;
10502 CHECK(their_node_id->arr_len == 33);
10503 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10504 LDKReplyShortChannelIdsEnd msg_conv;
10505 msg_conv.inner = (void*)(msg & (~1));
10506 msg_conv.is_owned = (msg & 1) || (msg == 0);
10507 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10508 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10509 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10510 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10511 return (uint32_t)ret_conv;
10514 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) {
10515 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10516 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10517 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10518 LDKPublicKey their_node_id_ref;
10519 CHECK(their_node_id->arr_len == 33);
10520 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10521 LDKQueryChannelRange msg_conv;
10522 msg_conv.inner = (void*)(msg & (~1));
10523 msg_conv.is_owned = (msg & 1) || (msg == 0);
10524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10525 msg_conv = QueryChannelRange_clone(&msg_conv);
10526 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10527 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10528 return (uint32_t)ret_conv;
10531 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) {
10532 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10534 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10535 LDKPublicKey their_node_id_ref;
10536 CHECK(their_node_id->arr_len == 33);
10537 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10538 LDKQueryShortChannelIds msg_conv;
10539 msg_conv.inner = (void*)(msg & (~1));
10540 msg_conv.is_owned = (msg & 1) || (msg == 0);
10541 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10542 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10543 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10544 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10545 return (uint32_t)ret_conv;
10548 typedef struct LDKCustomMessageReader_JCalls {
10549 atomic_size_t refcnt;
10550 uint32_t instance_ptr;
10551 } LDKCustomMessageReader_JCalls;
10552 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10553 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10554 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10558 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10559 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10560 int16_t message_type_conv = message_type;
10561 LDKu8slice buffer_var = buffer;
10562 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10563 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10564 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 85, (uint32_t)message_type_conv, (uint32_t)buffer_arr);
10565 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10566 CHECK_ACCESS(ret_ptr);
10567 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10571 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10572 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10573 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10575 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10576 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10577 atomic_init(&calls->refcnt, 1);
10578 calls->instance_ptr = o;
10580 LDKCustomMessageReader ret = {
10581 .this_arg = (void*) calls,
10582 .read = read_LDKCustomMessageReader_jcall,
10583 .free = LDKCustomMessageReader_JCalls_free,
10587 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10588 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10589 *res_ptr = LDKCustomMessageReader_init(o);
10590 return (long)res_ptr;
10592 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
10593 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10594 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10595 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10596 LDKu8slice buffer_ref;
10597 buffer_ref.datalen = buffer->arr_len;
10598 buffer_ref.data = buffer->elems;
10599 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10600 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10602 return (uint32_t)ret_conv;
10605 typedef struct LDKCustomMessageHandler_JCalls {
10606 atomic_size_t refcnt;
10607 uint32_t instance_ptr;
10608 LDKCustomMessageReader_JCalls* CustomMessageReader;
10609 } LDKCustomMessageHandler_JCalls;
10610 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10611 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10612 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10616 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10617 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10618 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10620 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10621 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10622 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 86, (uint32_t)(uint32_t)msg_ret, (uint32_t)sender_node_id_arr);
10623 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10624 CHECK_ACCESS(ret_ptr);
10625 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10629 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10630 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10631 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 87);
10632 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10633 ret_constr.datalen = ret->arr_len;
10634 if (ret_constr.datalen > 0)
10635 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10637 ret_constr.data = NULL;
10638 uint32_t* ret_vals = ret->elems;
10639 for (size_t z = 0; z < ret_constr.datalen; z++) {
10640 uint32_t ret_conv_25 = ret_vals[z];
10641 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
10642 CHECK_ACCESS(ret_conv_25_ptr);
10643 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10644 FREE((void*)ret_conv_25);
10645 ret_constr.data[z] = ret_conv_25_conv;
10650 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10651 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10652 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10653 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10655 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10656 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10657 atomic_init(&calls->refcnt, 1);
10658 calls->instance_ptr = o;
10660 LDKCustomMessageHandler ret = {
10661 .this_arg = (void*) calls,
10662 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10663 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10664 .free = LDKCustomMessageHandler_JCalls_free,
10665 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10667 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10670 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10671 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10672 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10673 return (long)res_ptr;
10675 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) {
10676 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10677 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10678 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10679 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
10680 CHECK_ACCESS(msg_ptr);
10681 LDKType msg_conv = *(LDKType*)(msg_ptr);
10682 if (msg_conv.free == LDKType_JCalls_free) {
10683 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10684 LDKType_JCalls_cloned(&msg_conv);
10686 LDKPublicKey sender_node_id_ref;
10687 CHECK(sender_node_id->arr_len == 33);
10688 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10689 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10690 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10691 return (uint32_t)ret_conv;
10694 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
10695 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10696 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10697 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10698 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10699 uint32_tArray ret_arr = NULL;
10700 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10701 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10702 for (size_t z = 0; z < ret_var.datalen; z++) {
10703 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10704 *ret_conv_25_conv = ret_var.data[z];
10705 ret_arr_ptr[z] = ((uint32_t)ret_conv_25_conv);
10708 FREE(ret_var.data);
10712 typedef struct LDKSocketDescriptor_JCalls {
10713 atomic_size_t refcnt;
10714 uint32_t instance_ptr;
10715 } LDKSocketDescriptor_JCalls;
10716 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10717 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10718 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10722 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10723 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10724 LDKu8slice data_var = data;
10725 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10726 memcpy(data_arr->elems, data_var.data, data_var.datalen);
10727 jboolean resume_read_conv = resume_read;
10728 return js_invoke_function_u_uu(j_calls->instance_ptr, 88, (uint32_t)data_arr, (uint32_t)resume_read_conv);
10730 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10731 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10732 js_invoke_function_u_(j_calls->instance_ptr, 89);
10734 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10735 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10736 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10737 *other_arg_clone = SocketDescriptor_clone(other_arg);
10738 return js_invoke_function_u_u(j_calls->instance_ptr, 90, (uint32_t)(uint32_t)other_arg_clone);
10740 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10741 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10742 return js_invoke_function_b_(j_calls->instance_ptr, 91);
10744 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10745 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10746 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10748 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10749 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10750 atomic_init(&calls->refcnt, 1);
10751 calls->instance_ptr = o;
10753 LDKSocketDescriptor ret = {
10754 .this_arg = (void*) calls,
10755 .send_data = send_data_LDKSocketDescriptor_jcall,
10756 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10757 .eq = eq_LDKSocketDescriptor_jcall,
10758 .hash = hash_LDKSocketDescriptor_jcall,
10759 .cloned = LDKSocketDescriptor_JCalls_cloned,
10760 .free = LDKSocketDescriptor_JCalls_free,
10764 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10765 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10766 *res_ptr = LDKSocketDescriptor_init(o);
10767 return (long)res_ptr;
10769 uint32_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
10770 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10771 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10772 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10773 LDKu8slice data_ref;
10774 data_ref.datalen = data->arr_len;
10775 data_ref.data = data->elems;
10776 uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10781 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
10782 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10783 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10784 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10785 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10788 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
10789 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10790 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10791 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10792 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10796 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
10797 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10799 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10800 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10801 case LDKEffectiveCapacity_Total: return 2;
10802 case LDKEffectiveCapacity_Infinite: return 3;
10803 case LDKEffectiveCapacity_Unknown: return 4;
10807 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
10808 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10809 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10810 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10811 return liquidity_msat_conv;
10813 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
10814 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10815 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10816 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10817 return amount_msat_conv;
10819 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
10820 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10821 assert(obj->tag == LDKEffectiveCapacity_Total);
10822 int64_t capacity_msat_conv = obj->total.capacity_msat;
10823 return capacity_msat_conv;
10825 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint32_t ptr) {
10826 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10827 assert(obj->tag == LDKEffectiveCapacity_Total);
10828 uint32_t htlc_maximum_msat_ref = ((uintptr_t)&obj->total.htlc_maximum_msat) | 1;
10829 return htlc_maximum_msat_ref;
10831 typedef struct LDKLockableScore_JCalls {
10832 atomic_size_t refcnt;
10833 uint32_t instance_ptr;
10834 } LDKLockableScore_JCalls;
10835 static void LDKLockableScore_JCalls_free(void* this_arg) {
10836 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10837 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10841 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10842 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10843 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 92);
10844 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10845 CHECK_ACCESS(ret_ptr);
10846 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10847 if (ret_conv.free == LDKScore_JCalls_free) {
10848 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10849 LDKScore_JCalls_cloned(&ret_conv);
10850 }// WARNING: we may need a move here but no clone is available for LDKScore
10854 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10855 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10856 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10858 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10859 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10860 atomic_init(&calls->refcnt, 1);
10861 calls->instance_ptr = o;
10863 LDKLockableScore ret = {
10864 .this_arg = (void*) calls,
10865 .lock = lock_LDKLockableScore_jcall,
10866 .free = LDKLockableScore_JCalls_free,
10870 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10871 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10872 *res_ptr = LDKLockableScore_init(o);
10873 return (long)res_ptr;
10875 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
10876 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10877 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10878 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10879 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10880 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10881 return (uint32_t)ret_ret;
10884 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
10885 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10887 case LDKFallback_SegWitProgram: return 0;
10888 case LDKFallback_PubKeyHash: return 1;
10889 case LDKFallback_ScriptHash: return 2;
10893 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
10894 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10895 assert(obj->tag == LDKFallback_SegWitProgram);
10896 uint8_t version_val = obj->seg_wit_program.version._0;
10897 return version_val;
10899 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
10900 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10901 assert(obj->tag == LDKFallback_SegWitProgram);
10902 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10903 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10904 memcpy(program_arr->elems, program_var.data, program_var.datalen);
10905 return program_arr;
10907 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
10908 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10909 assert(obj->tag == LDKFallback_PubKeyHash);
10910 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10911 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10912 return pub_key_hash_arr;
10914 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
10915 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10916 assert(obj->tag == LDKFallback_ScriptHash);
10917 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10918 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10919 return script_hash_arr;
10921 typedef struct LDKPayer_JCalls {
10922 atomic_size_t refcnt;
10923 uint32_t instance_ptr;
10925 static void LDKPayer_JCalls_free(void* this_arg) {
10926 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10927 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10931 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10932 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10933 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 93);
10934 LDKPublicKey ret_ref;
10935 CHECK(ret->arr_len == 33);
10936 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10939 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10940 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10941 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 94);
10942 LDKCVec_ChannelDetailsZ ret_constr;
10943 ret_constr.datalen = ret->arr_len;
10944 if (ret_constr.datalen > 0)
10945 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10947 ret_constr.data = NULL;
10948 uint32_t* ret_vals = ret->elems;
10949 for (size_t q = 0; q < ret_constr.datalen; q++) {
10950 uint32_t ret_conv_16 = ret_vals[q];
10951 LDKChannelDetails ret_conv_16_conv;
10952 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10953 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10955 ret_constr.data[q] = ret_conv_16_conv;
10960 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10961 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10962 LDKRoute route_var = *route;
10963 uint32_t route_ref = 0;
10964 route_var = Route_clone(&route_var);
10965 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10966 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10967 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10968 route_ref = (uintptr_t)route_var.inner;
10969 if (route_var.is_owned) {
10972 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10973 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10974 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10975 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10976 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 95, (uint32_t)route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr);
10977 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10978 CHECK_ACCESS(ret_ptr);
10979 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10983 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10984 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10985 LDKRoute route_var = *route;
10986 uint32_t route_ref = 0;
10987 route_var = Route_clone(&route_var);
10988 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10989 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10990 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10991 route_ref = (uintptr_t)route_var.inner;
10992 if (route_var.is_owned) {
10995 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10996 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10997 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 96, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10998 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10999 CHECK_ACCESS(ret_ptr);
11000 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
11004 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
11005 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11006 LDKRoute route_var = *route;
11007 uint32_t route_ref = 0;
11008 route_var = Route_clone(&route_var);
11009 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11010 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11011 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11012 route_ref = (uintptr_t)route_var.inner;
11013 if (route_var.is_owned) {
11016 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11017 memcpy(payment_id_arr->elems, payment_id.data, 32);
11018 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 97, (uint32_t)route_ref, (uint32_t)payment_id_arr);
11019 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11020 CHECK_ACCESS(ret_ptr);
11021 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11025 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
11026 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11027 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11028 memcpy(payment_id_arr->elems, payment_id.data, 32);
11029 js_invoke_function_u_u(j_calls->instance_ptr, 98, (uint32_t)payment_id_arr);
11031 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
11032 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
11033 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11035 static inline LDKPayer LDKPayer_init (JSValue o) {
11036 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
11037 atomic_init(&calls->refcnt, 1);
11038 calls->instance_ptr = o;
11041 .this_arg = (void*) calls,
11042 .node_id = node_id_LDKPayer_jcall,
11043 .first_hops = first_hops_LDKPayer_jcall,
11044 .send_payment = send_payment_LDKPayer_jcall,
11045 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
11046 .retry_payment = retry_payment_LDKPayer_jcall,
11047 .abandon_payment = abandon_payment_LDKPayer_jcall,
11048 .free = LDKPayer_JCalls_free,
11052 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
11053 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
11054 *res_ptr = LDKPayer_init(o);
11055 return (long)res_ptr;
11057 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
11058 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11059 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11060 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11061 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
11062 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
11066 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
11067 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11068 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11069 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11070 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
11071 uint32_tArray ret_arr = NULL;
11072 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
11073 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
11074 for (size_t q = 0; q < ret_var.datalen; q++) {
11075 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11076 uint32_t ret_conv_16_ref = 0;
11077 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11078 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
11080 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
11081 if (ret_conv_16_var.is_owned) {
11082 ret_conv_16_ref |= 1;
11084 ret_arr_ptr[q] = ret_conv_16_ref;
11087 FREE(ret_var.data);
11091 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) {
11092 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11093 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11094 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11095 LDKRoute route_conv;
11096 route_conv.inner = (void*)(route & (~1));
11097 route_conv.is_owned = false;
11098 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11099 LDKThirtyTwoBytes payment_hash_ref;
11100 CHECK(payment_hash->arr_len == 32);
11101 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
11102 LDKThirtyTwoBytes payment_secret_ref;
11103 CHECK(payment_secret->arr_len == 32);
11104 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
11105 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11106 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
11107 return (uint32_t)ret_conv;
11110 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) {
11111 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11112 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11113 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11114 LDKRoute route_conv;
11115 route_conv.inner = (void*)(route & (~1));
11116 route_conv.is_owned = false;
11117 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11118 LDKThirtyTwoBytes payment_preimage_ref;
11119 CHECK(payment_preimage->arr_len == 32);
11120 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
11121 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11122 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
11123 return (uint32_t)ret_conv;
11126 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
11127 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11128 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11129 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11130 LDKRoute route_conv;
11131 route_conv.inner = (void*)(route & (~1));
11132 route_conv.is_owned = false;
11133 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11134 LDKThirtyTwoBytes payment_id_ref;
11135 CHECK(payment_id->arr_len == 32);
11136 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11137 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11138 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
11139 return (uint32_t)ret_conv;
11142 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
11143 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11144 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11145 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11146 LDKThirtyTwoBytes payment_id_ref;
11147 CHECK(payment_id->arr_len == 32);
11148 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11149 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
11152 typedef struct LDKRouter_JCalls {
11153 atomic_size_t refcnt;
11154 uint32_t instance_ptr;
11155 } LDKRouter_JCalls;
11156 static void LDKRouter_JCalls_free(void* this_arg) {
11157 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11158 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11162 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) {
11163 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11164 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
11165 memcpy(payer_arr->elems, payer.compressed_form, 33);
11166 LDKRouteParameters route_params_var = *route_params;
11167 uint32_t route_params_ref = 0;
11168 route_params_var = RouteParameters_clone(&route_params_var);
11169 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11170 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11171 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
11172 route_params_ref = (uintptr_t)route_params_var.inner;
11173 if (route_params_var.is_owned) {
11174 route_params_ref |= 1;
11176 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11177 memcpy(payment_hash_arr->elems, *payment_hash, 32);
11178 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
11179 uint32_tArray first_hops_arr = NULL;
11180 if (first_hops != NULL) {
11181 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
11182 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
11183 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
11184 for (size_t q = 0; q < first_hops_var.datalen; q++) {
11185 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
11186 uint32_t first_hops_conv_16_ref = 0;
11187 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11188 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11189 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
11190 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
11191 if (first_hops_conv_16_var.is_owned) {
11192 first_hops_conv_16_ref |= 1;
11194 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
11198 // WARNING: This object doesn't live past this scope, needs clone!
11199 uint32_t ret_scorer = ((uintptr_t)scorer) | 1;
11200 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 99, (uint32_t)payer_arr, (uint32_t)route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, (uint32_t)ret_scorer);
11201 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11202 CHECK_ACCESS(ret_ptr);
11203 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
11207 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
11208 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
11209 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11211 static inline LDKRouter LDKRouter_init (JSValue o) {
11212 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
11213 atomic_init(&calls->refcnt, 1);
11214 calls->instance_ptr = o;
11217 .this_arg = (void*) calls,
11218 .find_route = find_route_LDKRouter_jcall,
11219 .free = LDKRouter_JCalls_free,
11223 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
11224 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
11225 *res_ptr = LDKRouter_init(o);
11226 return (long)res_ptr;
11228 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) {
11229 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11230 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11231 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11232 LDKPublicKey payer_ref;
11233 CHECK(payer->arr_len == 33);
11234 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11235 LDKRouteParameters route_params_conv;
11236 route_params_conv.inner = (void*)(route_params & (~1));
11237 route_params_conv.is_owned = false;
11238 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11239 unsigned char payment_hash_arr[32];
11240 CHECK(payment_hash->arr_len == 32);
11241 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
11242 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11243 LDKCVec_ChannelDetailsZ first_hops_constr;
11244 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11245 if (first_hops != 0) {
11246 first_hops_constr.datalen = first_hops->arr_len;
11247 if (first_hops_constr.datalen > 0)
11248 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11250 first_hops_constr.data = NULL;
11251 uint32_t* first_hops_vals = first_hops->elems;
11252 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11253 uint32_t first_hops_conv_16 = first_hops_vals[q];
11254 LDKChannelDetails first_hops_conv_16_conv;
11255 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
11256 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
11257 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11258 first_hops_constr.data[q] = first_hops_conv_16_conv;
11261 first_hops_ptr = &first_hops_constr;
11263 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
11264 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
11265 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
11266 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11267 *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);
11268 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11269 return (uint32_t)ret_conv;
11272 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint32_t ptr) {
11273 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
11275 case LDKRetry_Attempts: return 0;
11279 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint32_t ptr) {
11280 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
11281 assert(obj->tag == LDKRetry_Attempts);
11282 uint32_t attempts_conv = obj->attempts;
11283 return attempts_conv;
11285 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11286 LDKStr ret_str = _ldk_get_compiled_version();
11287 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11292 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11293 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11294 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11299 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11300 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11301 *ret_copy = Bech32Error_clone(arg);
11302 uint32_t ret_ref = (uintptr_t)ret_copy;
11305 uint32_t __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint32_t arg) {
11306 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
11307 uint32_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11311 uint32_t __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint32_t orig) {
11312 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
11313 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11314 *ret_copy = Bech32Error_clone(orig_conv);
11315 uint32_t ret_ref = (uintptr_t)ret_copy;
11319 void __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint32_t o) {
11320 if ((o & 1) != 0) return;
11321 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
11322 CHECK_ACCESS(o_ptr);
11323 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11325 Bech32Error_free(o_conv);
11328 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11329 LDKTransaction _res_ref;
11330 _res_ref.datalen = _res->arr_len;
11331 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11332 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11333 _res_ref.data_is_owned = true;
11334 Transaction_free(_res_ref);
11337 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11338 LDKCVec_u8Z script_pubkey_ref;
11339 script_pubkey_ref.datalen = script_pubkey->arr_len;
11340 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11341 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11342 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11343 *ret_ref = TxOut_new(script_pubkey_ref, value);
11344 return (uint32_t)ret_ref;
11347 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
11348 if ((_res & 1) != 0) return;
11349 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11350 CHECK_ACCESS(_res_ptr);
11351 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11353 TxOut_free(_res_conv);
11356 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11357 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11358 *ret_ref = TxOut_clone(arg);
11359 return (uint32_t)ret_ref;
11361 uint32_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
11362 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
11363 uint32_t ret_conv = TxOut_clone_ptr(arg_conv);
11367 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
11368 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
11369 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11370 *ret_ref = TxOut_clone(orig_conv);
11371 return (uint32_t)ret_ref;
11374 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11375 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11379 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11380 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11381 *ret_conv = CResult_NoneNoneZ_ok();
11382 return (uint32_t)ret_conv;
11385 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11386 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11387 *ret_conv = CResult_NoneNoneZ_err();
11388 return (uint32_t)ret_conv;
11391 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
11392 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
11393 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11397 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
11398 if ((_res & 1) != 0) return;
11399 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11400 CHECK_ACCESS(_res_ptr);
11401 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11403 CResult_NoneNoneZ_free(_res_conv);
11406 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11407 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11408 *ret_conv = CResult_NoneNoneZ_clone(arg);
11409 return (uint32_t)ret_conv;
11411 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
11412 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
11413 uint32_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11417 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
11418 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11419 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11420 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11421 return (uint32_t)ret_conv;
11424 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
11425 LDKCounterpartyCommitmentSecrets o_conv;
11426 o_conv.inner = (void*)(o & (~1));
11427 o_conv.is_owned = (o & 1) || (o == 0);
11428 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11429 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11430 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11431 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11432 return (uint32_t)ret_conv;
11435 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
11436 LDKDecodeError e_conv;
11437 e_conv.inner = (void*)(e & (~1));
11438 e_conv.is_owned = (e & 1) || (e == 0);
11439 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11440 e_conv = DecodeError_clone(&e_conv);
11441 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11442 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11443 return (uint32_t)ret_conv;
11446 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
11447 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
11448 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11452 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
11453 if ((_res & 1) != 0) return;
11454 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11455 CHECK_ACCESS(_res_ptr);
11456 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11458 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11461 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11462 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11463 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11464 return (uint32_t)ret_conv;
11466 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
11467 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
11468 uint32_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11472 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
11473 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
11474 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11475 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11476 return (uint32_t)ret_conv;
11479 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11480 LDKSecretKey o_ref;
11481 CHECK(o->arr_len == 32);
11482 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11483 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11484 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11485 return (uint32_t)ret_conv;
11488 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11489 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11490 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11491 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11492 return (uint32_t)ret_conv;
11495 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
11496 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
11497 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11501 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
11502 if ((_res & 1) != 0) return;
11503 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11504 CHECK_ACCESS(_res_ptr);
11505 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11507 CResult_SecretKeyErrorZ_free(_res_conv);
11510 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11511 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11512 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11513 return (uint32_t)ret_conv;
11515 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
11516 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
11517 uint32_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11521 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
11522 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
11523 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11524 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11525 return (uint32_t)ret_conv;
11528 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11529 LDKPublicKey o_ref;
11530 CHECK(o->arr_len == 33);
11531 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11532 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11533 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11534 return (uint32_t)ret_conv;
11537 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11538 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11539 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11540 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11541 return (uint32_t)ret_conv;
11544 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
11545 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
11546 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11550 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
11551 if ((_res & 1) != 0) return;
11552 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11553 CHECK_ACCESS(_res_ptr);
11554 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11556 CResult_PublicKeyErrorZ_free(_res_conv);
11559 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11560 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11561 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11562 return (uint32_t)ret_conv;
11564 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
11565 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
11566 uint32_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11570 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
11571 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11572 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11573 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11574 return (uint32_t)ret_conv;
11577 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
11578 LDKTxCreationKeys o_conv;
11579 o_conv.inner = (void*)(o & (~1));
11580 o_conv.is_owned = (o & 1) || (o == 0);
11581 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11582 o_conv = TxCreationKeys_clone(&o_conv);
11583 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11584 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11585 return (uint32_t)ret_conv;
11588 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
11589 LDKDecodeError e_conv;
11590 e_conv.inner = (void*)(e & (~1));
11591 e_conv.is_owned = (e & 1) || (e == 0);
11592 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11593 e_conv = DecodeError_clone(&e_conv);
11594 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11595 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11596 return (uint32_t)ret_conv;
11599 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
11600 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
11601 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11605 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
11606 if ((_res & 1) != 0) return;
11607 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11608 CHECK_ACCESS(_res_ptr);
11609 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11611 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11614 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11615 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11616 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11617 return (uint32_t)ret_conv;
11619 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11620 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
11621 uint32_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11625 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
11626 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11627 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11628 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11629 return (uint32_t)ret_conv;
11632 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
11633 LDKChannelPublicKeys o_conv;
11634 o_conv.inner = (void*)(o & (~1));
11635 o_conv.is_owned = (o & 1) || (o == 0);
11636 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11637 o_conv = ChannelPublicKeys_clone(&o_conv);
11638 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11639 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11640 return (uint32_t)ret_conv;
11643 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
11644 LDKDecodeError e_conv;
11645 e_conv.inner = (void*)(e & (~1));
11646 e_conv.is_owned = (e & 1) || (e == 0);
11647 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11648 e_conv = DecodeError_clone(&e_conv);
11649 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11650 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11651 return (uint32_t)ret_conv;
11654 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
11655 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
11656 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11660 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
11661 if ((_res & 1) != 0) return;
11662 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11663 CHECK_ACCESS(_res_ptr);
11664 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11666 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11669 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11670 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11671 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11672 return (uint32_t)ret_conv;
11674 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11675 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
11676 uint32_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11680 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
11681 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11682 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11683 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11684 return (uint32_t)ret_conv;
11687 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
11688 LDKTxCreationKeys o_conv;
11689 o_conv.inner = (void*)(o & (~1));
11690 o_conv.is_owned = (o & 1) || (o == 0);
11691 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11692 o_conv = TxCreationKeys_clone(&o_conv);
11693 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11694 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11695 return (uint32_t)ret_conv;
11698 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11699 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11700 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11701 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11702 return (uint32_t)ret_conv;
11705 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
11706 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
11707 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11711 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
11712 if ((_res & 1) != 0) return;
11713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11714 CHECK_ACCESS(_res_ptr);
11715 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11717 CResult_TxCreationKeysErrorZ_free(_res_conv);
11720 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11721 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11722 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11723 return (uint32_t)ret_conv;
11725 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
11726 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
11727 uint32_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11731 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
11732 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11733 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11734 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11735 return (uint32_t)ret_conv;
11738 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11739 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11740 *ret_copy = COption_u32Z_some(o);
11741 uint32_t ret_ref = (uintptr_t)ret_copy;
11745 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11746 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11747 *ret_copy = COption_u32Z_none();
11748 uint32_t ret_ref = (uintptr_t)ret_copy;
11752 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
11753 if ((_res & 1) != 0) return;
11754 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11755 CHECK_ACCESS(_res_ptr);
11756 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11758 COption_u32Z_free(_res_conv);
11761 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11762 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11763 *ret_copy = COption_u32Z_clone(arg);
11764 uint32_t ret_ref = (uintptr_t)ret_copy;
11767 uint32_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
11768 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
11769 uint32_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11773 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
11774 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11775 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11776 *ret_copy = COption_u32Z_clone(orig_conv);
11777 uint32_t ret_ref = (uintptr_t)ret_copy;
11781 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
11782 LDKHTLCOutputInCommitment o_conv;
11783 o_conv.inner = (void*)(o & (~1));
11784 o_conv.is_owned = (o & 1) || (o == 0);
11785 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11786 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11787 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11788 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11789 return (uint32_t)ret_conv;
11792 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
11793 LDKDecodeError e_conv;
11794 e_conv.inner = (void*)(e & (~1));
11795 e_conv.is_owned = (e & 1) || (e == 0);
11796 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11797 e_conv = DecodeError_clone(&e_conv);
11798 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11799 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11800 return (uint32_t)ret_conv;
11803 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
11804 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
11805 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11809 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
11810 if ((_res & 1) != 0) return;
11811 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11812 CHECK_ACCESS(_res_ptr);
11813 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11815 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11818 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11819 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11820 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11821 return (uint32_t)ret_conv;
11823 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
11824 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
11825 uint32_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11829 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
11830 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11831 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11832 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11833 return (uint32_t)ret_conv;
11836 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11837 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11841 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11842 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11846 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11847 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11848 COption_NoneZ_free(_res_conv);
11851 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11852 LDKCounterpartyChannelTransactionParameters o_conv;
11853 o_conv.inner = (void*)(o & (~1));
11854 o_conv.is_owned = (o & 1) || (o == 0);
11855 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11856 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11857 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11858 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11859 return (uint32_t)ret_conv;
11862 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11863 LDKDecodeError e_conv;
11864 e_conv.inner = (void*)(e & (~1));
11865 e_conv.is_owned = (e & 1) || (e == 0);
11866 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11867 e_conv = DecodeError_clone(&e_conv);
11868 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11869 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11870 return (uint32_t)ret_conv;
11873 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11874 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11875 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11879 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11880 if ((_res & 1) != 0) return;
11881 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11882 CHECK_ACCESS(_res_ptr);
11883 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11885 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11888 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11889 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11890 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11891 return (uint32_t)ret_conv;
11893 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11894 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11895 uint32_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11899 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11900 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11901 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11902 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11903 return (uint32_t)ret_conv;
11906 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11907 LDKChannelTransactionParameters o_conv;
11908 o_conv.inner = (void*)(o & (~1));
11909 o_conv.is_owned = (o & 1) || (o == 0);
11910 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11911 o_conv = ChannelTransactionParameters_clone(&o_conv);
11912 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11913 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11914 return (uint32_t)ret_conv;
11917 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11918 LDKDecodeError e_conv;
11919 e_conv.inner = (void*)(e & (~1));
11920 e_conv.is_owned = (e & 1) || (e == 0);
11921 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11922 e_conv = DecodeError_clone(&e_conv);
11923 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11924 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11925 return (uint32_t)ret_conv;
11928 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11929 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11930 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11934 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11935 if ((_res & 1) != 0) return;
11936 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11937 CHECK_ACCESS(_res_ptr);
11938 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11940 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11943 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11944 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11945 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11946 return (uint32_t)ret_conv;
11948 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11949 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11950 uint32_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11954 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11955 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11956 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11957 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11958 return (uint32_t)ret_conv;
11961 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11962 LDKCVec_SignatureZ _res_constr;
11963 _res_constr.datalen = _res->arr_len;
11964 if (_res_constr.datalen > 0)
11965 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11967 _res_constr.data = NULL;
11968 int8_tArray* _res_vals = (void*) _res->elems;
11969 for (size_t m = 0; m < _res_constr.datalen; m++) {
11970 int8_tArray _res_conv_12 = _res_vals[m];
11971 LDKSignature _res_conv_12_ref;
11972 CHECK(_res_conv_12->arr_len == 64);
11973 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11974 _res_constr.data[m] = _res_conv_12_ref;
11977 CVec_SignatureZ_free(_res_constr);
11980 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11981 LDKHolderCommitmentTransaction o_conv;
11982 o_conv.inner = (void*)(o & (~1));
11983 o_conv.is_owned = (o & 1) || (o == 0);
11984 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11985 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11986 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11987 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11988 return (uint32_t)ret_conv;
11991 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11992 LDKDecodeError e_conv;
11993 e_conv.inner = (void*)(e & (~1));
11994 e_conv.is_owned = (e & 1) || (e == 0);
11995 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11996 e_conv = DecodeError_clone(&e_conv);
11997 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11998 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11999 return (uint32_t)ret_conv;
12002 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
12003 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
12004 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12008 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
12009 if ((_res & 1) != 0) return;
12010 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12011 CHECK_ACCESS(_res_ptr);
12012 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12014 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12017 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12018 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12019 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12020 return (uint32_t)ret_conv;
12022 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
12023 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
12024 uint32_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12028 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
12029 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
12030 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12031 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12032 return (uint32_t)ret_conv;
12035 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
12036 LDKBuiltCommitmentTransaction o_conv;
12037 o_conv.inner = (void*)(o & (~1));
12038 o_conv.is_owned = (o & 1) || (o == 0);
12039 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12040 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12041 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12042 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12043 return (uint32_t)ret_conv;
12046 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
12047 LDKDecodeError e_conv;
12048 e_conv.inner = (void*)(e & (~1));
12049 e_conv.is_owned = (e & 1) || (e == 0);
12050 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12051 e_conv = DecodeError_clone(&e_conv);
12052 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12053 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12054 return (uint32_t)ret_conv;
12057 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
12058 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
12059 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12063 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
12064 if ((_res & 1) != 0) return;
12065 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12066 CHECK_ACCESS(_res_ptr);
12067 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12069 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12072 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12073 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12074 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12075 return (uint32_t)ret_conv;
12077 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
12078 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
12079 uint32_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12083 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
12084 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
12085 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12086 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12087 return (uint32_t)ret_conv;
12090 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
12091 LDKTrustedClosingTransaction o_conv;
12092 o_conv.inner = (void*)(o & (~1));
12093 o_conv.is_owned = (o & 1) || (o == 0);
12094 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12095 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12096 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12097 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12098 return (uint32_t)ret_conv;
12101 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12102 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12103 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12104 return (uint32_t)ret_conv;
12107 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
12108 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
12109 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12113 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
12114 if ((_res & 1) != 0) return;
12115 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12116 CHECK_ACCESS(_res_ptr);
12117 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12119 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12122 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
12123 LDKCommitmentTransaction o_conv;
12124 o_conv.inner = (void*)(o & (~1));
12125 o_conv.is_owned = (o & 1) || (o == 0);
12126 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12127 o_conv = CommitmentTransaction_clone(&o_conv);
12128 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12129 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12130 return (uint32_t)ret_conv;
12133 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
12134 LDKDecodeError e_conv;
12135 e_conv.inner = (void*)(e & (~1));
12136 e_conv.is_owned = (e & 1) || (e == 0);
12137 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12138 e_conv = DecodeError_clone(&e_conv);
12139 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12140 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12141 return (uint32_t)ret_conv;
12144 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
12145 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
12146 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12150 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
12151 if ((_res & 1) != 0) return;
12152 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12153 CHECK_ACCESS(_res_ptr);
12154 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12156 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12159 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12160 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12161 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12162 return (uint32_t)ret_conv;
12164 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
12165 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
12166 uint32_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12170 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
12171 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
12172 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12173 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12174 return (uint32_t)ret_conv;
12177 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
12178 LDKTrustedCommitmentTransaction o_conv;
12179 o_conv.inner = (void*)(o & (~1));
12180 o_conv.is_owned = (o & 1) || (o == 0);
12181 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12182 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12183 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12184 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12185 return (uint32_t)ret_conv;
12188 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12189 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12190 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12191 return (uint32_t)ret_conv;
12194 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
12195 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
12196 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12200 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
12201 if ((_res & 1) != 0) return;
12202 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12203 CHECK_ACCESS(_res_ptr);
12204 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12206 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12209 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12210 LDKCVec_SignatureZ o_constr;
12211 o_constr.datalen = o->arr_len;
12212 if (o_constr.datalen > 0)
12213 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12215 o_constr.data = NULL;
12216 int8_tArray* o_vals = (void*) o->elems;
12217 for (size_t m = 0; m < o_constr.datalen; m++) {
12218 int8_tArray o_conv_12 = o_vals[m];
12219 LDKSignature o_conv_12_ref;
12220 CHECK(o_conv_12->arr_len == 64);
12221 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12222 o_constr.data[m] = o_conv_12_ref;
12225 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12226 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12227 return (uint32_t)ret_conv;
12230 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12231 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12232 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12233 return (uint32_t)ret_conv;
12236 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
12237 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
12238 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12242 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
12243 if ((_res & 1) != 0) return;
12244 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12245 CHECK_ACCESS(_res_ptr);
12246 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12248 CResult_CVec_SignatureZNoneZ_free(_res_conv);
12251 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12252 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12253 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12254 return (uint32_t)ret_conv;
12256 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
12257 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
12258 uint32_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12262 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
12263 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
12264 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12265 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12266 return (uint32_t)ret_conv;
12269 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
12270 LDKShutdownScript o_conv;
12271 o_conv.inner = (void*)(o & (~1));
12272 o_conv.is_owned = (o & 1) || (o == 0);
12273 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12274 o_conv = ShutdownScript_clone(&o_conv);
12275 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12276 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12277 return (uint32_t)ret_conv;
12280 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
12281 LDKDecodeError e_conv;
12282 e_conv.inner = (void*)(e & (~1));
12283 e_conv.is_owned = (e & 1) || (e == 0);
12284 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12285 e_conv = DecodeError_clone(&e_conv);
12286 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12287 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12288 return (uint32_t)ret_conv;
12291 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
12292 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
12293 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12297 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
12298 if ((_res & 1) != 0) return;
12299 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12300 CHECK_ACCESS(_res_ptr);
12301 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12303 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12306 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12307 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12308 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12309 return (uint32_t)ret_conv;
12311 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
12312 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
12313 uint32_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12317 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
12318 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
12319 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12320 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12321 return (uint32_t)ret_conv;
12324 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
12325 LDKShutdownScript o_conv;
12326 o_conv.inner = (void*)(o & (~1));
12327 o_conv.is_owned = (o & 1) || (o == 0);
12328 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12329 o_conv = ShutdownScript_clone(&o_conv);
12330 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12331 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12332 return (uint32_t)ret_conv;
12335 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
12336 LDKInvalidShutdownScript e_conv;
12337 e_conv.inner = (void*)(e & (~1));
12338 e_conv.is_owned = (e & 1) || (e == 0);
12339 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12340 e_conv = InvalidShutdownScript_clone(&e_conv);
12341 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12342 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12343 return (uint32_t)ret_conv;
12346 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
12347 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
12348 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12352 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
12353 if ((_res & 1) != 0) return;
12354 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12355 CHECK_ACCESS(_res_ptr);
12356 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12358 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12361 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12362 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12363 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12364 return (uint32_t)ret_conv;
12366 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
12367 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
12368 uint32_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12372 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
12373 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
12374 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12375 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12376 return (uint32_t)ret_conv;
12379 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
12380 LDKRouteHop o_conv;
12381 o_conv.inner = (void*)(o & (~1));
12382 o_conv.is_owned = (o & 1) || (o == 0);
12383 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12384 o_conv = RouteHop_clone(&o_conv);
12385 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12386 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12387 return (uint32_t)ret_conv;
12390 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
12391 LDKDecodeError e_conv;
12392 e_conv.inner = (void*)(e & (~1));
12393 e_conv.is_owned = (e & 1) || (e == 0);
12394 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12395 e_conv = DecodeError_clone(&e_conv);
12396 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12397 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12398 return (uint32_t)ret_conv;
12401 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
12402 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
12403 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12407 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
12408 if ((_res & 1) != 0) return;
12409 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12410 CHECK_ACCESS(_res_ptr);
12411 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12413 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12416 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12417 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12418 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12419 return (uint32_t)ret_conv;
12421 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12422 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
12423 uint32_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12427 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
12428 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12429 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12430 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12431 return (uint32_t)ret_conv;
12434 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
12435 LDKCVec_RouteHopZ _res_constr;
12436 _res_constr.datalen = _res->arr_len;
12437 if (_res_constr.datalen > 0)
12438 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12440 _res_constr.data = NULL;
12441 uint32_t* _res_vals = _res->elems;
12442 for (size_t k = 0; k < _res_constr.datalen; k++) {
12443 uint32_t _res_conv_10 = _res_vals[k];
12444 LDKRouteHop _res_conv_10_conv;
12445 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12446 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12447 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12448 _res_constr.data[k] = _res_conv_10_conv;
12451 CVec_RouteHopZ_free(_res_constr);
12454 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12455 LDKCVec_CVec_RouteHopZZ _res_constr;
12456 _res_constr.datalen = _res->arr_len;
12457 if (_res_constr.datalen > 0)
12458 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12460 _res_constr.data = NULL;
12461 uint32_tArray* _res_vals = (void*) _res->elems;
12462 for (size_t m = 0; m < _res_constr.datalen; m++) {
12463 uint32_tArray _res_conv_12 = _res_vals[m];
12464 LDKCVec_RouteHopZ _res_conv_12_constr;
12465 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12466 if (_res_conv_12_constr.datalen > 0)
12467 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12469 _res_conv_12_constr.data = NULL;
12470 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
12471 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12472 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12473 LDKRouteHop _res_conv_12_conv_10_conv;
12474 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12475 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12476 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12477 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12479 FREE(_res_conv_12);
12480 _res_constr.data[m] = _res_conv_12_constr;
12483 CVec_CVec_RouteHopZZ_free(_res_constr);
12486 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
12488 o_conv.inner = (void*)(o & (~1));
12489 o_conv.is_owned = (o & 1) || (o == 0);
12490 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12491 o_conv = Route_clone(&o_conv);
12492 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12493 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12494 return (uint32_t)ret_conv;
12497 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
12498 LDKDecodeError e_conv;
12499 e_conv.inner = (void*)(e & (~1));
12500 e_conv.is_owned = (e & 1) || (e == 0);
12501 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12502 e_conv = DecodeError_clone(&e_conv);
12503 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12504 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12505 return (uint32_t)ret_conv;
12508 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
12509 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
12510 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12514 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
12515 if ((_res & 1) != 0) return;
12516 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12517 CHECK_ACCESS(_res_ptr);
12518 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12520 CResult_RouteDecodeErrorZ_free(_res_conv);
12523 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12524 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12525 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12526 return (uint32_t)ret_conv;
12528 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
12529 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
12530 uint32_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12534 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
12535 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12536 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12537 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12538 return (uint32_t)ret_conv;
12541 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
12542 LDKRouteParameters o_conv;
12543 o_conv.inner = (void*)(o & (~1));
12544 o_conv.is_owned = (o & 1) || (o == 0);
12545 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12546 o_conv = RouteParameters_clone(&o_conv);
12547 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12548 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12549 return (uint32_t)ret_conv;
12552 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
12553 LDKDecodeError e_conv;
12554 e_conv.inner = (void*)(e & (~1));
12555 e_conv.is_owned = (e & 1) || (e == 0);
12556 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12557 e_conv = DecodeError_clone(&e_conv);
12558 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12559 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12560 return (uint32_t)ret_conv;
12563 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
12564 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
12565 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12569 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
12570 if ((_res & 1) != 0) return;
12571 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12572 CHECK_ACCESS(_res_ptr);
12573 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12575 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12578 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12579 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12580 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12581 return (uint32_t)ret_conv;
12583 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12584 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
12585 uint32_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12589 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
12590 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12591 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12592 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12593 return (uint32_t)ret_conv;
12596 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
12597 LDKCVec_RouteHintZ _res_constr;
12598 _res_constr.datalen = _res->arr_len;
12599 if (_res_constr.datalen > 0)
12600 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12602 _res_constr.data = NULL;
12603 uint32_t* _res_vals = _res->elems;
12604 for (size_t l = 0; l < _res_constr.datalen; l++) {
12605 uint32_t _res_conv_11 = _res_vals[l];
12606 LDKRouteHint _res_conv_11_conv;
12607 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12608 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12609 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12610 _res_constr.data[l] = _res_conv_11_conv;
12613 CVec_RouteHintZ_free(_res_constr);
12616 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12617 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12618 *ret_copy = COption_u64Z_some(o);
12619 uint32_t ret_ref = (uintptr_t)ret_copy;
12623 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12624 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12625 *ret_copy = COption_u64Z_none();
12626 uint32_t ret_ref = (uintptr_t)ret_copy;
12630 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
12631 if ((_res & 1) != 0) return;
12632 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12633 CHECK_ACCESS(_res_ptr);
12634 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12636 COption_u64Z_free(_res_conv);
12639 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12640 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12641 *ret_copy = COption_u64Z_clone(arg);
12642 uint32_t ret_ref = (uintptr_t)ret_copy;
12645 uint32_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
12646 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
12647 uint32_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12651 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
12652 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12653 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12654 *ret_copy = COption_u64Z_clone(orig_conv);
12655 uint32_t ret_ref = (uintptr_t)ret_copy;
12659 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12660 LDKCVec_u64Z _res_constr;
12661 _res_constr.datalen = _res->arr_len;
12662 if (_res_constr.datalen > 0)
12663 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12665 _res_constr.data = NULL;
12666 int64_t* _res_vals = _res->elems;
12667 for (size_t i = 0; i < _res_constr.datalen; i++) {
12668 int64_t _res_conv_8 = _res_vals[i];
12669 _res_constr.data[i] = _res_conv_8;
12672 CVec_u64Z_free(_res_constr);
12675 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
12676 LDKPaymentParameters o_conv;
12677 o_conv.inner = (void*)(o & (~1));
12678 o_conv.is_owned = (o & 1) || (o == 0);
12679 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12680 o_conv = PaymentParameters_clone(&o_conv);
12681 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12682 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12683 return (uint32_t)ret_conv;
12686 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
12687 LDKDecodeError e_conv;
12688 e_conv.inner = (void*)(e & (~1));
12689 e_conv.is_owned = (e & 1) || (e == 0);
12690 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12691 e_conv = DecodeError_clone(&e_conv);
12692 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12693 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12694 return (uint32_t)ret_conv;
12697 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
12698 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
12699 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12703 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
12704 if ((_res & 1) != 0) return;
12705 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12706 CHECK_ACCESS(_res_ptr);
12707 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12709 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12712 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12713 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12714 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12715 return (uint32_t)ret_conv;
12717 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12718 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
12719 uint32_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12723 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
12724 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
12725 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12726 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12727 return (uint32_t)ret_conv;
12730 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
12731 LDKCVec_RouteHintHopZ _res_constr;
12732 _res_constr.datalen = _res->arr_len;
12733 if (_res_constr.datalen > 0)
12734 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12736 _res_constr.data = NULL;
12737 uint32_t* _res_vals = _res->elems;
12738 for (size_t o = 0; o < _res_constr.datalen; o++) {
12739 uint32_t _res_conv_14 = _res_vals[o];
12740 LDKRouteHintHop _res_conv_14_conv;
12741 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12742 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12743 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12744 _res_constr.data[o] = _res_conv_14_conv;
12747 CVec_RouteHintHopZ_free(_res_constr);
12750 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
12751 LDKRouteHint o_conv;
12752 o_conv.inner = (void*)(o & (~1));
12753 o_conv.is_owned = (o & 1) || (o == 0);
12754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12755 o_conv = RouteHint_clone(&o_conv);
12756 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12757 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12758 return (uint32_t)ret_conv;
12761 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
12762 LDKDecodeError e_conv;
12763 e_conv.inner = (void*)(e & (~1));
12764 e_conv.is_owned = (e & 1) || (e == 0);
12765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12766 e_conv = DecodeError_clone(&e_conv);
12767 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12768 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12769 return (uint32_t)ret_conv;
12772 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
12773 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
12774 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12778 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
12779 if ((_res & 1) != 0) return;
12780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12781 CHECK_ACCESS(_res_ptr);
12782 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12784 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12787 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12788 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12789 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12790 return (uint32_t)ret_conv;
12792 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
12793 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
12794 uint32_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12798 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
12799 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12800 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12801 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12802 return (uint32_t)ret_conv;
12805 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
12806 LDKRouteHintHop o_conv;
12807 o_conv.inner = (void*)(o & (~1));
12808 o_conv.is_owned = (o & 1) || (o == 0);
12809 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12810 o_conv = RouteHintHop_clone(&o_conv);
12811 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12812 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12813 return (uint32_t)ret_conv;
12816 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
12817 LDKDecodeError e_conv;
12818 e_conv.inner = (void*)(e & (~1));
12819 e_conv.is_owned = (e & 1) || (e == 0);
12820 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12821 e_conv = DecodeError_clone(&e_conv);
12822 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12823 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12824 return (uint32_t)ret_conv;
12827 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
12828 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
12829 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12833 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
12834 if ((_res & 1) != 0) return;
12835 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12836 CHECK_ACCESS(_res_ptr);
12837 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12839 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12842 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12843 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12844 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12845 return (uint32_t)ret_conv;
12847 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12848 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
12849 uint32_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12853 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
12854 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12855 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12856 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12857 return (uint32_t)ret_conv;
12860 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
12861 LDKCVec_ChannelDetailsZ _res_constr;
12862 _res_constr.datalen = _res->arr_len;
12863 if (_res_constr.datalen > 0)
12864 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12866 _res_constr.data = NULL;
12867 uint32_t* _res_vals = _res->elems;
12868 for (size_t q = 0; q < _res_constr.datalen; q++) {
12869 uint32_t _res_conv_16 = _res_vals[q];
12870 LDKChannelDetails _res_conv_16_conv;
12871 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12872 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12873 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12874 _res_constr.data[q] = _res_conv_16_conv;
12877 CVec_ChannelDetailsZ_free(_res_constr);
12880 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
12882 o_conv.inner = (void*)(o & (~1));
12883 o_conv.is_owned = (o & 1) || (o == 0);
12884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12885 o_conv = Route_clone(&o_conv);
12886 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12887 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12888 return (uint32_t)ret_conv;
12891 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
12892 LDKLightningError e_conv;
12893 e_conv.inner = (void*)(e & (~1));
12894 e_conv.is_owned = (e & 1) || (e == 0);
12895 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12896 e_conv = LightningError_clone(&e_conv);
12897 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12898 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12899 return (uint32_t)ret_conv;
12902 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
12903 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
12904 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12908 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
12909 if ((_res & 1) != 0) return;
12910 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12911 CHECK_ACCESS(_res_ptr);
12912 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12914 CResult_RouteLightningErrorZ_free(_res_conv);
12917 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12918 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12919 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12920 return (uint32_t)ret_conv;
12922 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
12923 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
12924 uint32_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12928 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
12929 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12930 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12931 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12932 return (uint32_t)ret_conv;
12935 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12936 LDKCVec_PublicKeyZ _res_constr;
12937 _res_constr.datalen = _res->arr_len;
12938 if (_res_constr.datalen > 0)
12939 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12941 _res_constr.data = NULL;
12942 int8_tArray* _res_vals = (void*) _res->elems;
12943 for (size_t m = 0; m < _res_constr.datalen; m++) {
12944 int8_tArray _res_conv_12 = _res_vals[m];
12945 LDKPublicKey _res_conv_12_ref;
12946 CHECK(_res_conv_12->arr_len == 33);
12947 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12948 _res_constr.data[m] = _res_conv_12_ref;
12951 CVec_PublicKeyZ_free(_res_constr);
12954 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint32_t o) {
12955 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12956 CHECK_ACCESS(o_ptr);
12957 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12958 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
12959 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12960 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12961 return (uint32_t)ret_conv;
12964 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint32_t e) {
12965 LDKDecodeError e_conv;
12966 e_conv.inner = (void*)(e & (~1));
12967 e_conv.is_owned = (e & 1) || (e == 0);
12968 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12969 e_conv = DecodeError_clone(&e_conv);
12970 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12971 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12972 return (uint32_t)ret_conv;
12975 jboolean __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint32_t o) {
12976 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
12977 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12981 void __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint32_t _res) {
12982 if ((_res & 1) != 0) return;
12983 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12984 CHECK_ACCESS(_res_ptr);
12985 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12987 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12990 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12991 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12992 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12993 return (uint32_t)ret_conv;
12995 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint32_t arg) {
12996 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
12997 uint32_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
13001 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint32_t orig) {
13002 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
13003 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13004 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
13005 return (uint32_t)ret_conv;
13008 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
13009 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13010 CHECK_ACCESS(o_ptr);
13011 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13012 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
13013 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13014 *ret_copy = COption_ClosureReasonZ_some(o_conv);
13015 uint32_t ret_ref = (uintptr_t)ret_copy;
13019 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
13020 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13021 *ret_copy = COption_ClosureReasonZ_none();
13022 uint32_t ret_ref = (uintptr_t)ret_copy;
13026 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
13027 if ((_res & 1) != 0) return;
13028 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13029 CHECK_ACCESS(_res_ptr);
13030 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13032 COption_ClosureReasonZ_free(_res_conv);
13035 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13036 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13037 *ret_copy = COption_ClosureReasonZ_clone(arg);
13038 uint32_t ret_ref = (uintptr_t)ret_copy;
13041 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
13042 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
13043 uint32_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13047 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
13048 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
13049 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13050 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13051 uint32_t ret_ref = (uintptr_t)ret_copy;
13055 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
13056 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13057 CHECK_ACCESS(o_ptr);
13058 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13059 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
13060 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13061 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13062 return (uint32_t)ret_conv;
13065 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
13066 LDKDecodeError e_conv;
13067 e_conv.inner = (void*)(e & (~1));
13068 e_conv.is_owned = (e & 1) || (e == 0);
13069 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13070 e_conv = DecodeError_clone(&e_conv);
13071 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13072 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13073 return (uint32_t)ret_conv;
13076 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
13077 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
13078 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13082 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
13083 if ((_res & 1) != 0) return;
13084 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13085 CHECK_ACCESS(_res_ptr);
13086 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13088 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13091 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13092 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13093 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13094 return (uint32_t)ret_conv;
13096 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
13097 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
13098 uint32_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13102 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
13103 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
13104 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13105 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13106 return (uint32_t)ret_conv;
13109 uint32_t __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint32_t o) {
13110 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13111 CHECK_ACCESS(o_ptr);
13112 LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13113 o_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)o) & ~1));
13114 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13115 *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13116 uint32_t ret_ref = (uintptr_t)ret_copy;
13120 uint32_t __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13121 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13122 *ret_copy = COption_HTLCDestinationZ_none();
13123 uint32_t ret_ref = (uintptr_t)ret_copy;
13127 void __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint32_t _res) {
13128 if ((_res & 1) != 0) return;
13129 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13130 CHECK_ACCESS(_res_ptr);
13131 LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13133 COption_HTLCDestinationZ_free(_res_conv);
13136 static inline uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13137 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13138 *ret_copy = COption_HTLCDestinationZ_clone(arg);
13139 uint32_t ret_ref = (uintptr_t)ret_copy;
13142 uint32_t __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint32_t arg) {
13143 LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)arg;
13144 uint32_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13148 uint32_t __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint32_t orig) {
13149 LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)orig;
13150 LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13151 *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13152 uint32_t ret_ref = (uintptr_t)ret_copy;
13156 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint32_t o) {
13157 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13158 CHECK_ACCESS(o_ptr);
13159 LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13160 o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)(((uintptr_t)o) & ~1));
13161 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13162 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13163 return (uint32_t)ret_conv;
13166 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint32_t e) {
13167 LDKDecodeError e_conv;
13168 e_conv.inner = (void*)(e & (~1));
13169 e_conv.is_owned = (e & 1) || (e == 0);
13170 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13171 e_conv = DecodeError_clone(&e_conv);
13172 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13173 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13174 return (uint32_t)ret_conv;
13177 jboolean __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint32_t o) {
13178 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(o & ~1);
13179 jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13183 void __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint32_t _res) {
13184 if ((_res & 1) != 0) return;
13185 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13186 CHECK_ACCESS(_res_ptr);
13187 LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13189 CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13192 static inline uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13193 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13194 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13195 return (uint32_t)ret_conv;
13197 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint32_t arg) {
13198 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(arg & ~1);
13199 uint32_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13203 uint32_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint32_t orig) {
13204 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(orig & ~1);
13205 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13206 *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13207 return (uint32_t)ret_conv;
13210 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
13211 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13212 CHECK_ACCESS(o_ptr);
13213 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13214 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
13215 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13216 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13217 uint32_t ret_ref = (uintptr_t)ret_copy;
13221 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13222 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13223 *ret_copy = COption_NetworkUpdateZ_none();
13224 uint32_t ret_ref = (uintptr_t)ret_copy;
13228 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
13229 if ((_res & 1) != 0) return;
13230 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13231 CHECK_ACCESS(_res_ptr);
13232 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13234 COption_NetworkUpdateZ_free(_res_conv);
13237 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13238 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13239 *ret_copy = COption_NetworkUpdateZ_clone(arg);
13240 uint32_t ret_ref = (uintptr_t)ret_copy;
13243 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
13244 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
13245 uint32_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13249 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
13250 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
13251 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13252 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13253 uint32_t ret_ref = (uintptr_t)ret_copy;
13257 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
13258 LDKCVec_SpendableOutputDescriptorZ _res_constr;
13259 _res_constr.datalen = _res->arr_len;
13260 if (_res_constr.datalen > 0)
13261 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13263 _res_constr.data = NULL;
13264 uint32_t* _res_vals = _res->elems;
13265 for (size_t b = 0; b < _res_constr.datalen; b++) {
13266 uint32_t _res_conv_27 = _res_vals[b];
13267 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
13268 CHECK_ACCESS(_res_conv_27_ptr);
13269 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13270 FREE((void*)_res_conv_27);
13271 _res_constr.data[b] = _res_conv_27_conv;
13274 CVec_SpendableOutputDescriptorZ_free(_res_constr);
13277 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
13278 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13279 CHECK_ACCESS(o_ptr);
13280 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13281 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
13282 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13283 *ret_copy = COption_EventZ_some(o_conv);
13284 uint32_t ret_ref = (uintptr_t)ret_copy;
13288 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13289 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13290 *ret_copy = COption_EventZ_none();
13291 uint32_t ret_ref = (uintptr_t)ret_copy;
13295 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
13296 if ((_res & 1) != 0) return;
13297 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13298 CHECK_ACCESS(_res_ptr);
13299 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13301 COption_EventZ_free(_res_conv);
13304 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13305 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13306 *ret_copy = COption_EventZ_clone(arg);
13307 uint32_t ret_ref = (uintptr_t)ret_copy;
13310 uint32_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
13311 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
13312 uint32_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13316 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
13317 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
13318 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13319 *ret_copy = COption_EventZ_clone(orig_conv);
13320 uint32_t ret_ref = (uintptr_t)ret_copy;
13324 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
13325 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13326 CHECK_ACCESS(o_ptr);
13327 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13328 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
13329 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13330 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13331 return (uint32_t)ret_conv;
13334 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
13335 LDKDecodeError e_conv;
13336 e_conv.inner = (void*)(e & (~1));
13337 e_conv.is_owned = (e & 1) || (e == 0);
13338 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13339 e_conv = DecodeError_clone(&e_conv);
13340 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13341 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13342 return (uint32_t)ret_conv;
13345 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
13346 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
13347 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13351 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
13352 if ((_res & 1) != 0) return;
13353 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13354 CHECK_ACCESS(_res_ptr);
13355 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13357 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13360 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13361 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13362 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13363 return (uint32_t)ret_conv;
13365 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
13366 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
13367 uint32_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13371 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
13372 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
13373 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13374 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13375 return (uint32_t)ret_conv;
13378 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
13379 LDKCVec_MessageSendEventZ _res_constr;
13380 _res_constr.datalen = _res->arr_len;
13381 if (_res_constr.datalen > 0)
13382 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13384 _res_constr.data = NULL;
13385 uint32_t* _res_vals = _res->elems;
13386 for (size_t s = 0; s < _res_constr.datalen; s++) {
13387 uint32_t _res_conv_18 = _res_vals[s];
13388 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
13389 CHECK_ACCESS(_res_conv_18_ptr);
13390 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13391 FREE((void*)_res_conv_18);
13392 _res_constr.data[s] = _res_conv_18_conv;
13395 CVec_MessageSendEventZ_free(_res_constr);
13398 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
13399 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13400 CHECK_ACCESS(o_ptr);
13401 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13402 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
13403 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13404 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13405 return (uint32_t)ret_conv;
13408 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13409 LDKAccessError e_conv = LDKAccessError_from_js(e);
13410 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13411 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13412 return (uint32_t)ret_conv;
13415 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
13416 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
13417 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13421 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
13422 if ((_res & 1) != 0) return;
13423 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13424 CHECK_ACCESS(_res_ptr);
13425 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13427 CResult_TxOutAccessErrorZ_free(_res_conv);
13430 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13431 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13432 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13433 return (uint32_t)ret_conv;
13435 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
13436 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
13437 uint32_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13441 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
13442 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
13443 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13444 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13445 return (uint32_t)ret_conv;
13448 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13449 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13450 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13451 return ((uint32_t)ret_conv);
13453 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
13454 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
13455 uint32_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13459 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
13460 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
13461 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13462 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13463 return ((uint32_t)ret_conv);
13466 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13467 LDKTransaction b_ref;
13468 b_ref.datalen = b->arr_len;
13469 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13470 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13471 b_ref.data_is_owned = true;
13472 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13473 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13474 return ((uint32_t)ret_conv);
13477 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
13478 if ((_res & 1) != 0) return;
13479 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13480 CHECK_ACCESS(_res_ptr);
13481 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13483 C2Tuple_usizeTransactionZ_free(_res_conv);
13486 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
13487 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13488 _res_constr.datalen = _res->arr_len;
13489 if (_res_constr.datalen > 0)
13490 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13492 _res_constr.data = NULL;
13493 uint32_t* _res_vals = _res->elems;
13494 for (size_t c = 0; c < _res_constr.datalen; c++) {
13495 uint32_t _res_conv_28 = _res_vals[c];
13496 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
13497 CHECK_ACCESS(_res_conv_28_ptr);
13498 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13499 FREE((void*)_res_conv_28);
13500 _res_constr.data[c] = _res_conv_28_conv;
13503 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13506 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13507 LDKCVec_TxidZ _res_constr;
13508 _res_constr.datalen = _res->arr_len;
13509 if (_res_constr.datalen > 0)
13510 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13512 _res_constr.data = NULL;
13513 int8_tArray* _res_vals = (void*) _res->elems;
13514 for (size_t m = 0; m < _res_constr.datalen; m++) {
13515 int8_tArray _res_conv_12 = _res_vals[m];
13516 LDKThirtyTwoBytes _res_conv_12_ref;
13517 CHECK(_res_conv_12->arr_len == 32);
13518 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13519 _res_constr.data[m] = _res_conv_12_ref;
13522 CVec_TxidZ_free(_res_constr);
13525 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
13526 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13527 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13528 return (uint32_t)ret_conv;
13531 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13532 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13533 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13534 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13535 return (uint32_t)ret_conv;
13538 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
13539 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
13540 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13544 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
13545 if ((_res & 1) != 0) return;
13546 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13547 CHECK_ACCESS(_res_ptr);
13548 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13550 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13553 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13554 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13555 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13556 return (uint32_t)ret_conv;
13558 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
13559 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
13560 uint32_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13564 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
13565 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
13566 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13567 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13568 return (uint32_t)ret_conv;
13571 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
13572 LDKCVec_MonitorEventZ _res_constr;
13573 _res_constr.datalen = _res->arr_len;
13574 if (_res_constr.datalen > 0)
13575 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13577 _res_constr.data = NULL;
13578 uint32_t* _res_vals = _res->elems;
13579 for (size_t o = 0; o < _res_constr.datalen; o++) {
13580 uint32_t _res_conv_14 = _res_vals[o];
13581 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
13582 CHECK_ACCESS(_res_conv_14_ptr);
13583 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13584 FREE((void*)_res_conv_14);
13585 _res_constr.data[o] = _res_conv_14_conv;
13588 CVec_MonitorEventZ_free(_res_constr);
13591 static inline uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13592 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13593 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13594 return ((uint32_t)ret_conv);
13596 uint32_t __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint32_t arg) {
13597 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(arg & ~1);
13598 uint32_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13602 uint32_t __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint32_t orig) {
13603 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(orig & ~1);
13604 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13605 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13606 return ((uint32_t)ret_conv);
13609 uint32_t __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint32_t a, uint32_tArray b, int8_tArray c) {
13610 LDKOutPoint a_conv;
13611 a_conv.inner = (void*)(a & (~1));
13612 a_conv.is_owned = (a & 1) || (a == 0);
13613 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13614 a_conv = OutPoint_clone(&a_conv);
13615 LDKCVec_MonitorEventZ b_constr;
13616 b_constr.datalen = b->arr_len;
13617 if (b_constr.datalen > 0)
13618 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13620 b_constr.data = NULL;
13621 uint32_t* b_vals = b->elems;
13622 for (size_t o = 0; o < b_constr.datalen; o++) {
13623 uint32_t b_conv_14 = b_vals[o];
13624 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
13625 CHECK_ACCESS(b_conv_14_ptr);
13626 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13627 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
13628 b_constr.data[o] = b_conv_14_conv;
13631 LDKPublicKey c_ref;
13632 CHECK(c->arr_len == 33);
13633 memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
13634 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13635 *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
13636 return ((uint32_t)ret_conv);
13639 void __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint32_t _res) {
13640 if ((_res & 1) != 0) return;
13641 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13642 CHECK_ACCESS(_res_ptr);
13643 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
13645 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
13648 void __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint32_tArray _res) {
13649 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
13650 _res_constr.datalen = _res->arr_len;
13651 if (_res_constr.datalen > 0)
13652 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
13654 _res_constr.data = NULL;
13655 uint32_t* _res_vals = _res->elems;
13656 for (size_t x = 0; x < _res_constr.datalen; x++) {
13657 uint32_t _res_conv_49 = _res_vals[x];
13658 void* _res_conv_49_ptr = (void*)(((uintptr_t)_res_conv_49) & ~1);
13659 CHECK_ACCESS(_res_conv_49_ptr);
13660 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
13661 FREE((void*)_res_conv_49);
13662 _res_constr.data[x] = _res_conv_49_conv;
13665 CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
13668 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
13669 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13670 CHECK_ACCESS(o_ptr);
13671 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
13672 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
13673 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13674 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
13675 uint32_t ret_ref = (uintptr_t)ret_copy;
13679 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
13680 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13681 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
13682 uint32_t ret_ref = (uintptr_t)ret_copy;
13686 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
13687 if ((_res & 1) != 0) return;
13688 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13689 CHECK_ACCESS(_res_ptr);
13690 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
13692 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
13695 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
13696 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13697 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
13698 uint32_t ret_ref = (uintptr_t)ret_copy;
13701 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
13702 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
13703 uint32_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
13707 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
13708 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
13709 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13710 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
13711 uint32_t ret_ref = (uintptr_t)ret_copy;
13715 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
13716 LDKFixedPenaltyScorer o_conv;
13717 o_conv.inner = (void*)(o & (~1));
13718 o_conv.is_owned = (o & 1) || (o == 0);
13719 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13720 o_conv = FixedPenaltyScorer_clone(&o_conv);
13721 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13722 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13723 return (uint32_t)ret_conv;
13726 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
13727 LDKDecodeError 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 = DecodeError_clone(&e_conv);
13732 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13733 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13734 return (uint32_t)ret_conv;
13737 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
13738 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
13739 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13743 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_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_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13749 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13752 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13753 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13754 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13755 return (uint32_t)ret_conv;
13757 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
13758 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
13759 uint32_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13763 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
13764 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
13765 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13766 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13767 return (uint32_t)ret_conv;
13770 static inline uintptr_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
13771 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13772 *ret_conv = C2Tuple_u64u64Z_clone(arg);
13773 return ((uint32_t)ret_conv);
13775 uint32_t __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint32_t arg) {
13776 LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)(arg & ~1);
13777 uint32_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
13781 uint32_t __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint32_t orig) {
13782 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
13783 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13784 *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
13785 return ((uint32_t)ret_conv);
13788 uint32_t __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
13789 LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13790 *ret_conv = C2Tuple_u64u64Z_new(a, b);
13791 return ((uint32_t)ret_conv);
13794 void __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint32_t _res) {
13795 if ((_res & 1) != 0) return;
13796 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13797 CHECK_ACCESS(_res_ptr);
13798 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
13800 C2Tuple_u64u64Z_free(_res_conv);
13803 uint32_t __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint32_t o) {
13804 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13805 CHECK_ACCESS(o_ptr);
13806 LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
13807 o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)(((uintptr_t)o) & ~1));
13808 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13809 *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
13810 uint32_t ret_ref = (uintptr_t)ret_copy;
13814 uint32_t __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
13815 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13816 *ret_copy = COption_C2Tuple_u64u64ZZ_none();
13817 uint32_t ret_ref = (uintptr_t)ret_copy;
13821 void __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint32_t _res) {
13822 if ((_res & 1) != 0) return;
13823 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13824 CHECK_ACCESS(_res_ptr);
13825 LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
13827 COption_C2Tuple_u64u64ZZ_free(_res_conv);
13830 static inline uintptr_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
13831 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13832 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
13833 uint32_t ret_ref = (uintptr_t)ret_copy;
13836 uint32_t __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint32_t arg) {
13837 LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)arg;
13838 uint32_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
13842 uint32_t __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint32_t orig) {
13843 LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)orig;
13844 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13845 *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
13846 uint32_t ret_ref = (uintptr_t)ret_copy;
13850 void __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint32_tArray _res) {
13851 LDKCVec_NodeIdZ _res_constr;
13852 _res_constr.datalen = _res->arr_len;
13853 if (_res_constr.datalen > 0)
13854 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
13856 _res_constr.data = NULL;
13857 uint32_t* _res_vals = _res->elems;
13858 for (size_t i = 0; i < _res_constr.datalen; i++) {
13859 uint32_t _res_conv_8 = _res_vals[i];
13860 LDKNodeId _res_conv_8_conv;
13861 _res_conv_8_conv.inner = (void*)(_res_conv_8 & (~1));
13862 _res_conv_8_conv.is_owned = (_res_conv_8 & 1) || (_res_conv_8 == 0);
13863 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
13864 _res_constr.data[i] = _res_conv_8_conv;
13867 CVec_NodeIdZ_free(_res_constr);
13870 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint32_t o) {
13871 LDKProbabilisticScorer o_conv;
13872 o_conv.inner = (void*)(o & (~1));
13873 o_conv.is_owned = (o & 1) || (o == 0);
13874 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13875 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13876 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13877 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13878 return (uint32_t)ret_conv;
13881 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint32_t e) {
13882 LDKDecodeError e_conv;
13883 e_conv.inner = (void*)(e & (~1));
13884 e_conv.is_owned = (e & 1) || (e == 0);
13885 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13886 e_conv = DecodeError_clone(&e_conv);
13887 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13888 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13889 return (uint32_t)ret_conv;
13892 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint32_t o) {
13893 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
13894 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13898 void __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint32_t _res) {
13899 if ((_res & 1) != 0) return;
13900 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13901 CHECK_ACCESS(_res_ptr);
13902 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13904 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13907 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
13908 LDKInitFeatures o_conv;
13909 o_conv.inner = (void*)(o & (~1));
13910 o_conv.is_owned = (o & 1) || (o == 0);
13911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13912 o_conv = InitFeatures_clone(&o_conv);
13913 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13914 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13915 return (uint32_t)ret_conv;
13918 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
13919 LDKDecodeError e_conv;
13920 e_conv.inner = (void*)(e & (~1));
13921 e_conv.is_owned = (e & 1) || (e == 0);
13922 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13923 e_conv = DecodeError_clone(&e_conv);
13924 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13925 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13926 return (uint32_t)ret_conv;
13929 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13930 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
13931 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13935 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
13936 if ((_res & 1) != 0) return;
13937 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13938 CHECK_ACCESS(_res_ptr);
13939 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13941 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13944 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13945 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13946 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13947 return (uint32_t)ret_conv;
13949 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13950 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
13951 uint32_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13955 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint32_t orig) {
13956 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
13957 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13958 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13959 return (uint32_t)ret_conv;
13962 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
13963 LDKChannelFeatures o_conv;
13964 o_conv.inner = (void*)(o & (~1));
13965 o_conv.is_owned = (o & 1) || (o == 0);
13966 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13967 o_conv = ChannelFeatures_clone(&o_conv);
13968 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13969 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13970 return (uint32_t)ret_conv;
13973 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
13974 LDKDecodeError e_conv;
13975 e_conv.inner = (void*)(e & (~1));
13976 e_conv.is_owned = (e & 1) || (e == 0);
13977 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13978 e_conv = DecodeError_clone(&e_conv);
13979 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13980 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13981 return (uint32_t)ret_conv;
13984 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13985 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
13986 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13990 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
13991 if ((_res & 1) != 0) return;
13992 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13993 CHECK_ACCESS(_res_ptr);
13994 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13996 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13999 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14000 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14001 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14002 return (uint32_t)ret_conv;
14004 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14005 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
14006 uint32_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14010 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint32_t orig) {
14011 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
14012 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14013 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14014 return (uint32_t)ret_conv;
14017 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
14018 LDKNodeFeatures o_conv;
14019 o_conv.inner = (void*)(o & (~1));
14020 o_conv.is_owned = (o & 1) || (o == 0);
14021 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14022 o_conv = NodeFeatures_clone(&o_conv);
14023 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14024 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14025 return (uint32_t)ret_conv;
14028 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
14029 LDKDecodeError e_conv;
14030 e_conv.inner = (void*)(e & (~1));
14031 e_conv.is_owned = (e & 1) || (e == 0);
14032 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14033 e_conv = DecodeError_clone(&e_conv);
14034 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14035 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14036 return (uint32_t)ret_conv;
14039 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
14040 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
14041 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14045 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
14046 if ((_res & 1) != 0) return;
14047 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14048 CHECK_ACCESS(_res_ptr);
14049 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14051 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14054 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14055 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14056 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14057 return (uint32_t)ret_conv;
14059 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14060 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
14061 uint32_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14065 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint32_t orig) {
14066 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
14067 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14068 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14069 return (uint32_t)ret_conv;
14072 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
14073 LDKInvoiceFeatures o_conv;
14074 o_conv.inner = (void*)(o & (~1));
14075 o_conv.is_owned = (o & 1) || (o == 0);
14076 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14077 o_conv = InvoiceFeatures_clone(&o_conv);
14078 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14079 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14080 return (uint32_t)ret_conv;
14083 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
14084 LDKDecodeError e_conv;
14085 e_conv.inner = (void*)(e & (~1));
14086 e_conv.is_owned = (e & 1) || (e == 0);
14087 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14088 e_conv = DecodeError_clone(&e_conv);
14089 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14090 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14091 return (uint32_t)ret_conv;
14094 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
14095 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
14096 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14100 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
14101 if ((_res & 1) != 0) return;
14102 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14103 CHECK_ACCESS(_res_ptr);
14104 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14106 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14109 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14110 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14111 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14112 return (uint32_t)ret_conv;
14114 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14115 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
14116 uint32_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14120 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint32_t orig) {
14121 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
14122 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14123 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14124 return (uint32_t)ret_conv;
14127 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
14128 LDKChannelTypeFeatures o_conv;
14129 o_conv.inner = (void*)(o & (~1));
14130 o_conv.is_owned = (o & 1) || (o == 0);
14131 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14132 o_conv = ChannelTypeFeatures_clone(&o_conv);
14133 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14134 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14135 return (uint32_t)ret_conv;
14138 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
14139 LDKDecodeError e_conv;
14140 e_conv.inner = (void*)(e & (~1));
14141 e_conv.is_owned = (e & 1) || (e == 0);
14142 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14143 e_conv = DecodeError_clone(&e_conv);
14144 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14145 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14146 return (uint32_t)ret_conv;
14149 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
14150 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
14151 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14155 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
14156 if ((_res & 1) != 0) return;
14157 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14158 CHECK_ACCESS(_res_ptr);
14159 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14161 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14164 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14165 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14166 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14167 return (uint32_t)ret_conv;
14169 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
14170 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
14171 uint32_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14175 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint32_t orig) {
14176 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
14177 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14178 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14179 return (uint32_t)ret_conv;
14182 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
14184 o_conv.inner = (void*)(o & (~1));
14185 o_conv.is_owned = (o & 1) || (o == 0);
14186 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14187 o_conv = NodeId_clone(&o_conv);
14188 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14189 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14190 return (uint32_t)ret_conv;
14193 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
14194 LDKDecodeError e_conv;
14195 e_conv.inner = (void*)(e & (~1));
14196 e_conv.is_owned = (e & 1) || (e == 0);
14197 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14198 e_conv = DecodeError_clone(&e_conv);
14199 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14200 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14201 return (uint32_t)ret_conv;
14204 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
14205 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
14206 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14210 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
14211 if ((_res & 1) != 0) return;
14212 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14213 CHECK_ACCESS(_res_ptr);
14214 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14216 CResult_NodeIdDecodeErrorZ_free(_res_conv);
14219 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14220 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14221 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14222 return (uint32_t)ret_conv;
14224 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
14225 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
14226 uint32_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14230 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
14231 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
14232 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14233 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14234 return (uint32_t)ret_conv;
14237 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
14238 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14239 CHECK_ACCESS(o_ptr);
14240 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14241 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
14242 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14243 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14244 return (uint32_t)ret_conv;
14247 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
14248 LDKDecodeError e_conv;
14249 e_conv.inner = (void*)(e & (~1));
14250 e_conv.is_owned = (e & 1) || (e == 0);
14251 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14252 e_conv = DecodeError_clone(&e_conv);
14253 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14254 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14255 return (uint32_t)ret_conv;
14258 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
14259 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
14260 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14264 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
14265 if ((_res & 1) != 0) return;
14266 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14267 CHECK_ACCESS(_res_ptr);
14268 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14270 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14273 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14274 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14275 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14276 return (uint32_t)ret_conv;
14278 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
14279 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
14280 uint32_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14284 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
14285 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
14286 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14287 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14288 return (uint32_t)ret_conv;
14291 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
14292 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14293 CHECK_ACCESS(o_ptr);
14294 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14295 if (o_conv.free == LDKAccess_JCalls_free) {
14296 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14297 LDKAccess_JCalls_cloned(&o_conv);
14299 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14300 *ret_copy = COption_AccessZ_some(o_conv);
14301 uint32_t ret_ref = (uintptr_t)ret_copy;
14305 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14306 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14307 *ret_copy = COption_AccessZ_none();
14308 uint32_t ret_ref = (uintptr_t)ret_copy;
14312 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
14313 if ((_res & 1) != 0) return;
14314 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14315 CHECK_ACCESS(_res_ptr);
14316 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14318 COption_AccessZ_free(_res_conv);
14321 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14322 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14323 *ret_conv = CResult_boolLightningErrorZ_ok(o);
14324 return (uint32_t)ret_conv;
14327 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
14328 LDKLightningError e_conv;
14329 e_conv.inner = (void*)(e & (~1));
14330 e_conv.is_owned = (e & 1) || (e == 0);
14331 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14332 e_conv = LightningError_clone(&e_conv);
14333 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14334 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14335 return (uint32_t)ret_conv;
14338 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
14339 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
14340 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14344 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
14345 if ((_res & 1) != 0) return;
14346 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14347 CHECK_ACCESS(_res_ptr);
14348 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14350 CResult_boolLightningErrorZ_free(_res_conv);
14353 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14354 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14355 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14356 return (uint32_t)ret_conv;
14358 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
14359 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
14360 uint32_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14364 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
14365 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
14366 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14367 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14368 return (uint32_t)ret_conv;
14371 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14372 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14373 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14374 return ((uint32_t)ret_conv);
14376 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
14377 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
14378 uint32_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14382 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
14383 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
14384 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14385 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14386 return ((uint32_t)ret_conv);
14389 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
14390 LDKChannelAnnouncement a_conv;
14391 a_conv.inner = (void*)(a & (~1));
14392 a_conv.is_owned = (a & 1) || (a == 0);
14393 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14394 a_conv = ChannelAnnouncement_clone(&a_conv);
14395 LDKChannelUpdate b_conv;
14396 b_conv.inner = (void*)(b & (~1));
14397 b_conv.is_owned = (b & 1) || (b == 0);
14398 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14399 b_conv = ChannelUpdate_clone(&b_conv);
14400 LDKChannelUpdate c_conv;
14401 c_conv.inner = (void*)(c & (~1));
14402 c_conv.is_owned = (c & 1) || (c == 0);
14403 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14404 c_conv = ChannelUpdate_clone(&c_conv);
14405 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14406 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14407 return ((uint32_t)ret_conv);
14410 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
14411 if ((_res & 1) != 0) return;
14412 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14413 CHECK_ACCESS(_res_ptr);
14414 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14416 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14419 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
14420 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
14421 _res_constr.datalen = _res->arr_len;
14422 if (_res_constr.datalen > 0)
14423 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
14425 _res_constr.data = NULL;
14426 uint32_t* _res_vals = _res->elems;
14427 for (size_t h = 0; h < _res_constr.datalen; h++) {
14428 uint32_t _res_conv_59 = _res_vals[h];
14429 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
14430 CHECK_ACCESS(_res_conv_59_ptr);
14431 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
14432 FREE((void*)_res_conv_59);
14433 _res_constr.data[h] = _res_conv_59_conv;
14436 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
14439 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
14440 LDKCVec_NodeAnnouncementZ _res_constr;
14441 _res_constr.datalen = _res->arr_len;
14442 if (_res_constr.datalen > 0)
14443 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
14445 _res_constr.data = NULL;
14446 uint32_t* _res_vals = _res->elems;
14447 for (size_t s = 0; s < _res_constr.datalen; s++) {
14448 uint32_t _res_conv_18 = _res_vals[s];
14449 LDKNodeAnnouncement _res_conv_18_conv;
14450 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
14451 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
14452 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
14453 _res_constr.data[s] = _res_conv_18_conv;
14456 CVec_NodeAnnouncementZ_free(_res_constr);
14459 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14460 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14461 *ret_conv = CResult_NoneLightningErrorZ_ok();
14462 return (uint32_t)ret_conv;
14465 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
14466 LDKLightningError e_conv;
14467 e_conv.inner = (void*)(e & (~1));
14468 e_conv.is_owned = (e & 1) || (e == 0);
14469 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14470 e_conv = LightningError_clone(&e_conv);
14471 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14472 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14473 return (uint32_t)ret_conv;
14476 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
14477 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
14478 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14482 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
14483 if ((_res & 1) != 0) return;
14484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14485 CHECK_ACCESS(_res_ptr);
14486 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14488 CResult_NoneLightningErrorZ_free(_res_conv);
14491 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14492 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14493 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14494 return (uint32_t)ret_conv;
14496 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
14497 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
14498 uint32_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14502 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
14503 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
14504 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14505 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14506 return (uint32_t)ret_conv;
14509 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
14510 LDKChannelUpdateInfo o_conv;
14511 o_conv.inner = (void*)(o & (~1));
14512 o_conv.is_owned = (o & 1) || (o == 0);
14513 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14514 o_conv = ChannelUpdateInfo_clone(&o_conv);
14515 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14516 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
14517 return (uint32_t)ret_conv;
14520 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
14521 LDKDecodeError e_conv;
14522 e_conv.inner = (void*)(e & (~1));
14523 e_conv.is_owned = (e & 1) || (e == 0);
14524 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14525 e_conv = DecodeError_clone(&e_conv);
14526 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14527 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
14528 return (uint32_t)ret_conv;
14531 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
14532 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
14533 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
14537 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
14538 if ((_res & 1) != 0) return;
14539 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14540 CHECK_ACCESS(_res_ptr);
14541 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
14543 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
14546 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
14547 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14548 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
14549 return (uint32_t)ret_conv;
14551 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14552 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
14553 uint32_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
14557 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
14558 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
14559 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14560 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
14561 return (uint32_t)ret_conv;
14564 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
14565 LDKChannelInfo o_conv;
14566 o_conv.inner = (void*)(o & (~1));
14567 o_conv.is_owned = (o & 1) || (o == 0);
14568 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14569 o_conv = ChannelInfo_clone(&o_conv);
14570 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14571 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14572 return (uint32_t)ret_conv;
14575 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
14576 LDKDecodeError e_conv;
14577 e_conv.inner = (void*)(e & (~1));
14578 e_conv.is_owned = (e & 1) || (e == 0);
14579 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14580 e_conv = DecodeError_clone(&e_conv);
14581 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14582 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14583 return (uint32_t)ret_conv;
14586 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
14587 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
14588 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14592 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
14593 if ((_res & 1) != 0) return;
14594 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14595 CHECK_ACCESS(_res_ptr);
14596 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14598 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14601 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14602 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14603 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14604 return (uint32_t)ret_conv;
14606 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14607 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
14608 uint32_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14612 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
14613 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
14614 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14615 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14616 return (uint32_t)ret_conv;
14619 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
14620 LDKRoutingFees o_conv;
14621 o_conv.inner = (void*)(o & (~1));
14622 o_conv.is_owned = (o & 1) || (o == 0);
14623 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14624 o_conv = RoutingFees_clone(&o_conv);
14625 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14626 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14627 return (uint32_t)ret_conv;
14630 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
14631 LDKDecodeError e_conv;
14632 e_conv.inner = (void*)(e & (~1));
14633 e_conv.is_owned = (e & 1) || (e == 0);
14634 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14635 e_conv = DecodeError_clone(&e_conv);
14636 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14637 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14638 return (uint32_t)ret_conv;
14641 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
14642 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
14643 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14647 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
14648 if ((_res & 1) != 0) return;
14649 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14650 CHECK_ACCESS(_res_ptr);
14651 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14653 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14656 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14657 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14658 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14659 return (uint32_t)ret_conv;
14661 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
14662 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
14663 uint32_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14667 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
14668 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14669 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14670 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14671 return (uint32_t)ret_conv;
14674 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14675 LDKCVec_NetAddressZ _res_constr;
14676 _res_constr.datalen = _res->arr_len;
14677 if (_res_constr.datalen > 0)
14678 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14680 _res_constr.data = NULL;
14681 uint32_t* _res_vals = _res->elems;
14682 for (size_t m = 0; m < _res_constr.datalen; m++) {
14683 uint32_t _res_conv_12 = _res_vals[m];
14684 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14685 CHECK_ACCESS(_res_conv_12_ptr);
14686 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14687 FREE((void*)_res_conv_12);
14688 _res_constr.data[m] = _res_conv_12_conv;
14691 CVec_NetAddressZ_free(_res_constr);
14694 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
14695 LDKNodeAnnouncementInfo o_conv;
14696 o_conv.inner = (void*)(o & (~1));
14697 o_conv.is_owned = (o & 1) || (o == 0);
14698 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14699 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14700 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14701 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14702 return (uint32_t)ret_conv;
14705 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
14706 LDKDecodeError e_conv;
14707 e_conv.inner = (void*)(e & (~1));
14708 e_conv.is_owned = (e & 1) || (e == 0);
14709 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14710 e_conv = DecodeError_clone(&e_conv);
14711 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14712 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14713 return (uint32_t)ret_conv;
14716 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
14717 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
14718 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14722 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
14723 if ((_res & 1) != 0) return;
14724 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14725 CHECK_ACCESS(_res_ptr);
14726 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14728 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14731 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14732 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14733 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14734 return (uint32_t)ret_conv;
14736 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14737 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
14738 uint32_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14742 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
14743 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14744 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14745 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14746 return (uint32_t)ret_conv;
14749 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint32_t o) {
14750 LDKNodeAlias o_conv;
14751 o_conv.inner = (void*)(o & (~1));
14752 o_conv.is_owned = (o & 1) || (o == 0);
14753 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14754 o_conv = NodeAlias_clone(&o_conv);
14755 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14756 *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
14757 return (uint32_t)ret_conv;
14760 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint32_t e) {
14761 LDKDecodeError e_conv;
14762 e_conv.inner = (void*)(e & (~1));
14763 e_conv.is_owned = (e & 1) || (e == 0);
14764 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14765 e_conv = DecodeError_clone(&e_conv);
14766 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14767 *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
14768 return (uint32_t)ret_conv;
14771 jboolean __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint32_t o) {
14772 LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(o & ~1);
14773 jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
14777 void __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint32_t _res) {
14778 if ((_res & 1) != 0) return;
14779 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14780 CHECK_ACCESS(_res_ptr);
14781 LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
14783 CResult_NodeAliasDecodeErrorZ_free(_res_conv);
14786 static inline uintptr_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
14787 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14788 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
14789 return (uint32_t)ret_conv;
14791 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint32_t arg) {
14792 LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(arg & ~1);
14793 uint32_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
14797 uint32_t __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint32_t orig) {
14798 LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)(orig & ~1);
14799 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14800 *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
14801 return (uint32_t)ret_conv;
14804 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
14805 LDKNodeInfo o_conv;
14806 o_conv.inner = (void*)(o & (~1));
14807 o_conv.is_owned = (o & 1) || (o == 0);
14808 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14809 o_conv = NodeInfo_clone(&o_conv);
14810 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14811 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14812 return (uint32_t)ret_conv;
14815 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
14816 LDKDecodeError e_conv;
14817 e_conv.inner = (void*)(e & (~1));
14818 e_conv.is_owned = (e & 1) || (e == 0);
14819 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14820 e_conv = DecodeError_clone(&e_conv);
14821 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14822 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14823 return (uint32_t)ret_conv;
14826 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
14827 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
14828 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14832 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
14833 if ((_res & 1) != 0) return;
14834 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14835 CHECK_ACCESS(_res_ptr);
14836 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14838 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14841 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14842 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14843 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14844 return (uint32_t)ret_conv;
14846 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14847 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
14848 uint32_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14852 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
14853 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14854 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14855 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14856 return (uint32_t)ret_conv;
14859 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
14860 LDKNetworkGraph o_conv;
14861 o_conv.inner = (void*)(o & (~1));
14862 o_conv.is_owned = (o & 1) || (o == 0);
14863 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14864 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14865 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14866 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14867 return (uint32_t)ret_conv;
14870 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
14871 LDKDecodeError e_conv;
14872 e_conv.inner = (void*)(e & (~1));
14873 e_conv.is_owned = (e & 1) || (e == 0);
14874 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14875 e_conv = DecodeError_clone(&e_conv);
14876 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14877 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14878 return (uint32_t)ret_conv;
14881 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
14882 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
14883 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14887 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
14888 if ((_res & 1) != 0) return;
14889 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14890 CHECK_ACCESS(_res_ptr);
14891 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14893 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14896 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
14897 LDKCVec_NetAddressZ o_constr;
14898 o_constr.datalen = o->arr_len;
14899 if (o_constr.datalen > 0)
14900 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14902 o_constr.data = NULL;
14903 uint32_t* o_vals = o->elems;
14904 for (size_t m = 0; m < o_constr.datalen; m++) {
14905 uint32_t o_conv_12 = o_vals[m];
14906 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
14907 CHECK_ACCESS(o_conv_12_ptr);
14908 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14909 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
14910 o_constr.data[m] = o_conv_12_conv;
14913 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14914 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14915 uint32_t ret_ref = (uintptr_t)ret_copy;
14919 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14920 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14921 *ret_copy = COption_CVec_NetAddressZZ_none();
14922 uint32_t ret_ref = (uintptr_t)ret_copy;
14926 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
14927 if ((_res & 1) != 0) return;
14928 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14929 CHECK_ACCESS(_res_ptr);
14930 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14932 COption_CVec_NetAddressZZ_free(_res_conv);
14935 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14936 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14937 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14938 uint32_t ret_ref = (uintptr_t)ret_copy;
14941 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
14942 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
14943 uint32_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14947 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
14948 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14949 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14950 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14951 uint32_t ret_ref = (uintptr_t)ret_copy;
14955 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14956 LDKDelayedPaymentOutputDescriptor o_conv;
14957 o_conv.inner = (void*)(o & (~1));
14958 o_conv.is_owned = (o & 1) || (o == 0);
14959 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14960 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14961 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14962 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14963 return (uint32_t)ret_conv;
14966 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14967 LDKDecodeError e_conv;
14968 e_conv.inner = (void*)(e & (~1));
14969 e_conv.is_owned = (e & 1) || (e == 0);
14970 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14971 e_conv = DecodeError_clone(&e_conv);
14972 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14973 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14974 return (uint32_t)ret_conv;
14977 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14978 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14979 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14983 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14984 if ((_res & 1) != 0) return;
14985 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14986 CHECK_ACCESS(_res_ptr);
14987 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14989 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14992 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14993 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14994 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14995 return (uint32_t)ret_conv;
14997 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14998 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14999 uint32_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15003 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15004 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15005 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15006 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15007 return (uint32_t)ret_conv;
15010 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
15011 LDKStaticPaymentOutputDescriptor o_conv;
15012 o_conv.inner = (void*)(o & (~1));
15013 o_conv.is_owned = (o & 1) || (o == 0);
15014 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15015 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15016 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15017 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15018 return (uint32_t)ret_conv;
15021 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
15022 LDKDecodeError e_conv;
15023 e_conv.inner = (void*)(e & (~1));
15024 e_conv.is_owned = (e & 1) || (e == 0);
15025 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15026 e_conv = DecodeError_clone(&e_conv);
15027 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15028 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15029 return (uint32_t)ret_conv;
15032 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
15033 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
15034 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15038 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
15039 if ((_res & 1) != 0) return;
15040 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15041 CHECK_ACCESS(_res_ptr);
15042 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15044 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15047 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15048 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15049 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15050 return (uint32_t)ret_conv;
15052 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
15053 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
15054 uint32_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15058 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15059 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15060 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15061 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15062 return (uint32_t)ret_conv;
15065 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
15066 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15067 CHECK_ACCESS(o_ptr);
15068 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15069 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
15070 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15071 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15072 return (uint32_t)ret_conv;
15075 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
15076 LDKDecodeError e_conv;
15077 e_conv.inner = (void*)(e & (~1));
15078 e_conv.is_owned = (e & 1) || (e == 0);
15079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15080 e_conv = DecodeError_clone(&e_conv);
15081 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15082 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15083 return (uint32_t)ret_conv;
15086 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
15087 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
15088 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15092 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
15093 if ((_res & 1) != 0) return;
15094 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15095 CHECK_ACCESS(_res_ptr);
15096 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15098 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15101 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15102 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15103 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15104 return (uint32_t)ret_conv;
15106 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
15107 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
15108 uint32_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15112 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
15113 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
15114 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15115 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15116 return (uint32_t)ret_conv;
15119 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
15120 LDKCVec_PaymentPreimageZ _res_constr;
15121 _res_constr.datalen = _res->arr_len;
15122 if (_res_constr.datalen > 0)
15123 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15125 _res_constr.data = NULL;
15126 int8_tArray* _res_vals = (void*) _res->elems;
15127 for (size_t m = 0; m < _res_constr.datalen; m++) {
15128 int8_tArray _res_conv_12 = _res_vals[m];
15129 LDKThirtyTwoBytes _res_conv_12_ref;
15130 CHECK(_res_conv_12->arr_len == 32);
15131 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15132 _res_constr.data[m] = _res_conv_12_ref;
15135 CVec_PaymentPreimageZ_free(_res_constr);
15138 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15139 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15140 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15141 return ((uint32_t)ret_conv);
15143 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
15144 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
15145 uint32_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15149 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
15150 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
15151 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15152 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15153 return ((uint32_t)ret_conv);
15156 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15157 LDKSignature a_ref;
15158 CHECK(a->arr_len == 64);
15159 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15160 LDKCVec_SignatureZ b_constr;
15161 b_constr.datalen = b->arr_len;
15162 if (b_constr.datalen > 0)
15163 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15165 b_constr.data = NULL;
15166 int8_tArray* b_vals = (void*) b->elems;
15167 for (size_t m = 0; m < b_constr.datalen; m++) {
15168 int8_tArray b_conv_12 = b_vals[m];
15169 LDKSignature b_conv_12_ref;
15170 CHECK(b_conv_12->arr_len == 64);
15171 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15172 b_constr.data[m] = b_conv_12_ref;
15175 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15176 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15177 return ((uint32_t)ret_conv);
15180 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
15181 if ((_res & 1) != 0) return;
15182 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15183 CHECK_ACCESS(_res_ptr);
15184 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15186 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15189 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
15190 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15191 CHECK_ACCESS(o_ptr);
15192 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15193 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
15194 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15195 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15196 return (uint32_t)ret_conv;
15199 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15200 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15201 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15202 return (uint32_t)ret_conv;
15205 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
15206 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
15207 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15211 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
15212 if ((_res & 1) != 0) return;
15213 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15214 CHECK_ACCESS(_res_ptr);
15215 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15217 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15220 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15221 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15222 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15223 return (uint32_t)ret_conv;
15225 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
15226 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
15227 uint32_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15231 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
15232 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
15233 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15234 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15235 return (uint32_t)ret_conv;
15238 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15239 LDKSignature o_ref;
15240 CHECK(o->arr_len == 64);
15241 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15242 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15243 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15244 return (uint32_t)ret_conv;
15247 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15248 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15249 *ret_conv = CResult_SignatureNoneZ_err();
15250 return (uint32_t)ret_conv;
15253 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
15254 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
15255 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15259 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
15260 if ((_res & 1) != 0) return;
15261 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15262 CHECK_ACCESS(_res_ptr);
15263 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15265 CResult_SignatureNoneZ_free(_res_conv);
15268 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15269 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15270 *ret_conv = CResult_SignatureNoneZ_clone(arg);
15271 return (uint32_t)ret_conv;
15273 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
15274 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
15275 uint32_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15279 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
15280 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
15281 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15282 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15283 return (uint32_t)ret_conv;
15286 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15287 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15288 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15289 return ((uint32_t)ret_conv);
15291 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
15292 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
15293 uint32_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15297 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
15298 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
15299 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15300 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15301 return ((uint32_t)ret_conv);
15304 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15305 LDKSignature a_ref;
15306 CHECK(a->arr_len == 64);
15307 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15308 LDKSignature b_ref;
15309 CHECK(b->arr_len == 64);
15310 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15311 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15312 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15313 return ((uint32_t)ret_conv);
15316 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
15317 if ((_res & 1) != 0) return;
15318 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15319 CHECK_ACCESS(_res_ptr);
15320 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15322 C2Tuple_SignatureSignatureZ_free(_res_conv);
15325 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
15326 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15327 CHECK_ACCESS(o_ptr);
15328 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15329 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
15330 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15331 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15332 return (uint32_t)ret_conv;
15335 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15336 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15337 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15338 return (uint32_t)ret_conv;
15341 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
15342 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
15343 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15347 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
15348 if ((_res & 1) != 0) return;
15349 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15350 CHECK_ACCESS(_res_ptr);
15351 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15353 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15356 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15357 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15358 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15359 return (uint32_t)ret_conv;
15361 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
15362 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
15363 uint32_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15367 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
15368 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
15369 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15370 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15371 return (uint32_t)ret_conv;
15374 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15375 LDKSecretKey o_ref;
15376 CHECK(o->arr_len == 32);
15377 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15378 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15379 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15380 return (uint32_t)ret_conv;
15383 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15384 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15385 *ret_conv = CResult_SecretKeyNoneZ_err();
15386 return (uint32_t)ret_conv;
15389 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
15390 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
15391 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15395 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
15396 if ((_res & 1) != 0) return;
15397 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15398 CHECK_ACCESS(_res_ptr);
15399 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15401 CResult_SecretKeyNoneZ_free(_res_conv);
15404 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15405 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15406 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15407 return (uint32_t)ret_conv;
15409 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
15410 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
15411 uint32_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15415 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
15416 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
15417 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15418 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15419 return (uint32_t)ret_conv;
15422 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
15423 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15424 CHECK_ACCESS(o_ptr);
15425 LDKSign o_conv = *(LDKSign*)(o_ptr);
15426 if (o_conv.free == LDKSign_JCalls_free) {
15427 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15428 LDKSign_JCalls_cloned(&o_conv);
15430 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15431 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15432 return (uint32_t)ret_conv;
15435 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
15436 LDKDecodeError e_conv;
15437 e_conv.inner = (void*)(e & (~1));
15438 e_conv.is_owned = (e & 1) || (e == 0);
15439 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15440 e_conv = DecodeError_clone(&e_conv);
15441 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15442 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15443 return (uint32_t)ret_conv;
15446 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
15447 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
15448 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
15452 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
15453 if ((_res & 1) != 0) return;
15454 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15455 CHECK_ACCESS(_res_ptr);
15456 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15458 CResult_SignDecodeErrorZ_free(_res_conv);
15461 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15462 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15463 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15464 return (uint32_t)ret_conv;
15466 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
15467 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
15468 uint32_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15472 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
15473 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
15474 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15475 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15476 return (uint32_t)ret_conv;
15479 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
15480 LDKCVec_u5Z _res_constr;
15481 _res_constr.datalen = _res->arr_len;
15482 if (_res_constr.datalen > 0)
15483 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
15485 _res_constr.data = NULL;
15486 int8_t* _res_vals = (void*) _res->elems;
15487 for (size_t h = 0; h < _res_constr.datalen; h++) {
15488 int8_t _res_conv_7 = _res_vals[h];
15490 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
15493 CVec_u5Z_free(_res_constr);
15496 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15497 LDKRecoverableSignature o_ref;
15498 CHECK(o->arr_len == 68);
15499 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
15500 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15501 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15502 return (uint32_t)ret_conv;
15505 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15506 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15507 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15508 return (uint32_t)ret_conv;
15511 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
15512 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
15513 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15517 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
15518 if ((_res & 1) != 0) return;
15519 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15520 CHECK_ACCESS(_res_ptr);
15521 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15523 CResult_RecoverableSignatureNoneZ_free(_res_conv);
15526 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15527 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15528 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15529 return (uint32_t)ret_conv;
15531 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
15532 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
15533 uint32_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15537 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
15538 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
15539 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15540 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15541 return (uint32_t)ret_conv;
15544 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15545 LDKCVec_u8Z _res_ref;
15546 _res_ref.datalen = _res->arr_len;
15547 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15548 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15549 CVec_u8Z_free(_res_ref);
15552 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15553 LDKCVec_CVec_u8ZZ _res_constr;
15554 _res_constr.datalen = _res->arr_len;
15555 if (_res_constr.datalen > 0)
15556 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15558 _res_constr.data = NULL;
15559 int8_tArray* _res_vals = (void*) _res->elems;
15560 for (size_t m = 0; m < _res_constr.datalen; m++) {
15561 int8_tArray _res_conv_12 = _res_vals[m];
15562 LDKCVec_u8Z _res_conv_12_ref;
15563 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15564 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15565 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15566 _res_constr.data[m] = _res_conv_12_ref;
15569 CVec_CVec_u8ZZ_free(_res_constr);
15572 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15573 LDKCVec_CVec_u8ZZ o_constr;
15574 o_constr.datalen = o->arr_len;
15575 if (o_constr.datalen > 0)
15576 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15578 o_constr.data = NULL;
15579 int8_tArray* o_vals = (void*) o->elems;
15580 for (size_t m = 0; m < o_constr.datalen; m++) {
15581 int8_tArray o_conv_12 = o_vals[m];
15582 LDKCVec_u8Z o_conv_12_ref;
15583 o_conv_12_ref.datalen = o_conv_12->arr_len;
15584 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15585 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
15586 o_constr.data[m] = o_conv_12_ref;
15589 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15590 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15591 return (uint32_t)ret_conv;
15594 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15595 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15596 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15597 return (uint32_t)ret_conv;
15600 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
15601 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15602 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15606 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
15607 if ((_res & 1) != 0) return;
15608 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15609 CHECK_ACCESS(_res_ptr);
15610 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15612 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15615 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15616 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15617 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15618 return (uint32_t)ret_conv;
15620 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
15621 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15622 uint32_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15626 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
15627 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15628 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15629 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15630 return (uint32_t)ret_conv;
15633 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
15634 LDKInMemorySigner o_conv;
15635 o_conv.inner = (void*)(o & (~1));
15636 o_conv.is_owned = (o & 1) || (o == 0);
15637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15638 o_conv = InMemorySigner_clone(&o_conv);
15639 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15640 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15641 return (uint32_t)ret_conv;
15644 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15645 LDKDecodeError e_conv;
15646 e_conv.inner = (void*)(e & (~1));
15647 e_conv.is_owned = (e & 1) || (e == 0);
15648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15649 e_conv = DecodeError_clone(&e_conv);
15650 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15651 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15652 return (uint32_t)ret_conv;
15655 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15656 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15657 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15661 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15662 if ((_res & 1) != 0) return;
15663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15664 CHECK_ACCESS(_res_ptr);
15665 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15667 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15670 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15671 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15672 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15673 return (uint32_t)ret_conv;
15675 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15676 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15677 uint32_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15681 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15682 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15683 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15684 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15685 return (uint32_t)ret_conv;
15688 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15689 LDKCVec_TxOutZ _res_constr;
15690 _res_constr.datalen = _res->arr_len;
15691 if (_res_constr.datalen > 0)
15692 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15694 _res_constr.data = NULL;
15695 uint32_t* _res_vals = _res->elems;
15696 for (size_t h = 0; h < _res_constr.datalen; h++) {
15697 uint32_t _res_conv_7 = _res_vals[h];
15698 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15699 CHECK_ACCESS(_res_conv_7_ptr);
15700 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15701 FREE((void*)_res_conv_7);
15702 _res_constr.data[h] = _res_conv_7_conv;
15705 CVec_TxOutZ_free(_res_constr);
15708 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15709 LDKTransaction o_ref;
15710 o_ref.datalen = o->arr_len;
15711 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15712 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15713 o_ref.data_is_owned = true;
15714 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15715 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15716 return (uint32_t)ret_conv;
15719 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15720 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15721 *ret_conv = CResult_TransactionNoneZ_err();
15722 return (uint32_t)ret_conv;
15725 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15726 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15727 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15731 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15732 if ((_res & 1) != 0) return;
15733 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15734 CHECK_ACCESS(_res_ptr);
15735 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15737 CResult_TransactionNoneZ_free(_res_conv);
15740 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15741 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15742 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15743 return (uint32_t)ret_conv;
15745 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15746 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15747 uint32_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15751 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15752 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15753 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15754 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15755 return (uint32_t)ret_conv;
15758 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15759 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15760 *ret_copy = COption_u16Z_some(o);
15761 uint32_t ret_ref = (uintptr_t)ret_copy;
15765 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15766 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15767 *ret_copy = COption_u16Z_none();
15768 uint32_t ret_ref = (uintptr_t)ret_copy;
15772 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15773 if ((_res & 1) != 0) return;
15774 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15775 CHECK_ACCESS(_res_ptr);
15776 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15778 COption_u16Z_free(_res_conv);
15781 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15782 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15783 *ret_copy = COption_u16Z_clone(arg);
15784 uint32_t ret_ref = (uintptr_t)ret_copy;
15787 uint32_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15788 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15789 uint32_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15793 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15794 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15795 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15796 *ret_copy = COption_u16Z_clone(orig_conv);
15797 uint32_t ret_ref = (uintptr_t)ret_copy;
15801 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15802 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15803 *ret_conv = CResult_NoneAPIErrorZ_ok();
15804 return (uint32_t)ret_conv;
15807 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15808 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15809 CHECK_ACCESS(e_ptr);
15810 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15811 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15812 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15813 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15814 return (uint32_t)ret_conv;
15817 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15818 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15819 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15823 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15824 if ((_res & 1) != 0) return;
15825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15826 CHECK_ACCESS(_res_ptr);
15827 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15829 CResult_NoneAPIErrorZ_free(_res_conv);
15832 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15833 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15834 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15835 return (uint32_t)ret_conv;
15837 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15838 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15839 uint32_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15843 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15844 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15845 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15846 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15847 return (uint32_t)ret_conv;
15850 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15851 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15852 _res_constr.datalen = _res->arr_len;
15853 if (_res_constr.datalen > 0)
15854 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15856 _res_constr.data = NULL;
15857 uint32_t* _res_vals = _res->elems;
15858 for (size_t w = 0; w < _res_constr.datalen; w++) {
15859 uint32_t _res_conv_22 = _res_vals[w];
15860 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
15861 CHECK_ACCESS(_res_conv_22_ptr);
15862 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15863 FREE((void*)_res_conv_22);
15864 _res_constr.data[w] = _res_conv_22_conv;
15867 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15870 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15871 LDKCVec_APIErrorZ _res_constr;
15872 _res_constr.datalen = _res->arr_len;
15873 if (_res_constr.datalen > 0)
15874 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15876 _res_constr.data = NULL;
15877 uint32_t* _res_vals = _res->elems;
15878 for (size_t k = 0; k < _res_constr.datalen; k++) {
15879 uint32_t _res_conv_10 = _res_vals[k];
15880 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
15881 CHECK_ACCESS(_res_conv_10_ptr);
15882 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15883 FREE((void*)_res_conv_10);
15884 _res_constr.data[k] = _res_conv_10_conv;
15887 CVec_APIErrorZ_free(_res_constr);
15890 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15891 LDKThirtyTwoBytes o_ref;
15892 CHECK(o->arr_len == 32);
15893 memcpy(o_ref.data, o->elems, 32); FREE(o);
15894 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15895 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15896 return (uint32_t)ret_conv;
15899 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15900 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15901 CHECK_ACCESS(e_ptr);
15902 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15903 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15904 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15905 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15906 return (uint32_t)ret_conv;
15909 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15910 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15911 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15915 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15916 if ((_res & 1) != 0) return;
15917 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15918 CHECK_ACCESS(_res_ptr);
15919 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15921 CResult__u832APIErrorZ_free(_res_conv);
15924 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15925 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15926 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15927 return (uint32_t)ret_conv;
15929 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15930 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15931 uint32_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15935 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15936 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15937 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15938 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15939 return (uint32_t)ret_conv;
15942 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15943 LDKThirtyTwoBytes o_ref;
15944 CHECK(o->arr_len == 32);
15945 memcpy(o_ref.data, o->elems, 32); FREE(o);
15946 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15947 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15948 return (uint32_t)ret_conv;
15951 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15952 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15953 CHECK_ACCESS(e_ptr);
15954 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15955 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15956 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15957 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15958 return (uint32_t)ret_conv;
15961 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15962 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15963 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15967 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15968 if ((_res & 1) != 0) return;
15969 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15970 CHECK_ACCESS(_res_ptr);
15971 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15973 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15976 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15977 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15978 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15979 return (uint32_t)ret_conv;
15981 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15982 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15983 uint32_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15987 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15988 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15989 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15990 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15991 return (uint32_t)ret_conv;
15994 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15995 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15996 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15997 return (uint32_t)ret_conv;
16000 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
16001 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16002 CHECK_ACCESS(e_ptr);
16003 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16004 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
16005 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16006 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16007 return (uint32_t)ret_conv;
16010 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
16011 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
16012 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16016 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
16017 if ((_res & 1) != 0) return;
16018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16019 CHECK_ACCESS(_res_ptr);
16020 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16022 CResult_NonePaymentSendFailureZ_free(_res_conv);
16025 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16026 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16027 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16028 return (uint32_t)ret_conv;
16030 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
16031 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
16032 uint32_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16036 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
16037 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
16038 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16039 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16040 return (uint32_t)ret_conv;
16043 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16044 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16045 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16046 return ((uint32_t)ret_conv);
16048 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
16049 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
16050 uint32_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16054 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
16055 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
16056 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16057 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16058 return ((uint32_t)ret_conv);
16061 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16062 LDKThirtyTwoBytes a_ref;
16063 CHECK(a->arr_len == 32);
16064 memcpy(a_ref.data, a->elems, 32); FREE(a);
16065 LDKThirtyTwoBytes b_ref;
16066 CHECK(b->arr_len == 32);
16067 memcpy(b_ref.data, b->elems, 32); FREE(b);
16068 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16069 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16070 return ((uint32_t)ret_conv);
16073 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
16074 if ((_res & 1) != 0) return;
16075 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16076 CHECK_ACCESS(_res_ptr);
16077 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16079 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16082 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
16083 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16084 CHECK_ACCESS(o_ptr);
16085 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16086 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
16087 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16088 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16089 return (uint32_t)ret_conv;
16092 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
16093 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16094 CHECK_ACCESS(e_ptr);
16095 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16096 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
16097 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16098 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16099 return (uint32_t)ret_conv;
16102 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
16103 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
16104 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16108 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
16109 if ((_res & 1) != 0) return;
16110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16111 CHECK_ACCESS(_res_ptr);
16112 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16114 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16117 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16118 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16119 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16120 return (uint32_t)ret_conv;
16122 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
16123 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
16124 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16128 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
16129 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
16130 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16131 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16132 return (uint32_t)ret_conv;
16135 void __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16136 LDKCVec_ThirtyTwoBytesZ _res_constr;
16137 _res_constr.datalen = _res->arr_len;
16138 if (_res_constr.datalen > 0)
16139 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16141 _res_constr.data = NULL;
16142 int8_tArray* _res_vals = (void*) _res->elems;
16143 for (size_t m = 0; m < _res_constr.datalen; m++) {
16144 int8_tArray _res_conv_12 = _res_vals[m];
16145 LDKThirtyTwoBytes _res_conv_12_ref;
16146 CHECK(_res_conv_12->arr_len == 32);
16147 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16148 _res_constr.data[m] = _res_conv_12_ref;
16151 CVec_ThirtyTwoBytesZ_free(_res_constr);
16154 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16155 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16156 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16157 return ((uint32_t)ret_conv);
16159 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
16160 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
16161 uint32_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16165 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
16166 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
16167 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16168 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16169 return ((uint32_t)ret_conv);
16172 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16173 LDKThirtyTwoBytes a_ref;
16174 CHECK(a->arr_len == 32);
16175 memcpy(a_ref.data, a->elems, 32); FREE(a);
16176 LDKThirtyTwoBytes b_ref;
16177 CHECK(b->arr_len == 32);
16178 memcpy(b_ref.data, b->elems, 32); FREE(b);
16179 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16180 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16181 return ((uint32_t)ret_conv);
16184 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
16185 if ((_res & 1) != 0) return;
16186 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16187 CHECK_ACCESS(_res_ptr);
16188 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16190 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16193 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
16194 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16195 CHECK_ACCESS(o_ptr);
16196 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16197 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
16198 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16199 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16200 return (uint32_t)ret_conv;
16203 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16204 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16205 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16206 return (uint32_t)ret_conv;
16209 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
16210 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
16211 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16215 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
16216 if ((_res & 1) != 0) return;
16217 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16218 CHECK_ACCESS(_res_ptr);
16219 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16221 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16224 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16225 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16226 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16227 return (uint32_t)ret_conv;
16229 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
16230 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
16231 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16235 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
16236 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
16237 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16238 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16239 return (uint32_t)ret_conv;
16242 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
16243 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16244 CHECK_ACCESS(o_ptr);
16245 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16246 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
16247 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16248 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16249 return (uint32_t)ret_conv;
16252 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
16253 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16254 CHECK_ACCESS(e_ptr);
16255 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16256 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16257 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16258 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16259 return (uint32_t)ret_conv;
16262 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
16263 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
16264 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16268 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
16269 if ((_res & 1) != 0) return;
16270 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16271 CHECK_ACCESS(_res_ptr);
16272 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16274 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16277 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16278 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16279 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16280 return (uint32_t)ret_conv;
16282 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
16283 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
16284 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16288 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
16289 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
16290 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16291 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16292 return (uint32_t)ret_conv;
16295 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16296 LDKThirtyTwoBytes o_ref;
16297 CHECK(o->arr_len == 32);
16298 memcpy(o_ref.data, o->elems, 32); FREE(o);
16299 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16300 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16301 return (uint32_t)ret_conv;
16304 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16305 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16306 *ret_conv = CResult_PaymentSecretNoneZ_err();
16307 return (uint32_t)ret_conv;
16310 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
16311 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
16312 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16316 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
16317 if ((_res & 1) != 0) return;
16318 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16319 CHECK_ACCESS(_res_ptr);
16320 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16322 CResult_PaymentSecretNoneZ_free(_res_conv);
16325 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16326 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16327 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16328 return (uint32_t)ret_conv;
16330 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
16331 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
16332 uint32_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16336 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
16337 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
16338 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16339 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16340 return (uint32_t)ret_conv;
16343 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16344 LDKThirtyTwoBytes o_ref;
16345 CHECK(o->arr_len == 32);
16346 memcpy(o_ref.data, o->elems, 32); FREE(o);
16347 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16348 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16349 return (uint32_t)ret_conv;
16352 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
16353 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16354 CHECK_ACCESS(e_ptr);
16355 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16356 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16357 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16358 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16359 return (uint32_t)ret_conv;
16362 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
16363 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
16364 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16368 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
16369 if ((_res & 1) != 0) return;
16370 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16371 CHECK_ACCESS(_res_ptr);
16372 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16374 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16377 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16378 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16379 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16380 return (uint32_t)ret_conv;
16382 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
16383 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
16384 uint32_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16388 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
16389 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
16390 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16391 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16392 return (uint32_t)ret_conv;
16395 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16396 LDKThirtyTwoBytes o_ref;
16397 CHECK(o->arr_len == 32);
16398 memcpy(o_ref.data, o->elems, 32); FREE(o);
16399 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16400 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16401 return (uint32_t)ret_conv;
16404 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
16405 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16406 CHECK_ACCESS(e_ptr);
16407 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16408 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16409 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16410 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16411 return (uint32_t)ret_conv;
16414 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
16415 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
16416 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16420 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
16421 if ((_res & 1) != 0) return;
16422 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16423 CHECK_ACCESS(_res_ptr);
16424 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16426 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16429 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16430 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16431 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16432 return (uint32_t)ret_conv;
16434 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
16435 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
16436 uint32_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16440 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
16441 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
16442 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16443 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16444 return (uint32_t)ret_conv;
16447 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
16448 LDKCounterpartyForwardingInfo o_conv;
16449 o_conv.inner = (void*)(o & (~1));
16450 o_conv.is_owned = (o & 1) || (o == 0);
16451 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16452 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
16453 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16454 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
16455 return (uint32_t)ret_conv;
16458 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
16459 LDKDecodeError e_conv;
16460 e_conv.inner = (void*)(e & (~1));
16461 e_conv.is_owned = (e & 1) || (e == 0);
16462 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16463 e_conv = DecodeError_clone(&e_conv);
16464 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16465 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
16466 return (uint32_t)ret_conv;
16469 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
16470 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
16471 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
16475 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
16476 if ((_res & 1) != 0) return;
16477 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16478 CHECK_ACCESS(_res_ptr);
16479 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
16481 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
16484 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
16485 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16486 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
16487 return (uint32_t)ret_conv;
16489 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16490 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
16491 uint32_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
16495 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
16496 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
16497 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16498 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
16499 return (uint32_t)ret_conv;
16502 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
16503 LDKChannelCounterparty o_conv;
16504 o_conv.inner = (void*)(o & (~1));
16505 o_conv.is_owned = (o & 1) || (o == 0);
16506 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16507 o_conv = ChannelCounterparty_clone(&o_conv);
16508 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16509 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
16510 return (uint32_t)ret_conv;
16513 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
16514 LDKDecodeError e_conv;
16515 e_conv.inner = (void*)(e & (~1));
16516 e_conv.is_owned = (e & 1) || (e == 0);
16517 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16518 e_conv = DecodeError_clone(&e_conv);
16519 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16520 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
16521 return (uint32_t)ret_conv;
16524 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
16525 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
16526 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
16530 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
16531 if ((_res & 1) != 0) return;
16532 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16533 CHECK_ACCESS(_res_ptr);
16534 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
16536 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
16539 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
16540 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16541 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
16542 return (uint32_t)ret_conv;
16544 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
16545 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
16546 uint32_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
16550 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
16551 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
16552 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16553 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
16554 return (uint32_t)ret_conv;
16557 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
16558 LDKChannelDetails 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 = ChannelDetails_clone(&o_conv);
16563 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16564 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
16565 return (uint32_t)ret_conv;
16568 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
16569 LDKDecodeError e_conv;
16570 e_conv.inner = (void*)(e & (~1));
16571 e_conv.is_owned = (e & 1) || (e == 0);
16572 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16573 e_conv = DecodeError_clone(&e_conv);
16574 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16575 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
16576 return (uint32_t)ret_conv;
16579 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
16580 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
16581 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
16585 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
16586 if ((_res & 1) != 0) return;
16587 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16588 CHECK_ACCESS(_res_ptr);
16589 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
16591 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
16594 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
16595 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16596 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
16597 return (uint32_t)ret_conv;
16599 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
16600 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
16601 uint32_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
16605 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
16606 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
16607 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16608 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
16609 return (uint32_t)ret_conv;
16612 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
16613 LDKPhantomRouteHints o_conv;
16614 o_conv.inner = (void*)(o & (~1));
16615 o_conv.is_owned = (o & 1) || (o == 0);
16616 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16617 o_conv = PhantomRouteHints_clone(&o_conv);
16618 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16619 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
16620 return (uint32_t)ret_conv;
16623 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
16624 LDKDecodeError e_conv;
16625 e_conv.inner = (void*)(e & (~1));
16626 e_conv.is_owned = (e & 1) || (e == 0);
16627 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16628 e_conv = DecodeError_clone(&e_conv);
16629 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16630 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
16631 return (uint32_t)ret_conv;
16634 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
16635 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
16636 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
16640 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
16641 if ((_res & 1) != 0) return;
16642 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16643 CHECK_ACCESS(_res_ptr);
16644 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
16646 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
16649 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
16650 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16651 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
16652 return (uint32_t)ret_conv;
16654 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
16655 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
16656 uint32_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16660 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
16661 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
16662 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16663 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16664 return (uint32_t)ret_conv;
16667 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
16668 LDKCVec_ChannelMonitorZ _res_constr;
16669 _res_constr.datalen = _res->arr_len;
16670 if (_res_constr.datalen > 0)
16671 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16673 _res_constr.data = NULL;
16674 uint32_t* _res_vals = _res->elems;
16675 for (size_t q = 0; q < _res_constr.datalen; q++) {
16676 uint32_t _res_conv_16 = _res_vals[q];
16677 LDKChannelMonitor _res_conv_16_conv;
16678 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16679 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16680 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16681 _res_constr.data[q] = _res_conv_16_conv;
16684 CVec_ChannelMonitorZ_free(_res_constr);
16687 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
16688 LDKThirtyTwoBytes a_ref;
16689 CHECK(a->arr_len == 32);
16690 memcpy(a_ref.data, a->elems, 32); FREE(a);
16691 LDKChannelManager b_conv;
16692 b_conv.inner = (void*)(b & (~1));
16693 b_conv.is_owned = (b & 1) || (b == 0);
16694 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16695 // WARNING: we need a move here but no clone is available for LDKChannelManager
16696 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16697 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16698 return ((uint32_t)ret_conv);
16701 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
16702 if ((_res & 1) != 0) return;
16703 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16704 CHECK_ACCESS(_res_ptr);
16705 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16707 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16710 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16711 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16712 CHECK_ACCESS(o_ptr);
16713 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16714 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16715 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16716 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16717 return (uint32_t)ret_conv;
16720 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16721 LDKDecodeError e_conv;
16722 e_conv.inner = (void*)(e & (~1));
16723 e_conv.is_owned = (e & 1) || (e == 0);
16724 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16725 e_conv = DecodeError_clone(&e_conv);
16726 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16727 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16728 return (uint32_t)ret_conv;
16731 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16732 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16733 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16737 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16738 if ((_res & 1) != 0) return;
16739 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16740 CHECK_ACCESS(_res_ptr);
16741 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16743 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16746 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
16747 LDKChannelConfig o_conv;
16748 o_conv.inner = (void*)(o & (~1));
16749 o_conv.is_owned = (o & 1) || (o == 0);
16750 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16751 o_conv = ChannelConfig_clone(&o_conv);
16752 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16753 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16754 return (uint32_t)ret_conv;
16757 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
16758 LDKDecodeError e_conv;
16759 e_conv.inner = (void*)(e & (~1));
16760 e_conv.is_owned = (e & 1) || (e == 0);
16761 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16762 e_conv = DecodeError_clone(&e_conv);
16763 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16764 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16765 return (uint32_t)ret_conv;
16768 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
16769 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
16770 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16774 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
16775 if ((_res & 1) != 0) return;
16776 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16777 CHECK_ACCESS(_res_ptr);
16778 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16780 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16783 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16784 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16785 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16786 return (uint32_t)ret_conv;
16788 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
16789 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
16790 uint32_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16794 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
16795 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
16796 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16797 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16798 return (uint32_t)ret_conv;
16801 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
16802 LDKOutPoint o_conv;
16803 o_conv.inner = (void*)(o & (~1));
16804 o_conv.is_owned = (o & 1) || (o == 0);
16805 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16806 o_conv = OutPoint_clone(&o_conv);
16807 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16808 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16809 return (uint32_t)ret_conv;
16812 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
16813 LDKDecodeError e_conv;
16814 e_conv.inner = (void*)(e & (~1));
16815 e_conv.is_owned = (e & 1) || (e == 0);
16816 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16817 e_conv = DecodeError_clone(&e_conv);
16818 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16819 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16820 return (uint32_t)ret_conv;
16823 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
16824 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
16825 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16829 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
16830 if ((_res & 1) != 0) return;
16831 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16832 CHECK_ACCESS(_res_ptr);
16833 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16835 CResult_OutPointDecodeErrorZ_free(_res_conv);
16838 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16839 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16840 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16841 return (uint32_t)ret_conv;
16843 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
16844 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
16845 uint32_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16849 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
16850 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
16851 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16852 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16853 return (uint32_t)ret_conv;
16856 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
16857 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16858 CHECK_ACCESS(o_ptr);
16859 LDKType o_conv = *(LDKType*)(o_ptr);
16860 if (o_conv.free == LDKType_JCalls_free) {
16861 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16862 LDKType_JCalls_cloned(&o_conv);
16864 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16865 *ret_copy = COption_TypeZ_some(o_conv);
16866 uint32_t ret_ref = (uintptr_t)ret_copy;
16870 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16871 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16872 *ret_copy = COption_TypeZ_none();
16873 uint32_t ret_ref = (uintptr_t)ret_copy;
16877 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
16878 if ((_res & 1) != 0) return;
16879 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16880 CHECK_ACCESS(_res_ptr);
16881 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16883 COption_TypeZ_free(_res_conv);
16886 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16887 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16888 *ret_copy = COption_TypeZ_clone(arg);
16889 uint32_t ret_ref = (uintptr_t)ret_copy;
16892 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
16893 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
16894 uint32_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16898 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
16899 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
16900 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16901 *ret_copy = COption_TypeZ_clone(orig_conv);
16902 uint32_t ret_ref = (uintptr_t)ret_copy;
16906 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
16907 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16908 CHECK_ACCESS(o_ptr);
16909 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16910 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
16911 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16912 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16913 return (uint32_t)ret_conv;
16916 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
16917 LDKDecodeError e_conv;
16918 e_conv.inner = (void*)(e & (~1));
16919 e_conv.is_owned = (e & 1) || (e == 0);
16920 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16921 e_conv = DecodeError_clone(&e_conv);
16922 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16923 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16924 return (uint32_t)ret_conv;
16927 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
16928 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
16929 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16933 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
16934 if ((_res & 1) != 0) return;
16935 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16936 CHECK_ACCESS(_res_ptr);
16937 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16939 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16942 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16943 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16944 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16945 return (uint32_t)ret_conv;
16947 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
16948 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
16949 uint32_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16953 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
16954 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
16955 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16956 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16957 return (uint32_t)ret_conv;
16960 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16961 LDKThirtyTwoBytes o_ref;
16962 CHECK(o->arr_len == 32);
16963 memcpy(o_ref.data, o->elems, 32); FREE(o);
16964 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16965 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16966 return (uint32_t)ret_conv;
16969 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
16970 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16971 CHECK_ACCESS(e_ptr);
16972 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16973 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
16974 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16975 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16976 return (uint32_t)ret_conv;
16979 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
16980 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
16981 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16985 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
16986 if ((_res & 1) != 0) return;
16987 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16988 CHECK_ACCESS(_res_ptr);
16989 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16991 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16994 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16995 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16996 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16997 return (uint32_t)ret_conv;
16999 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
17000 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
17001 uint32_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17005 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
17006 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
17007 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17008 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17009 return (uint32_t)ret_conv;
17012 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
17013 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
17014 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17015 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
17016 return (uint32_t)ret_conv;
17019 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint32_t e) {
17020 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17021 CHECK_ACCESS(e_ptr);
17022 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17023 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
17024 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17025 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
17026 return (uint32_t)ret_conv;
17029 jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint32_t o) {
17030 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
17031 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
17035 void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint32_t _res) {
17036 if ((_res & 1) != 0) return;
17037 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17038 CHECK_ACCESS(_res_ptr);
17039 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
17041 CResult_SiPrefixParseErrorZ_free(_res_conv);
17044 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
17045 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17046 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
17047 return (uint32_t)ret_conv;
17049 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint32_t arg) {
17050 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
17051 uint32_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
17055 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint32_t orig) {
17056 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
17057 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17058 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
17059 return (uint32_t)ret_conv;
17062 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint32_t o) {
17064 o_conv.inner = (void*)(o & (~1));
17065 o_conv.is_owned = (o & 1) || (o == 0);
17066 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17067 o_conv = Invoice_clone(&o_conv);
17068 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17069 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
17070 return (uint32_t)ret_conv;
17073 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint32_t e) {
17074 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17075 CHECK_ACCESS(e_ptr);
17076 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
17077 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
17078 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17079 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
17080 return (uint32_t)ret_conv;
17083 jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint32_t o) {
17084 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
17085 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
17089 void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint32_t _res) {
17090 if ((_res & 1) != 0) return;
17091 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17092 CHECK_ACCESS(_res_ptr);
17093 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
17095 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
17098 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
17099 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17100 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
17101 return (uint32_t)ret_conv;
17103 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint32_t arg) {
17104 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
17105 uint32_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
17109 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint32_t orig) {
17110 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
17111 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17112 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
17113 return (uint32_t)ret_conv;
17116 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint32_t o) {
17117 LDKSignedRawInvoice o_conv;
17118 o_conv.inner = (void*)(o & (~1));
17119 o_conv.is_owned = (o & 1) || (o == 0);
17120 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17121 o_conv = SignedRawInvoice_clone(&o_conv);
17122 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17123 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
17124 return (uint32_t)ret_conv;
17127 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint32_t e) {
17128 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17129 CHECK_ACCESS(e_ptr);
17130 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17131 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
17132 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17133 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
17134 return (uint32_t)ret_conv;
17137 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint32_t o) {
17138 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
17139 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
17143 void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint32_t _res) {
17144 if ((_res & 1) != 0) return;
17145 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17146 CHECK_ACCESS(_res_ptr);
17147 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
17149 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
17152 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
17153 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17154 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
17155 return (uint32_t)ret_conv;
17157 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint32_t arg) {
17158 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
17159 uint32_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
17163 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint32_t orig) {
17164 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
17165 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17166 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
17167 return (uint32_t)ret_conv;
17170 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17171 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17172 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17173 return ((uint32_t)ret_conv);
17175 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
17176 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
17177 uint32_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17181 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
17182 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
17183 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17184 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17185 return ((uint32_t)ret_conv);
17188 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
17189 LDKRawInvoice a_conv;
17190 a_conv.inner = (void*)(a & (~1));
17191 a_conv.is_owned = (a & 1) || (a == 0);
17192 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17193 a_conv = RawInvoice_clone(&a_conv);
17194 LDKThirtyTwoBytes b_ref;
17195 CHECK(b->arr_len == 32);
17196 memcpy(b_ref.data, b->elems, 32); FREE(b);
17197 LDKInvoiceSignature c_conv;
17198 c_conv.inner = (void*)(c & (~1));
17199 c_conv.is_owned = (c & 1) || (c == 0);
17200 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17201 c_conv = InvoiceSignature_clone(&c_conv);
17202 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17203 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17204 return ((uint32_t)ret_conv);
17207 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
17208 if ((_res & 1) != 0) return;
17209 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17210 CHECK_ACCESS(_res_ptr);
17211 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17213 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17216 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
17217 LDKPayeePubKey o_conv;
17218 o_conv.inner = (void*)(o & (~1));
17219 o_conv.is_owned = (o & 1) || (o == 0);
17220 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17221 o_conv = PayeePubKey_clone(&o_conv);
17222 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17223 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17224 return (uint32_t)ret_conv;
17227 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
17228 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17229 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17230 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17231 return (uint32_t)ret_conv;
17234 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
17235 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
17236 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17240 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
17241 if ((_res & 1) != 0) return;
17242 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17243 CHECK_ACCESS(_res_ptr);
17244 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17246 CResult_PayeePubKeyErrorZ_free(_res_conv);
17249 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17250 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17251 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17252 return (uint32_t)ret_conv;
17254 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
17255 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
17256 uint32_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17260 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
17261 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
17262 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17263 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17264 return (uint32_t)ret_conv;
17267 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
17268 LDKCVec_PrivateRouteZ _res_constr;
17269 _res_constr.datalen = _res->arr_len;
17270 if (_res_constr.datalen > 0)
17271 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17273 _res_constr.data = NULL;
17274 uint32_t* _res_vals = _res->elems;
17275 for (size_t o = 0; o < _res_constr.datalen; o++) {
17276 uint32_t _res_conv_14 = _res_vals[o];
17277 LDKPrivateRoute _res_conv_14_conv;
17278 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
17279 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
17280 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17281 _res_constr.data[o] = _res_conv_14_conv;
17284 CVec_PrivateRouteZ_free(_res_constr);
17287 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
17288 LDKPositiveTimestamp o_conv;
17289 o_conv.inner = (void*)(o & (~1));
17290 o_conv.is_owned = (o & 1) || (o == 0);
17291 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17292 o_conv = PositiveTimestamp_clone(&o_conv);
17293 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17294 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17295 return (uint32_t)ret_conv;
17298 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
17299 LDKCreationError e_conv = LDKCreationError_from_js(e);
17300 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17301 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17302 return (uint32_t)ret_conv;
17305 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
17306 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
17307 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17311 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
17312 if ((_res & 1) != 0) return;
17313 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17314 CHECK_ACCESS(_res_ptr);
17315 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17317 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17320 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17321 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17322 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17323 return (uint32_t)ret_conv;
17325 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
17326 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
17327 uint32_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17331 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
17332 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
17333 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17334 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17335 return (uint32_t)ret_conv;
17338 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
17339 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17340 *ret_conv = CResult_NoneSemanticErrorZ_ok();
17341 return (uint32_t)ret_conv;
17344 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
17345 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17346 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17347 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17348 return (uint32_t)ret_conv;
17351 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
17352 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
17353 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17357 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
17358 if ((_res & 1) != 0) return;
17359 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17360 CHECK_ACCESS(_res_ptr);
17361 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17363 CResult_NoneSemanticErrorZ_free(_res_conv);
17366 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17367 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17368 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17369 return (uint32_t)ret_conv;
17371 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
17372 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
17373 uint32_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17377 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
17378 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
17379 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17380 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17381 return (uint32_t)ret_conv;
17384 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
17386 o_conv.inner = (void*)(o & (~1));
17387 o_conv.is_owned = (o & 1) || (o == 0);
17388 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17389 o_conv = Invoice_clone(&o_conv);
17390 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17391 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17392 return (uint32_t)ret_conv;
17395 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
17396 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17397 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17398 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17399 return (uint32_t)ret_conv;
17402 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
17403 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
17404 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17408 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
17409 if ((_res & 1) != 0) return;
17410 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17411 CHECK_ACCESS(_res_ptr);
17412 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17414 CResult_InvoiceSemanticErrorZ_free(_res_conv);
17417 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17418 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17419 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17420 return (uint32_t)ret_conv;
17422 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
17423 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
17424 uint32_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17428 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
17429 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
17430 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17431 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17432 return (uint32_t)ret_conv;
17435 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
17436 LDKDescription o_conv;
17437 o_conv.inner = (void*)(o & (~1));
17438 o_conv.is_owned = (o & 1) || (o == 0);
17439 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17440 o_conv = Description_clone(&o_conv);
17441 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17442 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17443 return (uint32_t)ret_conv;
17446 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
17447 LDKCreationError e_conv = LDKCreationError_from_js(e);
17448 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17449 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17450 return (uint32_t)ret_conv;
17453 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
17454 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
17455 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17459 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
17460 if ((_res & 1) != 0) return;
17461 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17462 CHECK_ACCESS(_res_ptr);
17463 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17465 CResult_DescriptionCreationErrorZ_free(_res_conv);
17468 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17469 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17470 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17471 return (uint32_t)ret_conv;
17473 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
17474 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
17475 uint32_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17479 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
17480 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
17481 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17482 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17483 return (uint32_t)ret_conv;
17486 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
17487 LDKPrivateRoute o_conv;
17488 o_conv.inner = (void*)(o & (~1));
17489 o_conv.is_owned = (o & 1) || (o == 0);
17490 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17491 o_conv = PrivateRoute_clone(&o_conv);
17492 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17493 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17494 return (uint32_t)ret_conv;
17497 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
17498 LDKCreationError e_conv = LDKCreationError_from_js(e);
17499 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17500 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17501 return (uint32_t)ret_conv;
17504 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
17505 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
17506 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17510 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
17511 if ((_res & 1) != 0) return;
17512 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17513 CHECK_ACCESS(_res_ptr);
17514 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17516 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17519 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17520 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17521 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17522 return (uint32_t)ret_conv;
17524 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
17525 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
17526 uint32_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17530 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
17531 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
17532 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17533 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17534 return (uint32_t)ret_conv;
17537 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17538 LDKStr o_conv = str_ref_to_owned_c(o);
17539 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17540 *ret_conv = CResult_StringErrorZ_ok(o_conv);
17541 return (uint32_t)ret_conv;
17544 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17545 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17546 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17547 *ret_conv = CResult_StringErrorZ_err(e_conv);
17548 return (uint32_t)ret_conv;
17551 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
17552 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
17553 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17557 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
17558 if ((_res & 1) != 0) return;
17559 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17560 CHECK_ACCESS(_res_ptr);
17561 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17563 CResult_StringErrorZ_free(_res_conv);
17566 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17567 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17568 *ret_conv = CResult_StringErrorZ_clone(arg);
17569 return (uint32_t)ret_conv;
17571 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint32_t arg) {
17572 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
17573 uint32_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17577 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint32_t orig) {
17578 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
17579 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17580 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17581 return (uint32_t)ret_conv;
17584 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
17585 LDKChannelMonitorUpdate o_conv;
17586 o_conv.inner = (void*)(o & (~1));
17587 o_conv.is_owned = (o & 1) || (o == 0);
17588 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17589 o_conv = ChannelMonitorUpdate_clone(&o_conv);
17590 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17591 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17592 return (uint32_t)ret_conv;
17595 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
17596 LDKDecodeError e_conv;
17597 e_conv.inner = (void*)(e & (~1));
17598 e_conv.is_owned = (e & 1) || (e == 0);
17599 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17600 e_conv = DecodeError_clone(&e_conv);
17601 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17602 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17603 return (uint32_t)ret_conv;
17606 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
17607 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
17608 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17612 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
17613 if ((_res & 1) != 0) return;
17614 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17615 CHECK_ACCESS(_res_ptr);
17616 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17618 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17621 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17622 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17623 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17624 return (uint32_t)ret_conv;
17626 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
17627 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
17628 uint32_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17632 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
17633 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
17634 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17635 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17636 return (uint32_t)ret_conv;
17639 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
17640 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17641 CHECK_ACCESS(o_ptr);
17642 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17643 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
17644 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17645 *ret_copy = COption_MonitorEventZ_some(o_conv);
17646 uint32_t ret_ref = (uintptr_t)ret_copy;
17650 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17651 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17652 *ret_copy = COption_MonitorEventZ_none();
17653 uint32_t ret_ref = (uintptr_t)ret_copy;
17657 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
17658 if ((_res & 1) != 0) return;
17659 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17660 CHECK_ACCESS(_res_ptr);
17661 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17663 COption_MonitorEventZ_free(_res_conv);
17666 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17667 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17668 *ret_copy = COption_MonitorEventZ_clone(arg);
17669 uint32_t ret_ref = (uintptr_t)ret_copy;
17672 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
17673 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
17674 uint32_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17678 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
17679 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
17680 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17681 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17682 uint32_t ret_ref = (uintptr_t)ret_copy;
17686 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
17687 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17688 CHECK_ACCESS(o_ptr);
17689 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17690 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
17691 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17692 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17693 return (uint32_t)ret_conv;
17696 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
17697 LDKDecodeError e_conv;
17698 e_conv.inner = (void*)(e & (~1));
17699 e_conv.is_owned = (e & 1) || (e == 0);
17700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17701 e_conv = DecodeError_clone(&e_conv);
17702 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17703 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17704 return (uint32_t)ret_conv;
17707 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
17708 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
17709 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17713 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
17714 if ((_res & 1) != 0) return;
17715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17716 CHECK_ACCESS(_res_ptr);
17717 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17719 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17722 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17723 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17724 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17725 return (uint32_t)ret_conv;
17727 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
17728 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
17729 uint32_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17733 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
17734 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
17735 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17736 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17737 return (uint32_t)ret_conv;
17740 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
17741 LDKHTLCUpdate o_conv;
17742 o_conv.inner = (void*)(o & (~1));
17743 o_conv.is_owned = (o & 1) || (o == 0);
17744 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17745 o_conv = HTLCUpdate_clone(&o_conv);
17746 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17747 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17748 return (uint32_t)ret_conv;
17751 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
17752 LDKDecodeError e_conv;
17753 e_conv.inner = (void*)(e & (~1));
17754 e_conv.is_owned = (e & 1) || (e == 0);
17755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17756 e_conv = DecodeError_clone(&e_conv);
17757 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17758 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17759 return (uint32_t)ret_conv;
17762 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
17763 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
17764 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17768 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
17769 if ((_res & 1) != 0) return;
17770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17771 CHECK_ACCESS(_res_ptr);
17772 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17774 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17777 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17778 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17779 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17780 return (uint32_t)ret_conv;
17782 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
17783 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
17784 uint32_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17788 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
17789 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
17790 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17791 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17792 return (uint32_t)ret_conv;
17795 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17796 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17797 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17798 return ((uint32_t)ret_conv);
17800 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
17801 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
17802 uint32_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17806 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
17807 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
17808 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17809 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17810 return ((uint32_t)ret_conv);
17813 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
17814 LDKOutPoint a_conv;
17815 a_conv.inner = (void*)(a & (~1));
17816 a_conv.is_owned = (a & 1) || (a == 0);
17817 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17818 a_conv = OutPoint_clone(&a_conv);
17820 b_ref.datalen = b->arr_len;
17821 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17822 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17823 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17824 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17825 return ((uint32_t)ret_conv);
17828 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
17829 if ((_res & 1) != 0) return;
17830 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17831 CHECK_ACCESS(_res_ptr);
17832 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17834 C2Tuple_OutPointScriptZ_free(_res_conv);
17837 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17838 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17839 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17840 return ((uint32_t)ret_conv);
17842 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
17843 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
17844 uint32_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17848 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
17849 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
17850 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17851 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17852 return ((uint32_t)ret_conv);
17855 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17857 b_ref.datalen = b->arr_len;
17858 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17859 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17860 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17861 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17862 return ((uint32_t)ret_conv);
17865 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
17866 if ((_res & 1) != 0) return;
17867 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17868 CHECK_ACCESS(_res_ptr);
17869 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17871 C2Tuple_u32ScriptZ_free(_res_conv);
17874 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
17875 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17876 _res_constr.datalen = _res->arr_len;
17877 if (_res_constr.datalen > 0)
17878 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17880 _res_constr.data = NULL;
17881 uint32_t* _res_vals = _res->elems;
17882 for (size_t v = 0; v < _res_constr.datalen; v++) {
17883 uint32_t _res_conv_21 = _res_vals[v];
17884 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
17885 CHECK_ACCESS(_res_conv_21_ptr);
17886 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17887 FREE((void*)_res_conv_21);
17888 _res_constr.data[v] = _res_conv_21_conv;
17891 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17894 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17895 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17896 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17897 return ((uint32_t)ret_conv);
17899 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
17900 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
17901 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17905 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
17906 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
17907 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17908 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17909 return ((uint32_t)ret_conv);
17912 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
17913 LDKThirtyTwoBytes a_ref;
17914 CHECK(a->arr_len == 32);
17915 memcpy(a_ref.data, a->elems, 32); FREE(a);
17916 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17917 b_constr.datalen = b->arr_len;
17918 if (b_constr.datalen > 0)
17919 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17921 b_constr.data = NULL;
17922 uint32_t* b_vals = b->elems;
17923 for (size_t v = 0; v < b_constr.datalen; v++) {
17924 uint32_t b_conv_21 = b_vals[v];
17925 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
17926 CHECK_ACCESS(b_conv_21_ptr);
17927 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17928 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
17929 b_constr.data[v] = b_conv_21_conv;
17932 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17933 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17934 return ((uint32_t)ret_conv);
17937 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
17938 if ((_res & 1) != 0) return;
17939 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17940 CHECK_ACCESS(_res_ptr);
17941 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17943 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17946 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
17947 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17948 _res_constr.datalen = _res->arr_len;
17949 if (_res_constr.datalen > 0)
17950 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17952 _res_constr.data = NULL;
17953 uint32_t* _res_vals = _res->elems;
17954 for (size_t o = 0; o < _res_constr.datalen; o++) {
17955 uint32_t _res_conv_40 = _res_vals[o];
17956 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
17957 CHECK_ACCESS(_res_conv_40_ptr);
17958 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17959 FREE((void*)_res_conv_40);
17960 _res_constr.data[o] = _res_conv_40_conv;
17963 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17966 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
17967 LDKCVec_EventZ _res_constr;
17968 _res_constr.datalen = _res->arr_len;
17969 if (_res_constr.datalen > 0)
17970 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17972 _res_constr.data = NULL;
17973 uint32_t* _res_vals = _res->elems;
17974 for (size_t h = 0; h < _res_constr.datalen; h++) {
17975 uint32_t _res_conv_7 = _res_vals[h];
17976 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17977 CHECK_ACCESS(_res_conv_7_ptr);
17978 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17979 FREE((void*)_res_conv_7);
17980 _res_constr.data[h] = _res_conv_7_conv;
17983 CVec_EventZ_free(_res_constr);
17986 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17987 LDKCVec_TransactionZ _res_constr;
17988 _res_constr.datalen = _res->arr_len;
17989 if (_res_constr.datalen > 0)
17990 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17992 _res_constr.data = NULL;
17993 int8_tArray* _res_vals = (void*) _res->elems;
17994 for (size_t m = 0; m < _res_constr.datalen; m++) {
17995 int8_tArray _res_conv_12 = _res_vals[m];
17996 LDKTransaction _res_conv_12_ref;
17997 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17998 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17999 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18000 _res_conv_12_ref.data_is_owned = true;
18001 _res_constr.data[m] = _res_conv_12_ref;
18004 CVec_TransactionZ_free(_res_constr);
18007 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18008 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18009 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18010 return ((uint32_t)ret_conv);
18012 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
18013 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
18014 uint32_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18018 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
18019 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
18020 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18021 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18022 return ((uint32_t)ret_conv);
18025 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
18026 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
18027 CHECK_ACCESS(b_ptr);
18028 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18029 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
18030 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18031 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18032 return ((uint32_t)ret_conv);
18035 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
18036 if ((_res & 1) != 0) return;
18037 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18038 CHECK_ACCESS(_res_ptr);
18039 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18041 C2Tuple_u32TxOutZ_free(_res_conv);
18044 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
18045 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18046 _res_constr.datalen = _res->arr_len;
18047 if (_res_constr.datalen > 0)
18048 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18050 _res_constr.data = NULL;
18051 uint32_t* _res_vals = _res->elems;
18052 for (size_t u = 0; u < _res_constr.datalen; u++) {
18053 uint32_t _res_conv_20 = _res_vals[u];
18054 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
18055 CHECK_ACCESS(_res_conv_20_ptr);
18056 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18057 FREE((void*)_res_conv_20);
18058 _res_constr.data[u] = _res_conv_20_conv;
18061 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18064 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18065 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18066 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18067 return ((uint32_t)ret_conv);
18069 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
18070 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
18071 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18075 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
18076 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
18077 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18078 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18079 return ((uint32_t)ret_conv);
18082 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
18083 LDKThirtyTwoBytes a_ref;
18084 CHECK(a->arr_len == 32);
18085 memcpy(a_ref.data, a->elems, 32); FREE(a);
18086 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18087 b_constr.datalen = b->arr_len;
18088 if (b_constr.datalen > 0)
18089 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18091 b_constr.data = NULL;
18092 uint32_t* b_vals = b->elems;
18093 for (size_t u = 0; u < b_constr.datalen; u++) {
18094 uint32_t b_conv_20 = b_vals[u];
18095 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
18096 CHECK_ACCESS(b_conv_20_ptr);
18097 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18098 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
18099 b_constr.data[u] = b_conv_20_conv;
18102 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18103 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18104 return ((uint32_t)ret_conv);
18107 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
18108 if ((_res & 1) != 0) return;
18109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18110 CHECK_ACCESS(_res_ptr);
18111 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18113 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18116 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
18117 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18118 _res_constr.datalen = _res->arr_len;
18119 if (_res_constr.datalen > 0)
18120 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18122 _res_constr.data = NULL;
18123 uint32_t* _res_vals = _res->elems;
18124 for (size_t n = 0; n < _res_constr.datalen; n++) {
18125 uint32_t _res_conv_39 = _res_vals[n];
18126 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
18127 CHECK_ACCESS(_res_conv_39_ptr);
18128 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18129 FREE((void*)_res_conv_39);
18130 _res_constr.data[n] = _res_conv_39_conv;
18133 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18136 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
18137 LDKCVec_BalanceZ _res_constr;
18138 _res_constr.datalen = _res->arr_len;
18139 if (_res_constr.datalen > 0)
18140 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18142 _res_constr.data = NULL;
18143 uint32_t* _res_vals = _res->elems;
18144 for (size_t j = 0; j < _res_constr.datalen; j++) {
18145 uint32_t _res_conv_9 = _res_vals[j];
18146 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
18147 CHECK_ACCESS(_res_conv_9_ptr);
18148 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18149 FREE((void*)_res_conv_9);
18150 _res_constr.data[j] = _res_conv_9_conv;
18153 CVec_BalanceZ_free(_res_constr);
18156 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18157 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18158 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18159 return ((uint32_t)ret_conv);
18161 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
18162 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
18163 uint32_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18167 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
18168 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
18169 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18170 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18171 return ((uint32_t)ret_conv);
18174 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
18175 LDKThirtyTwoBytes a_ref;
18176 CHECK(a->arr_len == 32);
18177 memcpy(a_ref.data, a->elems, 32); FREE(a);
18178 LDKChannelMonitor b_conv;
18179 b_conv.inner = (void*)(b & (~1));
18180 b_conv.is_owned = (b & 1) || (b == 0);
18181 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18182 b_conv = ChannelMonitor_clone(&b_conv);
18183 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18184 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18185 return ((uint32_t)ret_conv);
18188 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
18189 if ((_res & 1) != 0) return;
18190 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18191 CHECK_ACCESS(_res_ptr);
18192 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18194 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18197 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
18198 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18199 CHECK_ACCESS(o_ptr);
18200 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18201 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
18202 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18203 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18204 return (uint32_t)ret_conv;
18207 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
18208 LDKDecodeError e_conv;
18209 e_conv.inner = (void*)(e & (~1));
18210 e_conv.is_owned = (e & 1) || (e == 0);
18211 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18212 e_conv = DecodeError_clone(&e_conv);
18213 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18214 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18215 return (uint32_t)ret_conv;
18218 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
18219 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
18220 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18224 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
18225 if ((_res & 1) != 0) return;
18226 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18227 CHECK_ACCESS(_res_ptr);
18228 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18230 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18233 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18234 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18235 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18236 return (uint32_t)ret_conv;
18238 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
18239 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
18240 uint32_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18244 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
18245 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
18246 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18247 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18248 return (uint32_t)ret_conv;
18251 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18252 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18253 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18254 return ((uint32_t)ret_conv);
18256 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
18257 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
18258 uint32_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18262 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
18263 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
18264 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18265 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18266 return ((uint32_t)ret_conv);
18269 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
18270 LDKPublicKey a_ref;
18271 CHECK(a->arr_len == 33);
18272 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18273 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
18274 CHECK_ACCESS(b_ptr);
18275 LDKType b_conv = *(LDKType*)(b_ptr);
18276 if (b_conv.free == LDKType_JCalls_free) {
18277 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18278 LDKType_JCalls_cloned(&b_conv);
18280 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18281 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18282 return ((uint32_t)ret_conv);
18285 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
18286 if ((_res & 1) != 0) return;
18287 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18288 CHECK_ACCESS(_res_ptr);
18289 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18291 C2Tuple_PublicKeyTypeZ_free(_res_conv);
18294 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
18295 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18296 _res_constr.datalen = _res->arr_len;
18297 if (_res_constr.datalen > 0)
18298 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18300 _res_constr.data = NULL;
18301 uint32_t* _res_vals = _res->elems;
18302 for (size_t z = 0; z < _res_constr.datalen; z++) {
18303 uint32_t _res_conv_25 = _res_vals[z];
18304 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
18305 CHECK_ACCESS(_res_conv_25_ptr);
18306 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18307 FREE((void*)_res_conv_25);
18308 _res_constr.data[z] = _res_conv_25_conv;
18311 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18314 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint32_t o) {
18315 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18316 CHECK_ACCESS(o_ptr);
18317 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18318 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
18319 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18320 *ret_copy = COption_NetAddressZ_some(o_conv);
18321 uint32_t ret_ref = (uintptr_t)ret_copy;
18325 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18326 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18327 *ret_copy = COption_NetAddressZ_none();
18328 uint32_t ret_ref = (uintptr_t)ret_copy;
18332 void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint32_t _res) {
18333 if ((_res & 1) != 0) return;
18334 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18335 CHECK_ACCESS(_res_ptr);
18336 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18338 COption_NetAddressZ_free(_res_conv);
18341 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18342 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18343 *ret_copy = COption_NetAddressZ_clone(arg);
18344 uint32_t ret_ref = (uintptr_t)ret_copy;
18347 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint32_t arg) {
18348 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
18349 uint32_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18353 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint32_t orig) {
18354 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
18355 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18356 *ret_copy = COption_NetAddressZ_clone(orig_conv);
18357 uint32_t ret_ref = (uintptr_t)ret_copy;
18361 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18363 o_ref.datalen = o->arr_len;
18364 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18365 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18366 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18367 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18368 return (uint32_t)ret_conv;
18371 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
18372 LDKPeerHandleError e_conv;
18373 e_conv.inner = (void*)(e & (~1));
18374 e_conv.is_owned = (e & 1) || (e == 0);
18375 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18376 e_conv = PeerHandleError_clone(&e_conv);
18377 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18378 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18379 return (uint32_t)ret_conv;
18382 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
18383 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
18384 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18388 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
18389 if ((_res & 1) != 0) return;
18390 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18391 CHECK_ACCESS(_res_ptr);
18392 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18394 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18397 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18398 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18399 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18400 return (uint32_t)ret_conv;
18402 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
18403 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
18404 uint32_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18408 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
18409 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
18410 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18411 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18412 return (uint32_t)ret_conv;
18415 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18416 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18417 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18418 return (uint32_t)ret_conv;
18421 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
18422 LDKPeerHandleError e_conv;
18423 e_conv.inner = (void*)(e & (~1));
18424 e_conv.is_owned = (e & 1) || (e == 0);
18425 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18426 e_conv = PeerHandleError_clone(&e_conv);
18427 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18428 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18429 return (uint32_t)ret_conv;
18432 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
18433 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
18434 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18438 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
18439 if ((_res & 1) != 0) return;
18440 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18441 CHECK_ACCESS(_res_ptr);
18442 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18444 CResult_NonePeerHandleErrorZ_free(_res_conv);
18447 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18448 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18449 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18450 return (uint32_t)ret_conv;
18452 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
18453 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
18454 uint32_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18458 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
18459 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
18460 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18461 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18462 return (uint32_t)ret_conv;
18465 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18466 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18467 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18468 return (uint32_t)ret_conv;
18471 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
18472 LDKPeerHandleError e_conv;
18473 e_conv.inner = (void*)(e & (~1));
18474 e_conv.is_owned = (e & 1) || (e == 0);
18475 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18476 e_conv = PeerHandleError_clone(&e_conv);
18477 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18478 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18479 return (uint32_t)ret_conv;
18482 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
18483 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
18484 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18488 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
18489 if ((_res & 1) != 0) return;
18490 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18491 CHECK_ACCESS(_res_ptr);
18492 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18494 CResult_boolPeerHandleErrorZ_free(_res_conv);
18497 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18498 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18499 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18500 return (uint32_t)ret_conv;
18502 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
18503 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
18504 uint32_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18508 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
18509 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
18510 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18511 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18512 return (uint32_t)ret_conv;
18515 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
18516 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18517 *ret_conv = CResult_NoneErrorZ_ok();
18518 return (uint32_t)ret_conv;
18521 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
18522 LDKIOError e_conv = LDKIOError_from_js(e);
18523 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18524 *ret_conv = CResult_NoneErrorZ_err(e_conv);
18525 return (uint32_t)ret_conv;
18528 jboolean __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
18529 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
18530 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
18534 void __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
18535 if ((_res & 1) != 0) return;
18536 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18537 CHECK_ACCESS(_res_ptr);
18538 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
18540 CResult_NoneErrorZ_free(_res_conv);
18543 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
18544 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18545 *ret_conv = CResult_NoneErrorZ_clone(arg);
18546 return (uint32_t)ret_conv;
18548 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
18549 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
18550 uint32_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
18554 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
18555 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
18556 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18557 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
18558 return (uint32_t)ret_conv;
18561 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
18562 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18563 CHECK_ACCESS(o_ptr);
18564 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18565 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
18566 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18567 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
18568 return (uint32_t)ret_conv;
18571 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
18572 LDKDecodeError e_conv;
18573 e_conv.inner = (void*)(e & (~1));
18574 e_conv.is_owned = (e & 1) || (e == 0);
18575 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18576 e_conv = DecodeError_clone(&e_conv);
18577 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18578 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
18579 return (uint32_t)ret_conv;
18582 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
18583 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
18584 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
18588 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
18589 if ((_res & 1) != 0) return;
18590 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18591 CHECK_ACCESS(_res_ptr);
18592 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
18594 CResult_NetAddressDecodeErrorZ_free(_res_conv);
18597 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
18598 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18599 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
18600 return (uint32_t)ret_conv;
18602 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
18603 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
18604 uint32_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
18608 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
18609 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
18610 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18611 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
18612 return (uint32_t)ret_conv;
18615 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
18616 LDKCVec_UpdateAddHTLCZ _res_constr;
18617 _res_constr.datalen = _res->arr_len;
18618 if (_res_constr.datalen > 0)
18619 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18621 _res_constr.data = NULL;
18622 uint32_t* _res_vals = _res->elems;
18623 for (size_t p = 0; p < _res_constr.datalen; p++) {
18624 uint32_t _res_conv_15 = _res_vals[p];
18625 LDKUpdateAddHTLC _res_conv_15_conv;
18626 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
18627 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
18628 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
18629 _res_constr.data[p] = _res_conv_15_conv;
18632 CVec_UpdateAddHTLCZ_free(_res_constr);
18635 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
18636 LDKCVec_UpdateFulfillHTLCZ _res_constr;
18637 _res_constr.datalen = _res->arr_len;
18638 if (_res_constr.datalen > 0)
18639 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18641 _res_constr.data = NULL;
18642 uint32_t* _res_vals = _res->elems;
18643 for (size_t t = 0; t < _res_constr.datalen; t++) {
18644 uint32_t _res_conv_19 = _res_vals[t];
18645 LDKUpdateFulfillHTLC _res_conv_19_conv;
18646 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
18647 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
18648 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
18649 _res_constr.data[t] = _res_conv_19_conv;
18652 CVec_UpdateFulfillHTLCZ_free(_res_constr);
18655 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
18656 LDKCVec_UpdateFailHTLCZ _res_constr;
18657 _res_constr.datalen = _res->arr_len;
18658 if (_res_constr.datalen > 0)
18659 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18661 _res_constr.data = NULL;
18662 uint32_t* _res_vals = _res->elems;
18663 for (size_t q = 0; q < _res_constr.datalen; q++) {
18664 uint32_t _res_conv_16 = _res_vals[q];
18665 LDKUpdateFailHTLC _res_conv_16_conv;
18666 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18667 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18668 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18669 _res_constr.data[q] = _res_conv_16_conv;
18672 CVec_UpdateFailHTLCZ_free(_res_constr);
18675 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
18676 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18677 _res_constr.datalen = _res->arr_len;
18678 if (_res_constr.datalen > 0)
18679 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18681 _res_constr.data = NULL;
18682 uint32_t* _res_vals = _res->elems;
18683 for (size_t z = 0; z < _res_constr.datalen; z++) {
18684 uint32_t _res_conv_25 = _res_vals[z];
18685 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18686 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
18687 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
18688 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18689 _res_constr.data[z] = _res_conv_25_conv;
18692 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18695 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
18696 LDKAcceptChannel o_conv;
18697 o_conv.inner = (void*)(o & (~1));
18698 o_conv.is_owned = (o & 1) || (o == 0);
18699 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18700 o_conv = AcceptChannel_clone(&o_conv);
18701 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18702 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18703 return (uint32_t)ret_conv;
18706 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
18707 LDKDecodeError e_conv;
18708 e_conv.inner = (void*)(e & (~1));
18709 e_conv.is_owned = (e & 1) || (e == 0);
18710 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18711 e_conv = DecodeError_clone(&e_conv);
18712 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18713 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18714 return (uint32_t)ret_conv;
18717 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
18718 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
18719 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18723 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
18724 if ((_res & 1) != 0) return;
18725 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18726 CHECK_ACCESS(_res_ptr);
18727 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18729 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18732 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18733 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18734 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18735 return (uint32_t)ret_conv;
18737 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18738 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
18739 uint32_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18743 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
18744 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
18745 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18746 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18747 return (uint32_t)ret_conv;
18750 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
18751 LDKAnnouncementSignatures o_conv;
18752 o_conv.inner = (void*)(o & (~1));
18753 o_conv.is_owned = (o & 1) || (o == 0);
18754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18755 o_conv = AnnouncementSignatures_clone(&o_conv);
18756 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18757 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18758 return (uint32_t)ret_conv;
18761 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
18762 LDKDecodeError e_conv;
18763 e_conv.inner = (void*)(e & (~1));
18764 e_conv.is_owned = (e & 1) || (e == 0);
18765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18766 e_conv = DecodeError_clone(&e_conv);
18767 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18768 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18769 return (uint32_t)ret_conv;
18772 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
18773 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
18774 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18778 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
18779 if ((_res & 1) != 0) return;
18780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18781 CHECK_ACCESS(_res_ptr);
18782 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18784 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18787 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18788 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18789 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18790 return (uint32_t)ret_conv;
18792 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
18793 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
18794 uint32_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18798 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
18799 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
18800 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18801 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18802 return (uint32_t)ret_conv;
18805 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
18806 LDKChannelReestablish o_conv;
18807 o_conv.inner = (void*)(o & (~1));
18808 o_conv.is_owned = (o & 1) || (o == 0);
18809 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18810 o_conv = ChannelReestablish_clone(&o_conv);
18811 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18812 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18813 return (uint32_t)ret_conv;
18816 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
18817 LDKDecodeError e_conv;
18818 e_conv.inner = (void*)(e & (~1));
18819 e_conv.is_owned = (e & 1) || (e == 0);
18820 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18821 e_conv = DecodeError_clone(&e_conv);
18822 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18823 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18824 return (uint32_t)ret_conv;
18827 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
18828 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
18829 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18833 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
18834 if ((_res & 1) != 0) return;
18835 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18836 CHECK_ACCESS(_res_ptr);
18837 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18839 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18842 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18843 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18844 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18845 return (uint32_t)ret_conv;
18847 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
18848 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
18849 uint32_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18853 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
18854 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
18855 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18856 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18857 return (uint32_t)ret_conv;
18860 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
18861 LDKClosingSigned o_conv;
18862 o_conv.inner = (void*)(o & (~1));
18863 o_conv.is_owned = (o & 1) || (o == 0);
18864 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18865 o_conv = ClosingSigned_clone(&o_conv);
18866 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18867 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18868 return (uint32_t)ret_conv;
18871 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
18872 LDKDecodeError e_conv;
18873 e_conv.inner = (void*)(e & (~1));
18874 e_conv.is_owned = (e & 1) || (e == 0);
18875 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18876 e_conv = DecodeError_clone(&e_conv);
18877 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18878 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18879 return (uint32_t)ret_conv;
18882 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
18883 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
18884 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18888 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
18889 if ((_res & 1) != 0) return;
18890 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18891 CHECK_ACCESS(_res_ptr);
18892 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18894 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18897 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18898 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18899 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18900 return (uint32_t)ret_conv;
18902 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18903 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
18904 uint32_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18908 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
18909 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
18910 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18911 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18912 return (uint32_t)ret_conv;
18915 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
18916 LDKClosingSignedFeeRange o_conv;
18917 o_conv.inner = (void*)(o & (~1));
18918 o_conv.is_owned = (o & 1) || (o == 0);
18919 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18920 o_conv = ClosingSignedFeeRange_clone(&o_conv);
18921 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18922 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18923 return (uint32_t)ret_conv;
18926 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
18927 LDKDecodeError e_conv;
18928 e_conv.inner = (void*)(e & (~1));
18929 e_conv.is_owned = (e & 1) || (e == 0);
18930 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18931 e_conv = DecodeError_clone(&e_conv);
18932 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18933 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18934 return (uint32_t)ret_conv;
18937 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
18938 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
18939 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18943 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
18944 if ((_res & 1) != 0) return;
18945 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18946 CHECK_ACCESS(_res_ptr);
18947 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
18949 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
18952 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
18953 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18954 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
18955 return (uint32_t)ret_conv;
18957 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18958 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
18959 uint32_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
18963 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
18964 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
18965 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18966 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
18967 return (uint32_t)ret_conv;
18970 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
18971 LDKCommitmentSigned o_conv;
18972 o_conv.inner = (void*)(o & (~1));
18973 o_conv.is_owned = (o & 1) || (o == 0);
18974 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18975 o_conv = CommitmentSigned_clone(&o_conv);
18976 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18977 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
18978 return (uint32_t)ret_conv;
18981 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
18982 LDKDecodeError e_conv;
18983 e_conv.inner = (void*)(e & (~1));
18984 e_conv.is_owned = (e & 1) || (e == 0);
18985 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18986 e_conv = DecodeError_clone(&e_conv);
18987 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18988 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
18989 return (uint32_t)ret_conv;
18992 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
18993 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
18994 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
18998 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
18999 if ((_res & 1) != 0) return;
19000 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19001 CHECK_ACCESS(_res_ptr);
19002 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19004 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19007 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19008 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19009 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19010 return (uint32_t)ret_conv;
19012 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
19013 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
19014 uint32_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19018 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
19019 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
19020 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19021 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19022 return (uint32_t)ret_conv;
19025 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
19026 LDKFundingCreated o_conv;
19027 o_conv.inner = (void*)(o & (~1));
19028 o_conv.is_owned = (o & 1) || (o == 0);
19029 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19030 o_conv = FundingCreated_clone(&o_conv);
19031 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19032 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19033 return (uint32_t)ret_conv;
19036 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
19037 LDKDecodeError e_conv;
19038 e_conv.inner = (void*)(e & (~1));
19039 e_conv.is_owned = (e & 1) || (e == 0);
19040 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19041 e_conv = DecodeError_clone(&e_conv);
19042 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19043 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19044 return (uint32_t)ret_conv;
19047 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
19048 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
19049 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19053 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
19054 if ((_res & 1) != 0) return;
19055 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19056 CHECK_ACCESS(_res_ptr);
19057 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19059 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19062 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19063 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19064 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19065 return (uint32_t)ret_conv;
19067 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
19068 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
19069 uint32_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19073 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
19074 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
19075 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19076 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19077 return (uint32_t)ret_conv;
19080 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
19081 LDKFundingSigned o_conv;
19082 o_conv.inner = (void*)(o & (~1));
19083 o_conv.is_owned = (o & 1) || (o == 0);
19084 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19085 o_conv = FundingSigned_clone(&o_conv);
19086 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19087 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19088 return (uint32_t)ret_conv;
19091 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
19092 LDKDecodeError e_conv;
19093 e_conv.inner = (void*)(e & (~1));
19094 e_conv.is_owned = (e & 1) || (e == 0);
19095 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19096 e_conv = DecodeError_clone(&e_conv);
19097 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19098 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19099 return (uint32_t)ret_conv;
19102 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
19103 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
19104 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19108 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
19109 if ((_res & 1) != 0) return;
19110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19111 CHECK_ACCESS(_res_ptr);
19112 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19114 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19117 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19118 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19119 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19120 return (uint32_t)ret_conv;
19122 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
19123 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
19124 uint32_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19128 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
19129 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
19130 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19131 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19132 return (uint32_t)ret_conv;
19135 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint32_t o) {
19136 LDKChannelReady o_conv;
19137 o_conv.inner = (void*)(o & (~1));
19138 o_conv.is_owned = (o & 1) || (o == 0);
19139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19140 o_conv = ChannelReady_clone(&o_conv);
19141 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19142 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19143 return (uint32_t)ret_conv;
19146 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint32_t e) {
19147 LDKDecodeError e_conv;
19148 e_conv.inner = (void*)(e & (~1));
19149 e_conv.is_owned = (e & 1) || (e == 0);
19150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19151 e_conv = DecodeError_clone(&e_conv);
19152 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19153 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19154 return (uint32_t)ret_conv;
19157 jboolean __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint32_t o) {
19158 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
19159 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19163 void __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint32_t _res) {
19164 if ((_res & 1) != 0) return;
19165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19166 CHECK_ACCESS(_res_ptr);
19167 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
19169 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
19172 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
19173 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19174 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
19175 return (uint32_t)ret_conv;
19177 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint32_t arg) {
19178 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
19179 uint32_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
19183 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint32_t orig) {
19184 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
19185 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19186 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
19187 return (uint32_t)ret_conv;
19190 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
19192 o_conv.inner = (void*)(o & (~1));
19193 o_conv.is_owned = (o & 1) || (o == 0);
19194 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19195 o_conv = Init_clone(&o_conv);
19196 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19197 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
19198 return (uint32_t)ret_conv;
19201 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
19202 LDKDecodeError e_conv;
19203 e_conv.inner = (void*)(e & (~1));
19204 e_conv.is_owned = (e & 1) || (e == 0);
19205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19206 e_conv = DecodeError_clone(&e_conv);
19207 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19208 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
19209 return (uint32_t)ret_conv;
19212 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
19213 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
19214 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
19218 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
19219 if ((_res & 1) != 0) return;
19220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19221 CHECK_ACCESS(_res_ptr);
19222 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
19224 CResult_InitDecodeErrorZ_free(_res_conv);
19227 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
19228 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19229 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
19230 return (uint32_t)ret_conv;
19232 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
19233 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
19234 uint32_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
19238 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
19239 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
19240 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19241 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
19242 return (uint32_t)ret_conv;
19245 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
19246 LDKOpenChannel o_conv;
19247 o_conv.inner = (void*)(o & (~1));
19248 o_conv.is_owned = (o & 1) || (o == 0);
19249 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19250 o_conv = OpenChannel_clone(&o_conv);
19251 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19252 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
19253 return (uint32_t)ret_conv;
19256 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
19257 LDKDecodeError e_conv;
19258 e_conv.inner = (void*)(e & (~1));
19259 e_conv.is_owned = (e & 1) || (e == 0);
19260 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19261 e_conv = DecodeError_clone(&e_conv);
19262 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19263 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
19264 return (uint32_t)ret_conv;
19267 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
19268 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
19269 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
19273 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
19274 if ((_res & 1) != 0) return;
19275 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19276 CHECK_ACCESS(_res_ptr);
19277 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
19279 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
19282 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
19283 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19284 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
19285 return (uint32_t)ret_conv;
19287 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
19288 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
19289 uint32_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
19293 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
19294 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
19295 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19296 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
19297 return (uint32_t)ret_conv;
19300 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
19301 LDKRevokeAndACK o_conv;
19302 o_conv.inner = (void*)(o & (~1));
19303 o_conv.is_owned = (o & 1) || (o == 0);
19304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19305 o_conv = RevokeAndACK_clone(&o_conv);
19306 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19307 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
19308 return (uint32_t)ret_conv;
19311 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
19312 LDKDecodeError e_conv;
19313 e_conv.inner = (void*)(e & (~1));
19314 e_conv.is_owned = (e & 1) || (e == 0);
19315 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19316 e_conv = DecodeError_clone(&e_conv);
19317 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19318 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
19319 return (uint32_t)ret_conv;
19322 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
19323 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
19324 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
19328 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
19329 if ((_res & 1) != 0) return;
19330 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19331 CHECK_ACCESS(_res_ptr);
19332 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
19334 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
19337 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
19338 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19339 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
19340 return (uint32_t)ret_conv;
19342 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
19343 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
19344 uint32_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
19348 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
19349 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
19350 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19351 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
19352 return (uint32_t)ret_conv;
19355 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
19356 LDKShutdown o_conv;
19357 o_conv.inner = (void*)(o & (~1));
19358 o_conv.is_owned = (o & 1) || (o == 0);
19359 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19360 o_conv = Shutdown_clone(&o_conv);
19361 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19362 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
19363 return (uint32_t)ret_conv;
19366 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
19367 LDKDecodeError e_conv;
19368 e_conv.inner = (void*)(e & (~1));
19369 e_conv.is_owned = (e & 1) || (e == 0);
19370 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19371 e_conv = DecodeError_clone(&e_conv);
19372 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19373 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
19374 return (uint32_t)ret_conv;
19377 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
19378 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
19379 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
19383 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
19384 if ((_res & 1) != 0) return;
19385 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19386 CHECK_ACCESS(_res_ptr);
19387 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
19389 CResult_ShutdownDecodeErrorZ_free(_res_conv);
19392 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
19393 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19394 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
19395 return (uint32_t)ret_conv;
19397 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
19398 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
19399 uint32_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
19403 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
19404 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
19405 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19406 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
19407 return (uint32_t)ret_conv;
19410 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
19411 LDKUpdateFailHTLC o_conv;
19412 o_conv.inner = (void*)(o & (~1));
19413 o_conv.is_owned = (o & 1) || (o == 0);
19414 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19415 o_conv = UpdateFailHTLC_clone(&o_conv);
19416 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19417 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
19418 return (uint32_t)ret_conv;
19421 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
19422 LDKDecodeError e_conv;
19423 e_conv.inner = (void*)(e & (~1));
19424 e_conv.is_owned = (e & 1) || (e == 0);
19425 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19426 e_conv = DecodeError_clone(&e_conv);
19427 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19428 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
19429 return (uint32_t)ret_conv;
19432 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
19433 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
19434 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
19438 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
19439 if ((_res & 1) != 0) return;
19440 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19441 CHECK_ACCESS(_res_ptr);
19442 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
19444 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
19447 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
19448 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19449 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
19450 return (uint32_t)ret_conv;
19452 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19453 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
19454 uint32_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
19458 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
19459 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
19460 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19461 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
19462 return (uint32_t)ret_conv;
19465 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
19466 LDKUpdateFailMalformedHTLC o_conv;
19467 o_conv.inner = (void*)(o & (~1));
19468 o_conv.is_owned = (o & 1) || (o == 0);
19469 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19470 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
19471 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19472 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
19473 return (uint32_t)ret_conv;
19476 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
19477 LDKDecodeError e_conv;
19478 e_conv.inner = (void*)(e & (~1));
19479 e_conv.is_owned = (e & 1) || (e == 0);
19480 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19481 e_conv = DecodeError_clone(&e_conv);
19482 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19483 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
19484 return (uint32_t)ret_conv;
19487 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
19488 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
19489 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
19493 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
19494 if ((_res & 1) != 0) return;
19495 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19496 CHECK_ACCESS(_res_ptr);
19497 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
19499 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
19502 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
19503 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19504 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
19505 return (uint32_t)ret_conv;
19507 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19508 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
19509 uint32_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
19513 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
19514 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
19515 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19516 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
19517 return (uint32_t)ret_conv;
19520 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
19521 LDKUpdateFee o_conv;
19522 o_conv.inner = (void*)(o & (~1));
19523 o_conv.is_owned = (o & 1) || (o == 0);
19524 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19525 o_conv = UpdateFee_clone(&o_conv);
19526 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19527 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
19528 return (uint32_t)ret_conv;
19531 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
19532 LDKDecodeError e_conv;
19533 e_conv.inner = (void*)(e & (~1));
19534 e_conv.is_owned = (e & 1) || (e == 0);
19535 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19536 e_conv = DecodeError_clone(&e_conv);
19537 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19538 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
19539 return (uint32_t)ret_conv;
19542 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
19543 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
19544 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
19548 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
19549 if ((_res & 1) != 0) return;
19550 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19551 CHECK_ACCESS(_res_ptr);
19552 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
19554 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
19557 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
19558 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19559 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
19560 return (uint32_t)ret_conv;
19562 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
19563 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
19564 uint32_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
19568 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
19569 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
19570 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19571 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
19572 return (uint32_t)ret_conv;
19575 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
19576 LDKUpdateFulfillHTLC o_conv;
19577 o_conv.inner = (void*)(o & (~1));
19578 o_conv.is_owned = (o & 1) || (o == 0);
19579 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19580 o_conv = UpdateFulfillHTLC_clone(&o_conv);
19581 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19582 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
19583 return (uint32_t)ret_conv;
19586 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
19587 LDKDecodeError e_conv;
19588 e_conv.inner = (void*)(e & (~1));
19589 e_conv.is_owned = (e & 1) || (e == 0);
19590 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19591 e_conv = DecodeError_clone(&e_conv);
19592 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19593 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
19594 return (uint32_t)ret_conv;
19597 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
19598 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
19599 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
19603 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
19604 if ((_res & 1) != 0) return;
19605 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19606 CHECK_ACCESS(_res_ptr);
19607 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
19609 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
19612 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
19613 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19614 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
19615 return (uint32_t)ret_conv;
19617 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19618 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
19619 uint32_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
19623 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
19624 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
19625 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19626 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
19627 return (uint32_t)ret_conv;
19630 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
19631 LDKUpdateAddHTLC o_conv;
19632 o_conv.inner = (void*)(o & (~1));
19633 o_conv.is_owned = (o & 1) || (o == 0);
19634 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19635 o_conv = UpdateAddHTLC_clone(&o_conv);
19636 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19637 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
19638 return (uint32_t)ret_conv;
19641 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
19642 LDKDecodeError e_conv;
19643 e_conv.inner = (void*)(e & (~1));
19644 e_conv.is_owned = (e & 1) || (e == 0);
19645 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19646 e_conv = DecodeError_clone(&e_conv);
19647 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19648 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
19649 return (uint32_t)ret_conv;
19652 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
19653 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
19654 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
19658 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
19659 if ((_res & 1) != 0) return;
19660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19661 CHECK_ACCESS(_res_ptr);
19662 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19664 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19667 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19668 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19669 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19670 return (uint32_t)ret_conv;
19672 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19673 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
19674 uint32_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19678 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
19679 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
19680 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19681 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19682 return (uint32_t)ret_conv;
19685 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
19687 o_conv.inner = (void*)(o & (~1));
19688 o_conv.is_owned = (o & 1) || (o == 0);
19689 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19690 o_conv = Ping_clone(&o_conv);
19691 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19692 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19693 return (uint32_t)ret_conv;
19696 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
19697 LDKDecodeError e_conv;
19698 e_conv.inner = (void*)(e & (~1));
19699 e_conv.is_owned = (e & 1) || (e == 0);
19700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19701 e_conv = DecodeError_clone(&e_conv);
19702 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19703 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19704 return (uint32_t)ret_conv;
19707 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
19708 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
19709 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19713 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
19714 if ((_res & 1) != 0) return;
19715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19716 CHECK_ACCESS(_res_ptr);
19717 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19719 CResult_PingDecodeErrorZ_free(_res_conv);
19722 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19723 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19724 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19725 return (uint32_t)ret_conv;
19727 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
19728 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
19729 uint32_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19733 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
19734 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
19735 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19736 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19737 return (uint32_t)ret_conv;
19740 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
19742 o_conv.inner = (void*)(o & (~1));
19743 o_conv.is_owned = (o & 1) || (o == 0);
19744 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19745 o_conv = Pong_clone(&o_conv);
19746 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19747 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19748 return (uint32_t)ret_conv;
19751 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
19752 LDKDecodeError e_conv;
19753 e_conv.inner = (void*)(e & (~1));
19754 e_conv.is_owned = (e & 1) || (e == 0);
19755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19756 e_conv = DecodeError_clone(&e_conv);
19757 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19758 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19759 return (uint32_t)ret_conv;
19762 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
19763 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
19764 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19768 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
19769 if ((_res & 1) != 0) return;
19770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19771 CHECK_ACCESS(_res_ptr);
19772 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19774 CResult_PongDecodeErrorZ_free(_res_conv);
19777 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19778 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19779 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19780 return (uint32_t)ret_conv;
19782 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
19783 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
19784 uint32_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19788 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
19789 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
19790 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19791 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19792 return (uint32_t)ret_conv;
19795 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19796 LDKUnsignedChannelAnnouncement o_conv;
19797 o_conv.inner = (void*)(o & (~1));
19798 o_conv.is_owned = (o & 1) || (o == 0);
19799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19800 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19801 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19802 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19803 return (uint32_t)ret_conv;
19806 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19807 LDKDecodeError e_conv;
19808 e_conv.inner = (void*)(e & (~1));
19809 e_conv.is_owned = (e & 1) || (e == 0);
19810 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19811 e_conv = DecodeError_clone(&e_conv);
19812 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19813 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19814 return (uint32_t)ret_conv;
19817 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19818 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
19819 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19823 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19824 if ((_res & 1) != 0) return;
19825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19826 CHECK_ACCESS(_res_ptr);
19827 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19829 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19832 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19833 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19834 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19835 return (uint32_t)ret_conv;
19837 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19838 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19839 uint32_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19843 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19844 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19845 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19846 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19847 return (uint32_t)ret_conv;
19850 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19851 LDKChannelAnnouncement o_conv;
19852 o_conv.inner = (void*)(o & (~1));
19853 o_conv.is_owned = (o & 1) || (o == 0);
19854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19855 o_conv = ChannelAnnouncement_clone(&o_conv);
19856 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19857 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19858 return (uint32_t)ret_conv;
19861 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19862 LDKDecodeError e_conv;
19863 e_conv.inner = (void*)(e & (~1));
19864 e_conv.is_owned = (e & 1) || (e == 0);
19865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19866 e_conv = DecodeError_clone(&e_conv);
19867 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19868 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19869 return (uint32_t)ret_conv;
19872 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19873 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
19874 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19878 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_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_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19884 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19887 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19888 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19889 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19890 return (uint32_t)ret_conv;
19892 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19893 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19894 uint32_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19898 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19899 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19900 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19901 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19902 return (uint32_t)ret_conv;
19905 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19906 LDKUnsignedChannelUpdate o_conv;
19907 o_conv.inner = (void*)(o & (~1));
19908 o_conv.is_owned = (o & 1) || (o == 0);
19909 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19910 o_conv = UnsignedChannelUpdate_clone(&o_conv);
19911 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19912 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
19913 return (uint32_t)ret_conv;
19916 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
19917 LDKDecodeError e_conv;
19918 e_conv.inner = (void*)(e & (~1));
19919 e_conv.is_owned = (e & 1) || (e == 0);
19920 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19921 e_conv = DecodeError_clone(&e_conv);
19922 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19923 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
19924 return (uint32_t)ret_conv;
19927 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19928 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
19929 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
19933 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19934 if ((_res & 1) != 0) return;
19935 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19936 CHECK_ACCESS(_res_ptr);
19937 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
19939 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
19942 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19943 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19944 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
19945 return (uint32_t)ret_conv;
19947 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19948 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
19949 uint32_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19953 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19954 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
19955 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19956 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
19957 return (uint32_t)ret_conv;
19960 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19961 LDKChannelUpdate o_conv;
19962 o_conv.inner = (void*)(o & (~1));
19963 o_conv.is_owned = (o & 1) || (o == 0);
19964 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19965 o_conv = ChannelUpdate_clone(&o_conv);
19966 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19967 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
19968 return (uint32_t)ret_conv;
19971 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
19972 LDKDecodeError e_conv;
19973 e_conv.inner = (void*)(e & (~1));
19974 e_conv.is_owned = (e & 1) || (e == 0);
19975 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19976 e_conv = DecodeError_clone(&e_conv);
19977 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19978 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
19979 return (uint32_t)ret_conv;
19982 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19983 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
19984 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
19988 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19989 if ((_res & 1) != 0) return;
19990 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19991 CHECK_ACCESS(_res_ptr);
19992 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
19994 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
19997 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19998 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19999 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20000 return (uint32_t)ret_conv;
20002 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
20003 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
20004 uint32_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20008 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
20009 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
20010 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20011 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20012 return (uint32_t)ret_conv;
20015 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
20016 LDKErrorMessage o_conv;
20017 o_conv.inner = (void*)(o & (~1));
20018 o_conv.is_owned = (o & 1) || (o == 0);
20019 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20020 o_conv = ErrorMessage_clone(&o_conv);
20021 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20022 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20023 return (uint32_t)ret_conv;
20026 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
20027 LDKDecodeError e_conv;
20028 e_conv.inner = (void*)(e & (~1));
20029 e_conv.is_owned = (e & 1) || (e == 0);
20030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20031 e_conv = DecodeError_clone(&e_conv);
20032 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20033 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20034 return (uint32_t)ret_conv;
20037 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
20038 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
20039 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20043 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
20044 if ((_res & 1) != 0) return;
20045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20046 CHECK_ACCESS(_res_ptr);
20047 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20049 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20052 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20053 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20054 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20055 return (uint32_t)ret_conv;
20057 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
20058 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
20059 uint32_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20063 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
20064 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
20065 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20066 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20067 return (uint32_t)ret_conv;
20070 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
20071 LDKWarningMessage o_conv;
20072 o_conv.inner = (void*)(o & (~1));
20073 o_conv.is_owned = (o & 1) || (o == 0);
20074 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20075 o_conv = WarningMessage_clone(&o_conv);
20076 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20077 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20078 return (uint32_t)ret_conv;
20081 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
20082 LDKDecodeError e_conv;
20083 e_conv.inner = (void*)(e & (~1));
20084 e_conv.is_owned = (e & 1) || (e == 0);
20085 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20086 e_conv = DecodeError_clone(&e_conv);
20087 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20088 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20089 return (uint32_t)ret_conv;
20092 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
20093 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
20094 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20098 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
20099 if ((_res & 1) != 0) return;
20100 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20101 CHECK_ACCESS(_res_ptr);
20102 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20104 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20107 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20108 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20109 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20110 return (uint32_t)ret_conv;
20112 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
20113 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
20114 uint32_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20118 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
20119 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
20120 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20121 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20122 return (uint32_t)ret_conv;
20125 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
20126 LDKUnsignedNodeAnnouncement o_conv;
20127 o_conv.inner = (void*)(o & (~1));
20128 o_conv.is_owned = (o & 1) || (o == 0);
20129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20130 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20131 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20132 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20133 return (uint32_t)ret_conv;
20136 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
20137 LDKDecodeError e_conv;
20138 e_conv.inner = (void*)(e & (~1));
20139 e_conv.is_owned = (e & 1) || (e == 0);
20140 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20141 e_conv = DecodeError_clone(&e_conv);
20142 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20143 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20144 return (uint32_t)ret_conv;
20147 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
20148 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
20149 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20153 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
20154 if ((_res & 1) != 0) return;
20155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20156 CHECK_ACCESS(_res_ptr);
20157 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20159 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20162 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20163 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20164 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20165 return (uint32_t)ret_conv;
20167 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
20168 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
20169 uint32_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20173 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
20174 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
20175 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20176 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20177 return (uint32_t)ret_conv;
20180 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
20181 LDKNodeAnnouncement o_conv;
20182 o_conv.inner = (void*)(o & (~1));
20183 o_conv.is_owned = (o & 1) || (o == 0);
20184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20185 o_conv = NodeAnnouncement_clone(&o_conv);
20186 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20187 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20188 return (uint32_t)ret_conv;
20191 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
20192 LDKDecodeError e_conv;
20193 e_conv.inner = (void*)(e & (~1));
20194 e_conv.is_owned = (e & 1) || (e == 0);
20195 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20196 e_conv = DecodeError_clone(&e_conv);
20197 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20198 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20199 return (uint32_t)ret_conv;
20202 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
20203 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
20204 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20208 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
20209 if ((_res & 1) != 0) return;
20210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20211 CHECK_ACCESS(_res_ptr);
20212 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20214 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20217 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20218 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20219 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
20220 return (uint32_t)ret_conv;
20222 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
20223 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
20224 uint32_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20228 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
20229 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
20230 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20231 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
20232 return (uint32_t)ret_conv;
20235 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
20236 LDKQueryShortChannelIds o_conv;
20237 o_conv.inner = (void*)(o & (~1));
20238 o_conv.is_owned = (o & 1) || (o == 0);
20239 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20240 o_conv = QueryShortChannelIds_clone(&o_conv);
20241 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20242 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
20243 return (uint32_t)ret_conv;
20246 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
20247 LDKDecodeError e_conv;
20248 e_conv.inner = (void*)(e & (~1));
20249 e_conv.is_owned = (e & 1) || (e == 0);
20250 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20251 e_conv = DecodeError_clone(&e_conv);
20252 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20253 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
20254 return (uint32_t)ret_conv;
20257 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
20258 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
20259 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
20263 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
20264 if ((_res & 1) != 0) return;
20265 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20266 CHECK_ACCESS(_res_ptr);
20267 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
20269 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
20272 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
20273 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20274 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
20275 return (uint32_t)ret_conv;
20277 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
20278 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
20279 uint32_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
20283 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
20284 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
20285 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20286 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
20287 return (uint32_t)ret_conv;
20290 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
20291 LDKReplyShortChannelIdsEnd o_conv;
20292 o_conv.inner = (void*)(o & (~1));
20293 o_conv.is_owned = (o & 1) || (o == 0);
20294 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20295 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
20296 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20297 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
20298 return (uint32_t)ret_conv;
20301 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
20302 LDKDecodeError e_conv;
20303 e_conv.inner = (void*)(e & (~1));
20304 e_conv.is_owned = (e & 1) || (e == 0);
20305 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20306 e_conv = DecodeError_clone(&e_conv);
20307 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20308 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
20309 return (uint32_t)ret_conv;
20312 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
20313 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
20314 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
20318 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
20319 if ((_res & 1) != 0) return;
20320 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20321 CHECK_ACCESS(_res_ptr);
20322 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
20324 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
20327 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
20328 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20329 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
20330 return (uint32_t)ret_conv;
20332 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
20333 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
20334 uint32_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
20338 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
20339 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
20340 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20341 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
20342 return (uint32_t)ret_conv;
20345 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
20346 LDKQueryChannelRange o_conv;
20347 o_conv.inner = (void*)(o & (~1));
20348 o_conv.is_owned = (o & 1) || (o == 0);
20349 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20350 o_conv = QueryChannelRange_clone(&o_conv);
20351 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20352 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
20353 return (uint32_t)ret_conv;
20356 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
20357 LDKDecodeError e_conv;
20358 e_conv.inner = (void*)(e & (~1));
20359 e_conv.is_owned = (e & 1) || (e == 0);
20360 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20361 e_conv = DecodeError_clone(&e_conv);
20362 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20363 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
20364 return (uint32_t)ret_conv;
20367 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
20368 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
20369 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
20373 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
20374 if ((_res & 1) != 0) return;
20375 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20376 CHECK_ACCESS(_res_ptr);
20377 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
20379 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
20382 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20383 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20384 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
20385 return (uint32_t)ret_conv;
20387 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
20388 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
20389 uint32_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20393 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
20394 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
20395 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20396 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
20397 return (uint32_t)ret_conv;
20400 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
20401 LDKReplyChannelRange o_conv;
20402 o_conv.inner = (void*)(o & (~1));
20403 o_conv.is_owned = (o & 1) || (o == 0);
20404 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20405 o_conv = ReplyChannelRange_clone(&o_conv);
20406 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20407 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
20408 return (uint32_t)ret_conv;
20411 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
20412 LDKDecodeError e_conv;
20413 e_conv.inner = (void*)(e & (~1));
20414 e_conv.is_owned = (e & 1) || (e == 0);
20415 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20416 e_conv = DecodeError_clone(&e_conv);
20417 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20418 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
20419 return (uint32_t)ret_conv;
20422 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
20423 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
20424 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
20428 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
20429 if ((_res & 1) != 0) return;
20430 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20431 CHECK_ACCESS(_res_ptr);
20432 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
20434 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
20437 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20438 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20439 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
20440 return (uint32_t)ret_conv;
20442 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
20443 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
20444 uint32_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20448 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
20449 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
20450 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20451 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
20452 return (uint32_t)ret_conv;
20455 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
20456 LDKGossipTimestampFilter o_conv;
20457 o_conv.inner = (void*)(o & (~1));
20458 o_conv.is_owned = (o & 1) || (o == 0);
20459 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20460 o_conv = GossipTimestampFilter_clone(&o_conv);
20461 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20462 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
20463 return (uint32_t)ret_conv;
20466 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
20467 LDKDecodeError e_conv;
20468 e_conv.inner = (void*)(e & (~1));
20469 e_conv.is_owned = (e & 1) || (e == 0);
20470 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20471 e_conv = DecodeError_clone(&e_conv);
20472 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20473 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
20474 return (uint32_t)ret_conv;
20477 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
20478 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
20479 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
20483 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
20484 if ((_res & 1) != 0) return;
20485 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20486 CHECK_ACCESS(_res_ptr);
20487 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
20489 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
20492 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
20493 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20494 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
20495 return (uint32_t)ret_conv;
20497 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
20498 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
20499 uint32_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
20503 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
20504 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
20505 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20506 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
20507 return (uint32_t)ret_conv;
20510 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
20512 o_conv.inner = (void*)(o & (~1));
20513 o_conv.is_owned = (o & 1) || (o == 0);
20514 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20515 o_conv = Invoice_clone(&o_conv);
20516 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20517 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
20518 return (uint32_t)ret_conv;
20521 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
20522 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
20523 CHECK_ACCESS(e_ptr);
20524 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
20525 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
20526 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20527 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
20528 return (uint32_t)ret_conv;
20531 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
20532 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
20533 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
20537 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
20538 if ((_res & 1) != 0) return;
20539 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20540 CHECK_ACCESS(_res_ptr);
20541 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
20543 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
20546 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
20547 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20548 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
20549 return (uint32_t)ret_conv;
20551 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
20552 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
20553 uint32_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
20557 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
20558 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
20559 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20560 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
20561 return (uint32_t)ret_conv;
20564 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
20565 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20566 CHECK_ACCESS(o_ptr);
20567 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
20568 if (o_conv.free == LDKFilter_JCalls_free) {
20569 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20570 LDKFilter_JCalls_cloned(&o_conv);
20572 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20573 *ret_copy = COption_FilterZ_some(o_conv);
20574 uint32_t ret_ref = (uintptr_t)ret_copy;
20578 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
20579 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20580 *ret_copy = COption_FilterZ_none();
20581 uint32_t ret_ref = (uintptr_t)ret_copy;
20585 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
20586 if ((_res & 1) != 0) return;
20587 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20588 CHECK_ACCESS(_res_ptr);
20589 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
20591 COption_FilterZ_free(_res_conv);
20594 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
20595 LDKLockedChannelMonitor o_conv;
20596 o_conv.inner = (void*)(o & (~1));
20597 o_conv.is_owned = (o & 1) || (o == 0);
20598 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20599 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
20600 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20601 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
20602 return (uint32_t)ret_conv;
20605 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
20606 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20607 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
20608 return (uint32_t)ret_conv;
20611 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
20612 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
20613 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
20617 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
20618 if ((_res & 1) != 0) return;
20619 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20620 CHECK_ACCESS(_res_ptr);
20621 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
20623 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
20626 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
20627 LDKCVec_OutPointZ _res_constr;
20628 _res_constr.datalen = _res->arr_len;
20629 if (_res_constr.datalen > 0)
20630 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
20632 _res_constr.data = NULL;
20633 uint32_t* _res_vals = _res->elems;
20634 for (size_t k = 0; k < _res_constr.datalen; k++) {
20635 uint32_t _res_conv_10 = _res_vals[k];
20636 LDKOutPoint _res_conv_10_conv;
20637 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
20638 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
20639 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20640 _res_constr.data[k] = _res_conv_10_conv;
20643 CVec_OutPointZ_free(_res_constr);
20646 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
20647 if ((this_ptr & 1) != 0) return;
20648 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20649 CHECK_ACCESS(this_ptr_ptr);
20650 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
20651 FREE((void*)this_ptr);
20652 PaymentPurpose_free(this_ptr_conv);
20655 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
20656 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20657 *ret_copy = PaymentPurpose_clone(arg);
20658 uint32_t ret_ref = (uintptr_t)ret_copy;
20661 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
20662 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
20663 uint32_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20667 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
20668 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
20669 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20670 *ret_copy = PaymentPurpose_clone(orig_conv);
20671 uint32_t ret_ref = (uintptr_t)ret_copy;
20675 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20676 LDKThirtyTwoBytes payment_preimage_ref;
20677 CHECK(payment_preimage->arr_len == 32);
20678 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20679 LDKThirtyTwoBytes payment_secret_ref;
20680 CHECK(payment_secret->arr_len == 32);
20681 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20682 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20683 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20684 uint32_t ret_ref = (uintptr_t)ret_copy;
20688 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20689 LDKThirtyTwoBytes a_ref;
20690 CHECK(a->arr_len == 32);
20691 memcpy(a_ref.data, a->elems, 32); FREE(a);
20692 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20693 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20694 uint32_t ret_ref = (uintptr_t)ret_copy;
20698 int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint32_t obj) {
20699 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
20700 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20701 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20702 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20703 CVec_u8Z_free(ret_var);
20707 uint32_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20708 LDKu8slice ser_ref;
20709 ser_ref.datalen = ser->arr_len;
20710 ser_ref.data = ser->elems;
20711 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20712 *ret_conv = PaymentPurpose_read(ser_ref);
20714 return (uint32_t)ret_conv;
20717 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
20718 if ((this_ptr & 1) != 0) return;
20719 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20720 CHECK_ACCESS(this_ptr_ptr);
20721 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20722 FREE((void*)this_ptr);
20723 ClosureReason_free(this_ptr_conv);
20726 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20727 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20728 *ret_copy = ClosureReason_clone(arg);
20729 uint32_t ret_ref = (uintptr_t)ret_copy;
20732 uint32_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
20733 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
20734 uint32_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20738 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
20739 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
20740 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20741 *ret_copy = ClosureReason_clone(orig_conv);
20742 uint32_t ret_ref = (uintptr_t)ret_copy;
20746 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20747 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20748 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20749 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20750 uint32_t ret_ref = (uintptr_t)ret_copy;
20754 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20755 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20756 *ret_copy = ClosureReason_holder_force_closed();
20757 uint32_t ret_ref = (uintptr_t)ret_copy;
20761 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20762 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20763 *ret_copy = ClosureReason_cooperative_closure();
20764 uint32_t ret_ref = (uintptr_t)ret_copy;
20768 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20769 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20770 *ret_copy = ClosureReason_commitment_tx_confirmed();
20771 uint32_t ret_ref = (uintptr_t)ret_copy;
20775 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20776 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20777 *ret_copy = ClosureReason_funding_timed_out();
20778 uint32_t ret_ref = (uintptr_t)ret_copy;
20782 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20783 LDKStr err_conv = str_ref_to_owned_c(err);
20784 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20785 *ret_copy = ClosureReason_processing_error(err_conv);
20786 uint32_t ret_ref = (uintptr_t)ret_copy;
20790 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20791 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20792 *ret_copy = ClosureReason_disconnected_peer();
20793 uint32_t ret_ref = (uintptr_t)ret_copy;
20797 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20798 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20799 *ret_copy = ClosureReason_outdated_channel_manager();
20800 uint32_t ret_ref = (uintptr_t)ret_copy;
20804 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
20805 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
20806 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20807 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20808 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20809 CVec_u8Z_free(ret_var);
20813 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20814 LDKu8slice ser_ref;
20815 ser_ref.datalen = ser->arr_len;
20816 ser_ref.data = ser->elems;
20817 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20818 *ret_conv = ClosureReason_read(ser_ref);
20820 return (uint32_t)ret_conv;
20823 void __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint32_t this_ptr) {
20824 if ((this_ptr & 1) != 0) return;
20825 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20826 CHECK_ACCESS(this_ptr_ptr);
20827 LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
20828 FREE((void*)this_ptr);
20829 HTLCDestination_free(this_ptr_conv);
20832 static inline uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
20833 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20834 *ret_copy = HTLCDestination_clone(arg);
20835 uint32_t ret_ref = (uintptr_t)ret_copy;
20838 uint32_t __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint32_t arg) {
20839 LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)arg;
20840 uint32_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
20844 uint32_t __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint32_t orig) {
20845 LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)orig;
20846 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20847 *ret_copy = HTLCDestination_clone(orig_conv);
20848 uint32_t ret_ref = (uintptr_t)ret_copy;
20852 uint32_t __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
20853 LDKPublicKey node_id_ref;
20854 CHECK(node_id->arr_len == 33);
20855 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20856 LDKThirtyTwoBytes channel_id_ref;
20857 CHECK(channel_id->arr_len == 32);
20858 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20859 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20860 *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
20861 uint32_t ret_ref = (uintptr_t)ret_copy;
20865 uint32_t __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
20866 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20867 *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
20868 uint32_t ret_ref = (uintptr_t)ret_copy;
20872 uint32_t __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
20873 LDKThirtyTwoBytes payment_hash_ref;
20874 CHECK(payment_hash->arr_len == 32);
20875 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20876 LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20877 *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
20878 uint32_t ret_ref = (uintptr_t)ret_copy;
20882 int8_tArray __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint32_t obj) {
20883 LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)obj;
20884 LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
20885 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20886 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20887 CVec_u8Z_free(ret_var);
20891 uint32_t __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
20892 LDKu8slice ser_ref;
20893 ser_ref.datalen = ser->arr_len;
20894 ser_ref.data = ser->elems;
20895 LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
20896 *ret_conv = HTLCDestination_read(ser_ref);
20898 return (uint32_t)ret_conv;
20901 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
20902 if ((this_ptr & 1) != 0) return;
20903 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20904 CHECK_ACCESS(this_ptr_ptr);
20905 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
20906 FREE((void*)this_ptr);
20907 Event_free(this_ptr_conv);
20910 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
20911 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20912 *ret_copy = Event_clone(arg);
20913 uint32_t ret_ref = (uintptr_t)ret_copy;
20916 uint32_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
20917 LDKEvent* arg_conv = (LDKEvent*)arg;
20918 uint32_t ret_conv = Event_clone_ptr(arg_conv);
20922 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
20923 LDKEvent* orig_conv = (LDKEvent*)orig;
20924 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20925 *ret_copy = Event_clone(orig_conv);
20926 uint32_t ret_ref = (uintptr_t)ret_copy;
20930 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) {
20931 LDKThirtyTwoBytes temporary_channel_id_ref;
20932 CHECK(temporary_channel_id->arr_len == 32);
20933 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20934 LDKPublicKey counterparty_node_id_ref;
20935 CHECK(counterparty_node_id->arr_len == 33);
20936 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20937 LDKCVec_u8Z output_script_ref;
20938 output_script_ref.datalen = output_script->arr_len;
20939 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
20940 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
20941 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20942 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
20943 uint32_t ret_ref = (uintptr_t)ret_copy;
20947 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20948 LDKThirtyTwoBytes payment_hash_ref;
20949 CHECK(payment_hash->arr_len == 32);
20950 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20951 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20952 CHECK_ACCESS(purpose_ptr);
20953 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20954 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20955 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20956 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
20957 uint32_t ret_ref = (uintptr_t)ret_copy;
20961 uint32_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20962 LDKThirtyTwoBytes payment_hash_ref;
20963 CHECK(payment_hash->arr_len == 32);
20964 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20965 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20966 CHECK_ACCESS(purpose_ptr);
20967 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20968 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20969 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20970 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
20971 uint32_t ret_ref = (uintptr_t)ret_copy;
20975 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) {
20976 LDKThirtyTwoBytes payment_id_ref;
20977 CHECK(payment_id->arr_len == 32);
20978 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20979 LDKThirtyTwoBytes payment_preimage_ref;
20980 CHECK(payment_preimage->arr_len == 32);
20981 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20982 LDKThirtyTwoBytes payment_hash_ref;
20983 CHECK(payment_hash->arr_len == 32);
20984 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20985 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
20986 CHECK_ACCESS(fee_paid_msat_ptr);
20987 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
20988 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
20989 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20990 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
20991 uint32_t ret_ref = (uintptr_t)ret_copy;
20995 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
20996 LDKThirtyTwoBytes payment_id_ref;
20997 CHECK(payment_id->arr_len == 32);
20998 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20999 LDKThirtyTwoBytes payment_hash_ref;
21000 CHECK(payment_hash->arr_len == 32);
21001 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21002 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21003 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21004 uint32_t ret_ref = (uintptr_t)ret_copy;
21008 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) {
21009 LDKThirtyTwoBytes payment_id_ref;
21010 CHECK(payment_id->arr_len == 32);
21011 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21012 LDKThirtyTwoBytes payment_hash_ref;
21013 CHECK(payment_hash->arr_len == 32);
21014 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21015 LDKCVec_RouteHopZ path_constr;
21016 path_constr.datalen = path->arr_len;
21017 if (path_constr.datalen > 0)
21018 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21020 path_constr.data = NULL;
21021 uint32_t* path_vals = path->elems;
21022 for (size_t k = 0; k < path_constr.datalen; k++) {
21023 uint32_t path_conv_10 = path_vals[k];
21024 LDKRouteHop path_conv_10_conv;
21025 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21026 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21027 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21028 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21029 path_constr.data[k] = path_conv_10_conv;
21032 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21033 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21034 uint32_t ret_ref = (uintptr_t)ret_copy;
21038 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) {
21039 LDKThirtyTwoBytes payment_id_ref;
21040 CHECK(payment_id->arr_len == 32);
21041 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21042 LDKThirtyTwoBytes payment_hash_ref;
21043 CHECK(payment_hash->arr_len == 32);
21044 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21045 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
21046 CHECK_ACCESS(network_update_ptr);
21047 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21048 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
21049 LDKCVec_RouteHopZ path_constr;
21050 path_constr.datalen = path->arr_len;
21051 if (path_constr.datalen > 0)
21052 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21054 path_constr.data = NULL;
21055 uint32_t* path_vals = path->elems;
21056 for (size_t k = 0; k < path_constr.datalen; k++) {
21057 uint32_t path_conv_10 = path_vals[k];
21058 LDKRouteHop path_conv_10_conv;
21059 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21060 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21061 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21062 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21063 path_constr.data[k] = path_conv_10_conv;
21066 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
21067 CHECK_ACCESS(short_channel_id_ptr);
21068 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21069 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
21070 LDKRouteParameters retry_conv;
21071 retry_conv.inner = (void*)(retry & (~1));
21072 retry_conv.is_owned = (retry & 1) || (retry == 0);
21073 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21074 retry_conv = RouteParameters_clone(&retry_conv);
21075 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21076 *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);
21077 uint32_t ret_ref = (uintptr_t)ret_copy;
21081 uint32_t __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
21082 LDKThirtyTwoBytes payment_id_ref;
21083 CHECK(payment_id->arr_len == 32);
21084 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21085 LDKThirtyTwoBytes payment_hash_ref;
21086 CHECK(payment_hash->arr_len == 32);
21087 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21088 LDKCVec_RouteHopZ path_constr;
21089 path_constr.datalen = path->arr_len;
21090 if (path_constr.datalen > 0)
21091 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21093 path_constr.data = NULL;
21094 uint32_t* path_vals = path->elems;
21095 for (size_t k = 0; k < path_constr.datalen; k++) {
21096 uint32_t path_conv_10 = path_vals[k];
21097 LDKRouteHop path_conv_10_conv;
21098 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21099 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21100 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21101 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21102 path_constr.data[k] = path_conv_10_conv;
21105 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21106 *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
21107 uint32_t ret_ref = (uintptr_t)ret_copy;
21111 uint32_t __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path, uint32_t short_channel_id) {
21112 LDKThirtyTwoBytes payment_id_ref;
21113 CHECK(payment_id->arr_len == 32);
21114 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21115 LDKThirtyTwoBytes payment_hash_ref;
21116 CHECK(payment_hash->arr_len == 32);
21117 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21118 LDKCVec_RouteHopZ path_constr;
21119 path_constr.datalen = path->arr_len;
21120 if (path_constr.datalen > 0)
21121 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21123 path_constr.data = NULL;
21124 uint32_t* path_vals = path->elems;
21125 for (size_t k = 0; k < path_constr.datalen; k++) {
21126 uint32_t path_conv_10 = path_vals[k];
21127 LDKRouteHop path_conv_10_conv;
21128 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21129 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21130 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21131 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21132 path_constr.data[k] = path_conv_10_conv;
21135 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
21136 CHECK_ACCESS(short_channel_id_ptr);
21137 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21138 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
21139 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21140 *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
21141 uint32_t ret_ref = (uintptr_t)ret_copy;
21145 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
21146 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21147 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21148 uint32_t ret_ref = (uintptr_t)ret_copy;
21152 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
21153 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21154 outputs_constr.datalen = outputs->arr_len;
21155 if (outputs_constr.datalen > 0)
21156 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21158 outputs_constr.data = NULL;
21159 uint32_t* outputs_vals = outputs->elems;
21160 for (size_t b = 0; b < outputs_constr.datalen; b++) {
21161 uint32_t outputs_conv_27 = outputs_vals[b];
21162 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
21163 CHECK_ACCESS(outputs_conv_27_ptr);
21164 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21165 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
21166 outputs_constr.data[b] = outputs_conv_27_conv;
21169 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21170 *ret_copy = Event_spendable_outputs(outputs_constr);
21171 uint32_t ret_ref = (uintptr_t)ret_copy;
21175 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) {
21176 LDKThirtyTwoBytes prev_channel_id_ref;
21177 CHECK(prev_channel_id->arr_len == 32);
21178 memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21179 LDKThirtyTwoBytes next_channel_id_ref;
21180 CHECK(next_channel_id->arr_len == 32);
21181 memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
21182 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
21183 CHECK_ACCESS(fee_earned_msat_ptr);
21184 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21185 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
21186 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21187 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
21188 uint32_t ret_ref = (uintptr_t)ret_copy;
21192 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) {
21193 LDKThirtyTwoBytes channel_id_ref;
21194 CHECK(channel_id->arr_len == 32);
21195 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21196 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
21197 CHECK_ACCESS(reason_ptr);
21198 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21199 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
21200 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21201 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21202 uint32_t ret_ref = (uintptr_t)ret_copy;
21206 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
21207 LDKThirtyTwoBytes channel_id_ref;
21208 CHECK(channel_id->arr_len == 32);
21209 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21210 LDKTransaction transaction_ref;
21211 transaction_ref.datalen = transaction->arr_len;
21212 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21213 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
21214 transaction_ref.data_is_owned = true;
21215 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21216 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21217 uint32_t ret_ref = (uintptr_t)ret_copy;
21221 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) {
21222 LDKThirtyTwoBytes temporary_channel_id_ref;
21223 CHECK(temporary_channel_id->arr_len == 32);
21224 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21225 LDKPublicKey counterparty_node_id_ref;
21226 CHECK(counterparty_node_id->arr_len == 33);
21227 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21228 LDKChannelTypeFeatures channel_type_conv;
21229 channel_type_conv.inner = (void*)(channel_type & (~1));
21230 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
21231 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
21232 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
21233 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21234 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
21235 uint32_t ret_ref = (uintptr_t)ret_copy;
21239 uint32_t __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint32_t failed_next_destination) {
21240 LDKThirtyTwoBytes prev_channel_id_ref;
21241 CHECK(prev_channel_id->arr_len == 32);
21242 memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21243 void* failed_next_destination_ptr = (void*)(((uintptr_t)failed_next_destination) & ~1);
21244 CHECK_ACCESS(failed_next_destination_ptr);
21245 LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
21246 failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)failed_next_destination) & ~1));
21247 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21248 *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
21249 uint32_t ret_ref = (uintptr_t)ret_copy;
21253 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
21254 LDKEvent* obj_conv = (LDKEvent*)obj;
21255 LDKCVec_u8Z ret_var = Event_write(obj_conv);
21256 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21257 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21258 CVec_u8Z_free(ret_var);
21262 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
21263 LDKu8slice ser_ref;
21264 ser_ref.datalen = ser->arr_len;
21265 ser_ref.data = ser->elems;
21266 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21267 *ret_conv = Event_read(ser_ref);
21269 return (uint32_t)ret_conv;
21272 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
21273 if ((this_ptr & 1) != 0) return;
21274 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21275 CHECK_ACCESS(this_ptr_ptr);
21276 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21277 FREE((void*)this_ptr);
21278 MessageSendEvent_free(this_ptr_conv);
21281 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21282 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21283 *ret_copy = MessageSendEvent_clone(arg);
21284 uint32_t ret_ref = (uintptr_t)ret_copy;
21287 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
21288 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
21289 uint32_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
21293 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
21294 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
21295 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21296 *ret_copy = MessageSendEvent_clone(orig_conv);
21297 uint32_t ret_ref = (uintptr_t)ret_copy;
21301 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
21302 LDKPublicKey node_id_ref;
21303 CHECK(node_id->arr_len == 33);
21304 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21305 LDKAcceptChannel msg_conv;
21306 msg_conv.inner = (void*)(msg & (~1));
21307 msg_conv.is_owned = (msg & 1) || (msg == 0);
21308 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21309 msg_conv = AcceptChannel_clone(&msg_conv);
21310 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21311 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21312 uint32_t ret_ref = (uintptr_t)ret_copy;
21316 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
21317 LDKPublicKey node_id_ref;
21318 CHECK(node_id->arr_len == 33);
21319 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21320 LDKOpenChannel msg_conv;
21321 msg_conv.inner = (void*)(msg & (~1));
21322 msg_conv.is_owned = (msg & 1) || (msg == 0);
21323 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21324 msg_conv = OpenChannel_clone(&msg_conv);
21325 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21326 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21327 uint32_t ret_ref = (uintptr_t)ret_copy;
21331 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
21332 LDKPublicKey node_id_ref;
21333 CHECK(node_id->arr_len == 33);
21334 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21335 LDKFundingCreated msg_conv;
21336 msg_conv.inner = (void*)(msg & (~1));
21337 msg_conv.is_owned = (msg & 1) || (msg == 0);
21338 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21339 msg_conv = FundingCreated_clone(&msg_conv);
21340 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21341 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21342 uint32_t ret_ref = (uintptr_t)ret_copy;
21346 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
21347 LDKPublicKey node_id_ref;
21348 CHECK(node_id->arr_len == 33);
21349 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21350 LDKFundingSigned msg_conv;
21351 msg_conv.inner = (void*)(msg & (~1));
21352 msg_conv.is_owned = (msg & 1) || (msg == 0);
21353 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21354 msg_conv = FundingSigned_clone(&msg_conv);
21355 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21356 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21357 uint32_t ret_ref = (uintptr_t)ret_copy;
21361 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint32_t msg) {
21362 LDKPublicKey node_id_ref;
21363 CHECK(node_id->arr_len == 33);
21364 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21365 LDKChannelReady msg_conv;
21366 msg_conv.inner = (void*)(msg & (~1));
21367 msg_conv.is_owned = (msg & 1) || (msg == 0);
21368 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21369 msg_conv = ChannelReady_clone(&msg_conv);
21370 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21371 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
21372 uint32_t ret_ref = (uintptr_t)ret_copy;
21376 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
21377 LDKPublicKey node_id_ref;
21378 CHECK(node_id->arr_len == 33);
21379 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21380 LDKAnnouncementSignatures msg_conv;
21381 msg_conv.inner = (void*)(msg & (~1));
21382 msg_conv.is_owned = (msg & 1) || (msg == 0);
21383 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21384 msg_conv = AnnouncementSignatures_clone(&msg_conv);
21385 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21386 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21387 uint32_t ret_ref = (uintptr_t)ret_copy;
21391 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
21392 LDKPublicKey node_id_ref;
21393 CHECK(node_id->arr_len == 33);
21394 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21395 LDKCommitmentUpdate updates_conv;
21396 updates_conv.inner = (void*)(updates & (~1));
21397 updates_conv.is_owned = (updates & 1) || (updates == 0);
21398 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21399 updates_conv = CommitmentUpdate_clone(&updates_conv);
21400 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21401 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21402 uint32_t ret_ref = (uintptr_t)ret_copy;
21406 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
21407 LDKPublicKey node_id_ref;
21408 CHECK(node_id->arr_len == 33);
21409 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21410 LDKRevokeAndACK msg_conv;
21411 msg_conv.inner = (void*)(msg & (~1));
21412 msg_conv.is_owned = (msg & 1) || (msg == 0);
21413 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21414 msg_conv = RevokeAndACK_clone(&msg_conv);
21415 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21416 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21417 uint32_t ret_ref = (uintptr_t)ret_copy;
21421 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
21422 LDKPublicKey node_id_ref;
21423 CHECK(node_id->arr_len == 33);
21424 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21425 LDKClosingSigned msg_conv;
21426 msg_conv.inner = (void*)(msg & (~1));
21427 msg_conv.is_owned = (msg & 1) || (msg == 0);
21428 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21429 msg_conv = ClosingSigned_clone(&msg_conv);
21430 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21431 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21432 uint32_t ret_ref = (uintptr_t)ret_copy;
21436 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
21437 LDKPublicKey node_id_ref;
21438 CHECK(node_id->arr_len == 33);
21439 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21440 LDKShutdown msg_conv;
21441 msg_conv.inner = (void*)(msg & (~1));
21442 msg_conv.is_owned = (msg & 1) || (msg == 0);
21443 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21444 msg_conv = Shutdown_clone(&msg_conv);
21445 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21446 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
21447 uint32_t ret_ref = (uintptr_t)ret_copy;
21451 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
21452 LDKPublicKey node_id_ref;
21453 CHECK(node_id->arr_len == 33);
21454 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21455 LDKChannelReestablish msg_conv;
21456 msg_conv.inner = (void*)(msg & (~1));
21457 msg_conv.is_owned = (msg & 1) || (msg == 0);
21458 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21459 msg_conv = ChannelReestablish_clone(&msg_conv);
21460 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21461 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
21462 uint32_t ret_ref = (uintptr_t)ret_copy;
21466 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
21467 LDKChannelAnnouncement msg_conv;
21468 msg_conv.inner = (void*)(msg & (~1));
21469 msg_conv.is_owned = (msg & 1) || (msg == 0);
21470 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21471 msg_conv = ChannelAnnouncement_clone(&msg_conv);
21472 LDKChannelUpdate update_msg_conv;
21473 update_msg_conv.inner = (void*)(update_msg & (~1));
21474 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
21475 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21476 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21477 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21478 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
21479 uint32_t ret_ref = (uintptr_t)ret_copy;
21483 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
21484 LDKNodeAnnouncement msg_conv;
21485 msg_conv.inner = (void*)(msg & (~1));
21486 msg_conv.is_owned = (msg & 1) || (msg == 0);
21487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21488 msg_conv = NodeAnnouncement_clone(&msg_conv);
21489 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21490 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
21491 uint32_t ret_ref = (uintptr_t)ret_copy;
21495 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
21496 LDKChannelUpdate msg_conv;
21497 msg_conv.inner = (void*)(msg & (~1));
21498 msg_conv.is_owned = (msg & 1) || (msg == 0);
21499 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21500 msg_conv = ChannelUpdate_clone(&msg_conv);
21501 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21502 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
21503 uint32_t ret_ref = (uintptr_t)ret_copy;
21507 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
21508 LDKPublicKey node_id_ref;
21509 CHECK(node_id->arr_len == 33);
21510 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21511 LDKChannelUpdate msg_conv;
21512 msg_conv.inner = (void*)(msg & (~1));
21513 msg_conv.is_owned = (msg & 1) || (msg == 0);
21514 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21515 msg_conv = ChannelUpdate_clone(&msg_conv);
21516 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21517 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
21518 uint32_t ret_ref = (uintptr_t)ret_copy;
21522 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
21523 LDKPublicKey node_id_ref;
21524 CHECK(node_id->arr_len == 33);
21525 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21526 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
21527 CHECK_ACCESS(action_ptr);
21528 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
21529 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
21530 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21531 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
21532 uint32_t ret_ref = (uintptr_t)ret_copy;
21536 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
21537 LDKPublicKey node_id_ref;
21538 CHECK(node_id->arr_len == 33);
21539 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21540 LDKQueryChannelRange msg_conv;
21541 msg_conv.inner = (void*)(msg & (~1));
21542 msg_conv.is_owned = (msg & 1) || (msg == 0);
21543 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21544 msg_conv = QueryChannelRange_clone(&msg_conv);
21545 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21546 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
21547 uint32_t ret_ref = (uintptr_t)ret_copy;
21551 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
21552 LDKPublicKey node_id_ref;
21553 CHECK(node_id->arr_len == 33);
21554 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21555 LDKQueryShortChannelIds msg_conv;
21556 msg_conv.inner = (void*)(msg & (~1));
21557 msg_conv.is_owned = (msg & 1) || (msg == 0);
21558 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21559 msg_conv = QueryShortChannelIds_clone(&msg_conv);
21560 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21561 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
21562 uint32_t ret_ref = (uintptr_t)ret_copy;
21566 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
21567 LDKPublicKey node_id_ref;
21568 CHECK(node_id->arr_len == 33);
21569 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21570 LDKReplyChannelRange msg_conv;
21571 msg_conv.inner = (void*)(msg & (~1));
21572 msg_conv.is_owned = (msg & 1) || (msg == 0);
21573 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21574 msg_conv = ReplyChannelRange_clone(&msg_conv);
21575 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21576 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
21577 uint32_t ret_ref = (uintptr_t)ret_copy;
21581 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint32_t msg) {
21582 LDKPublicKey node_id_ref;
21583 CHECK(node_id->arr_len == 33);
21584 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21585 LDKGossipTimestampFilter msg_conv;
21586 msg_conv.inner = (void*)(msg & (~1));
21587 msg_conv.is_owned = (msg & 1) || (msg == 0);
21588 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21589 msg_conv = GossipTimestampFilter_clone(&msg_conv);
21590 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21591 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
21592 uint32_t ret_ref = (uintptr_t)ret_copy;
21596 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
21597 if ((this_ptr & 1) != 0) return;
21598 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21599 CHECK_ACCESS(this_ptr_ptr);
21600 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
21601 FREE((void*)this_ptr);
21602 MessageSendEventsProvider_free(this_ptr_conv);
21605 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
21606 if ((this_ptr & 1) != 0) return;
21607 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21608 CHECK_ACCESS(this_ptr_ptr);
21609 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
21610 FREE((void*)this_ptr);
21611 EventsProvider_free(this_ptr_conv);
21614 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
21615 if ((this_ptr & 1) != 0) return;
21616 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21617 CHECK_ACCESS(this_ptr_ptr);
21618 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
21619 FREE((void*)this_ptr);
21620 EventHandler_free(this_ptr_conv);
21623 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
21624 if ((this_ptr & 1) != 0) return;
21625 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21626 CHECK_ACCESS(this_ptr_ptr);
21627 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
21628 FREE((void*)this_ptr);
21629 APIError_free(this_ptr_conv);
21632 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
21633 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21634 *ret_copy = APIError_clone(arg);
21635 uint32_t ret_ref = (uintptr_t)ret_copy;
21638 uint32_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
21639 LDKAPIError* arg_conv = (LDKAPIError*)arg;
21640 uint32_t ret_conv = APIError_clone_ptr(arg_conv);
21644 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
21645 LDKAPIError* orig_conv = (LDKAPIError*)orig;
21646 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21647 *ret_copy = APIError_clone(orig_conv);
21648 uint32_t ret_ref = (uintptr_t)ret_copy;
21652 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
21653 LDKStr err_conv = str_ref_to_owned_c(err);
21654 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21655 *ret_copy = APIError_apimisuse_error(err_conv);
21656 uint32_t ret_ref = (uintptr_t)ret_copy;
21660 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
21661 LDKStr err_conv = str_ref_to_owned_c(err);
21662 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21663 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
21664 uint32_t ret_ref = (uintptr_t)ret_copy;
21668 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
21669 LDKStr err_conv = str_ref_to_owned_c(err);
21670 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21671 *ret_copy = APIError_route_error(err_conv);
21672 uint32_t ret_ref = (uintptr_t)ret_copy;
21676 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
21677 LDKStr err_conv = str_ref_to_owned_c(err);
21678 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21679 *ret_copy = APIError_channel_unavailable(err_conv);
21680 uint32_t ret_ref = (uintptr_t)ret_copy;
21684 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
21685 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21686 *ret_copy = APIError_monitor_update_failed();
21687 uint32_t ret_ref = (uintptr_t)ret_copy;
21691 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
21692 LDKShutdownScript script_conv;
21693 script_conv.inner = (void*)(script & (~1));
21694 script_conv.is_owned = (script & 1) || (script == 0);
21695 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
21696 script_conv = ShutdownScript_clone(&script_conv);
21697 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21698 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
21699 uint32_t ret_ref = (uintptr_t)ret_copy;
21703 void __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint32_t this_obj) {
21704 LDKBigSize this_obj_conv;
21705 this_obj_conv.inner = (void*)(this_obj & (~1));
21706 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21708 BigSize_free(this_obj_conv);
21711 int64_t __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint32_t this_ptr) {
21712 LDKBigSize 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 = BigSize_get_a(&this_ptr_conv);
21720 void __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint32_t this_ptr, int64_t val) {
21721 LDKBigSize 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 BigSize_set_a(&this_ptr_conv, val);
21728 uint32_t __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
21729 LDKBigSize ret_var = BigSize_new(a_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 void __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint32_t this_obj) {
21742 LDKHostname this_obj_conv;
21743 this_obj_conv.inner = (void*)(this_obj & (~1));
21744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21746 Hostname_free(this_obj_conv);
21749 static inline uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
21750 LDKHostname ret_var = Hostname_clone(arg);
21751 uint32_t ret_ref = 0;
21752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21755 ret_ref = (uintptr_t)ret_var.inner;
21756 if (ret_var.is_owned) {
21761 uint32_t __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint32_t arg) {
21762 LDKHostname arg_conv;
21763 arg_conv.inner = (void*)(arg & (~1));
21764 arg_conv.is_owned = false;
21765 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21766 uint32_t ret_conv = Hostname_clone_ptr(&arg_conv);
21770 uint32_t __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint32_t orig) {
21771 LDKHostname orig_conv;
21772 orig_conv.inner = (void*)(orig & (~1));
21773 orig_conv.is_owned = false;
21774 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21775 LDKHostname ret_var = Hostname_clone(&orig_conv);
21776 uint32_t ret_ref = 0;
21777 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21778 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21780 ret_ref = (uintptr_t)ret_var.inner;
21781 if (ret_var.is_owned) {
21787 int8_t __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint32_t this_arg) {
21788 LDKHostname this_arg_conv;
21789 this_arg_conv.inner = (void*)(this_arg & (~1));
21790 this_arg_conv.is_owned = false;
21791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21792 int8_t ret_conv = Hostname_len(&this_arg_conv);
21796 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
21797 LDKu8slice msg_ref;
21798 msg_ref.datalen = msg->arr_len;
21799 msg_ref.data = msg->elems;
21800 unsigned char sk_arr[32];
21801 CHECK(sk->arr_len == 32);
21802 memcpy(sk_arr, sk->elems, 32); FREE(sk);
21803 unsigned char (*sk_ref)[32] = &sk_arr;
21804 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21805 *ret_conv = sign(msg_ref, sk_ref);
21807 return (uint32_t)ret_conv;
21810 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
21811 LDKu8slice msg_ref;
21812 msg_ref.datalen = msg->arr_len;
21813 msg_ref.data = msg->elems;
21814 LDKStr sig_conv = str_ref_to_owned_c(sig);
21815 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21816 *ret_conv = recover_pk(msg_ref, sig_conv);
21818 return (uint32_t)ret_conv;
21821 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
21822 LDKu8slice msg_ref;
21823 msg_ref.datalen = msg->arr_len;
21824 msg_ref.data = msg->elems;
21825 LDKStr sig_conv = str_ref_to_owned_c(sig);
21826 LDKPublicKey pk_ref;
21827 CHECK(pk->arr_len == 33);
21828 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
21829 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
21834 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
21835 LDKu8slice hrp_bytes_ref;
21836 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
21837 hrp_bytes_ref.data = hrp_bytes->elems;
21838 LDKCVec_u5Z data_without_signature_constr;
21839 data_without_signature_constr.datalen = data_without_signature->arr_len;
21840 if (data_without_signature_constr.datalen > 0)
21841 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
21843 data_without_signature_constr.data = NULL;
21844 int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
21845 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
21846 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
21848 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
21850 FREE(data_without_signature);
21851 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
21852 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21853 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21854 CVec_u8Z_free(ret_var);
21859 void __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint32_t this_ptr) {
21860 if ((this_ptr & 1) != 0) return;
21861 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21862 CHECK_ACCESS(this_ptr_ptr);
21863 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
21864 FREE((void*)this_ptr);
21865 Persister_free(this_ptr_conv);
21868 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
21869 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
21870 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
21874 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
21875 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
21879 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
21880 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
21884 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
21885 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
21889 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
21890 uint32_t ret_conv = LDKLevel_to_js(Level_info());
21894 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
21895 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
21899 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
21900 uint32_t ret_conv = LDKLevel_to_js(Level_error());
21904 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
21905 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
21906 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
21907 jboolean ret_conv = Level_eq(a_conv, b_conv);
21911 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
21912 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
21913 int64_t ret_conv = Level_hash(o_conv);
21917 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
21918 uint32_t ret_conv = LDKLevel_to_js(Level_max());
21922 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
21923 LDKRecord this_obj_conv;
21924 this_obj_conv.inner = (void*)(this_obj & (~1));
21925 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21927 Record_free(this_obj_conv);
21930 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
21931 LDKRecord this_ptr_conv;
21932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21933 this_ptr_conv.is_owned = false;
21934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21935 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
21939 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
21940 LDKRecord this_ptr_conv;
21941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21942 this_ptr_conv.is_owned = false;
21943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21944 LDKLevel val_conv = LDKLevel_from_js(val);
21945 Record_set_level(&this_ptr_conv, val_conv);
21948 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
21949 LDKRecord this_ptr_conv;
21950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21951 this_ptr_conv.is_owned = false;
21952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21953 LDKStr ret_str = Record_get_args(&this_ptr_conv);
21954 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21959 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
21960 LDKRecord this_ptr_conv;
21961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21962 this_ptr_conv.is_owned = false;
21963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21964 LDKStr val_conv = str_ref_to_owned_c(val);
21965 Record_set_args(&this_ptr_conv, val_conv);
21968 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
21969 LDKRecord this_ptr_conv;
21970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21971 this_ptr_conv.is_owned = false;
21972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21973 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
21974 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21979 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
21980 LDKRecord this_ptr_conv;
21981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21982 this_ptr_conv.is_owned = false;
21983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21984 LDKStr val_conv = str_ref_to_owned_c(val);
21985 Record_set_module_path(&this_ptr_conv, val_conv);
21988 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
21989 LDKRecord this_ptr_conv;
21990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21991 this_ptr_conv.is_owned = false;
21992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21993 LDKStr ret_str = Record_get_file(&this_ptr_conv);
21994 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21999 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
22000 LDKRecord this_ptr_conv;
22001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22002 this_ptr_conv.is_owned = false;
22003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22004 LDKStr val_conv = str_ref_to_owned_c(val);
22005 Record_set_file(&this_ptr_conv, val_conv);
22008 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
22009 LDKRecord this_ptr_conv;
22010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22011 this_ptr_conv.is_owned = false;
22012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22013 int32_t ret_conv = Record_get_line(&this_ptr_conv);
22017 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
22018 LDKRecord this_ptr_conv;
22019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22020 this_ptr_conv.is_owned = false;
22021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22022 Record_set_line(&this_ptr_conv, val);
22025 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22026 LDKRecord ret_var = Record_clone(arg);
22027 uint32_t ret_ref = 0;
22028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22031 ret_ref = (uintptr_t)ret_var.inner;
22032 if (ret_var.is_owned) {
22037 uint32_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
22038 LDKRecord arg_conv;
22039 arg_conv.inner = (void*)(arg & (~1));
22040 arg_conv.is_owned = false;
22041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22042 uint32_t ret_conv = Record_clone_ptr(&arg_conv);
22046 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
22047 LDKRecord orig_conv;
22048 orig_conv.inner = (void*)(orig & (~1));
22049 orig_conv.is_owned = false;
22050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22051 LDKRecord ret_var = Record_clone(&orig_conv);
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) {
22063 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
22064 if ((this_ptr & 1) != 0) return;
22065 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22066 CHECK_ACCESS(this_ptr_ptr);
22067 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22068 FREE((void*)this_ptr);
22069 Logger_free(this_ptr_conv);
22072 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
22073 LDKChannelHandshakeConfig this_obj_conv;
22074 this_obj_conv.inner = (void*)(this_obj & (~1));
22075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22077 ChannelHandshakeConfig_free(this_obj_conv);
22080 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
22081 LDKChannelHandshakeConfig this_ptr_conv;
22082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22083 this_ptr_conv.is_owned = false;
22084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22085 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22089 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
22090 LDKChannelHandshakeConfig this_ptr_conv;
22091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22092 this_ptr_conv.is_owned = false;
22093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22094 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22097 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
22098 LDKChannelHandshakeConfig this_ptr_conv;
22099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22100 this_ptr_conv.is_owned = false;
22101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22102 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22106 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) {
22107 LDKChannelHandshakeConfig this_ptr_conv;
22108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22109 this_ptr_conv.is_owned = false;
22110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22111 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22114 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
22115 LDKChannelHandshakeConfig this_ptr_conv;
22116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22117 this_ptr_conv.is_owned = false;
22118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22119 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22123 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) {
22124 LDKChannelHandshakeConfig this_ptr_conv;
22125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22126 this_ptr_conv.is_owned = false;
22127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22128 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22131 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) {
22132 LDKChannelHandshakeConfig this_ptr_conv;
22133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22134 this_ptr_conv.is_owned = false;
22135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22136 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
22140 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) {
22141 LDKChannelHandshakeConfig this_ptr_conv;
22142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22143 this_ptr_conv.is_owned = false;
22144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22145 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
22148 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint32_t this_ptr) {
22149 LDKChannelHandshakeConfig this_ptr_conv;
22150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22151 this_ptr_conv.is_owned = false;
22152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22153 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
22157 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint32_t this_ptr, jboolean val) {
22158 LDKChannelHandshakeConfig this_ptr_conv;
22159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22160 this_ptr_conv.is_owned = false;
22161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22162 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
22165 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint32_t this_ptr) {
22166 LDKChannelHandshakeConfig this_ptr_conv;
22167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22168 this_ptr_conv.is_owned = false;
22169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22170 jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
22174 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
22175 LDKChannelHandshakeConfig this_ptr_conv;
22176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22177 this_ptr_conv.is_owned = false;
22178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22179 ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
22182 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
22183 LDKChannelHandshakeConfig this_ptr_conv;
22184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22185 this_ptr_conv.is_owned = false;
22186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22187 jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22191 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
22192 LDKChannelHandshakeConfig this_ptr_conv;
22193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22194 this_ptr_conv.is_owned = false;
22195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22196 ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22199 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, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
22200 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, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
22201 uint32_t ret_ref = 0;
22202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22205 ret_ref = (uintptr_t)ret_var.inner;
22206 if (ret_var.is_owned) {
22212 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22213 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22214 uint32_t ret_ref = 0;
22215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22218 ret_ref = (uintptr_t)ret_var.inner;
22219 if (ret_var.is_owned) {
22224 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
22225 LDKChannelHandshakeConfig arg_conv;
22226 arg_conv.inner = (void*)(arg & (~1));
22227 arg_conv.is_owned = false;
22228 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22229 uint32_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22233 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
22234 LDKChannelHandshakeConfig orig_conv;
22235 orig_conv.inner = (void*)(orig & (~1));
22236 orig_conv.is_owned = false;
22237 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22238 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22239 uint32_t ret_ref = 0;
22240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22243 ret_ref = (uintptr_t)ret_var.inner;
22244 if (ret_var.is_owned) {
22250 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
22251 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22252 uint32_t ret_ref = 0;
22253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22256 ret_ref = (uintptr_t)ret_var.inner;
22257 if (ret_var.is_owned) {
22263 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
22264 LDKChannelHandshakeLimits this_obj_conv;
22265 this_obj_conv.inner = (void*)(this_obj & (~1));
22266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22268 ChannelHandshakeLimits_free(this_obj_conv);
22271 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
22272 LDKChannelHandshakeLimits this_ptr_conv;
22273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22274 this_ptr_conv.is_owned = false;
22275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22276 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22280 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
22281 LDKChannelHandshakeLimits this_ptr_conv;
22282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22283 this_ptr_conv.is_owned = false;
22284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22285 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22288 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint32_t this_ptr) {
22289 LDKChannelHandshakeLimits this_ptr_conv;
22290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22291 this_ptr_conv.is_owned = false;
22292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22293 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
22297 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint32_t this_ptr, int64_t val) {
22298 LDKChannelHandshakeLimits this_ptr_conv;
22299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22300 this_ptr_conv.is_owned = false;
22301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22302 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
22305 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
22306 LDKChannelHandshakeLimits this_ptr_conv;
22307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22308 this_ptr_conv.is_owned = false;
22309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22310 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22314 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) {
22315 LDKChannelHandshakeLimits this_ptr_conv;
22316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22317 this_ptr_conv.is_owned = false;
22318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22319 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22322 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) {
22323 LDKChannelHandshakeLimits this_ptr_conv;
22324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22325 this_ptr_conv.is_owned = false;
22326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22327 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22331 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) {
22332 LDKChannelHandshakeLimits this_ptr_conv;
22333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22334 this_ptr_conv.is_owned = false;
22335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22336 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22339 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
22340 LDKChannelHandshakeLimits this_ptr_conv;
22341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22342 this_ptr_conv.is_owned = false;
22343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22344 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22348 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) {
22349 LDKChannelHandshakeLimits this_ptr_conv;
22350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22351 this_ptr_conv.is_owned = false;
22352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22353 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22356 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
22357 LDKChannelHandshakeLimits this_ptr_conv;
22358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22359 this_ptr_conv.is_owned = false;
22360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22361 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22365 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) {
22366 LDKChannelHandshakeLimits this_ptr_conv;
22367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22368 this_ptr_conv.is_owned = false;
22369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22370 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22373 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
22374 LDKChannelHandshakeLimits this_ptr_conv;
22375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22376 this_ptr_conv.is_owned = false;
22377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22378 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22382 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
22383 LDKChannelHandshakeLimits this_ptr_conv;
22384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22385 this_ptr_conv.is_owned = false;
22386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22387 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22390 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint32_t this_ptr) {
22391 LDKChannelHandshakeLimits this_ptr_conv;
22392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22393 this_ptr_conv.is_owned = false;
22394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22395 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
22399 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint32_t this_ptr, jboolean val) {
22400 LDKChannelHandshakeLimits this_ptr_conv;
22401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22402 this_ptr_conv.is_owned = false;
22403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22404 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
22407 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
22408 LDKChannelHandshakeLimits this_ptr_conv;
22409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22410 this_ptr_conv.is_owned = false;
22411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22412 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22416 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
22417 LDKChannelHandshakeLimits this_ptr_conv;
22418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22419 this_ptr_conv.is_owned = false;
22420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22421 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22424 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
22425 LDKChannelHandshakeLimits this_ptr_conv;
22426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22427 this_ptr_conv.is_owned = false;
22428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22429 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22433 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) {
22434 LDKChannelHandshakeLimits this_ptr_conv;
22435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22436 this_ptr_conv.is_owned = false;
22437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22438 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22441 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) {
22442 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);
22443 uint32_t ret_ref = 0;
22444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22447 ret_ref = (uintptr_t)ret_var.inner;
22448 if (ret_var.is_owned) {
22454 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22455 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22456 uint32_t ret_ref = 0;
22457 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22458 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22460 ret_ref = (uintptr_t)ret_var.inner;
22461 if (ret_var.is_owned) {
22466 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
22467 LDKChannelHandshakeLimits arg_conv;
22468 arg_conv.inner = (void*)(arg & (~1));
22469 arg_conv.is_owned = false;
22470 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22471 uint32_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22475 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
22476 LDKChannelHandshakeLimits orig_conv;
22477 orig_conv.inner = (void*)(orig & (~1));
22478 orig_conv.is_owned = false;
22479 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22480 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22481 uint32_t ret_ref = 0;
22482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22485 ret_ref = (uintptr_t)ret_var.inner;
22486 if (ret_var.is_owned) {
22492 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
22493 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22494 uint32_t ret_ref = 0;
22495 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22496 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22498 ret_ref = (uintptr_t)ret_var.inner;
22499 if (ret_var.is_owned) {
22505 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
22506 LDKChannelConfig this_obj_conv;
22507 this_obj_conv.inner = (void*)(this_obj & (~1));
22508 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22510 ChannelConfig_free(this_obj_conv);
22513 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
22514 LDKChannelConfig this_ptr_conv;
22515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22516 this_ptr_conv.is_owned = false;
22517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22518 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22522 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) {
22523 LDKChannelConfig this_ptr_conv;
22524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22525 this_ptr_conv.is_owned = false;
22526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22527 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22530 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
22531 LDKChannelConfig this_ptr_conv;
22532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22533 this_ptr_conv.is_owned = false;
22534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22535 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22539 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) {
22540 LDKChannelConfig this_ptr_conv;
22541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22542 this_ptr_conv.is_owned = false;
22543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22544 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22547 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
22548 LDKChannelConfig this_ptr_conv;
22549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22550 this_ptr_conv.is_owned = false;
22551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22552 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22556 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
22557 LDKChannelConfig this_ptr_conv;
22558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22559 this_ptr_conv.is_owned = false;
22560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22561 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22564 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) {
22565 LDKChannelConfig this_ptr_conv;
22566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22567 this_ptr_conv.is_owned = false;
22568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22569 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22573 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) {
22574 LDKChannelConfig this_ptr_conv;
22575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22576 this_ptr_conv.is_owned = false;
22577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22578 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22581 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) {
22582 LDKChannelConfig this_ptr_conv;
22583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22584 this_ptr_conv.is_owned = false;
22585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22586 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22590 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) {
22591 LDKChannelConfig this_ptr_conv;
22592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22593 this_ptr_conv.is_owned = false;
22594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22595 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22598 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, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
22599 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
22600 uint32_t ret_ref = 0;
22601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22604 ret_ref = (uintptr_t)ret_var.inner;
22605 if (ret_var.is_owned) {
22611 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22612 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22613 uint32_t ret_ref = 0;
22614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22617 ret_ref = (uintptr_t)ret_var.inner;
22618 if (ret_var.is_owned) {
22623 uint32_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
22624 LDKChannelConfig arg_conv;
22625 arg_conv.inner = (void*)(arg & (~1));
22626 arg_conv.is_owned = false;
22627 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22628 uint32_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
22632 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
22633 LDKChannelConfig orig_conv;
22634 orig_conv.inner = (void*)(orig & (~1));
22635 orig_conv.is_owned = false;
22636 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22637 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22638 uint32_t ret_ref = 0;
22639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22642 ret_ref = (uintptr_t)ret_var.inner;
22643 if (ret_var.is_owned) {
22649 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
22650 LDKChannelConfig ret_var = ChannelConfig_default();
22651 uint32_t ret_ref = 0;
22652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22655 ret_ref = (uintptr_t)ret_var.inner;
22656 if (ret_var.is_owned) {
22662 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
22663 LDKChannelConfig obj_conv;
22664 obj_conv.inner = (void*)(obj & (~1));
22665 obj_conv.is_owned = false;
22666 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22667 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
22668 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22669 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22670 CVec_u8Z_free(ret_var);
22674 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
22675 LDKu8slice ser_ref;
22676 ser_ref.datalen = ser->arr_len;
22677 ser_ref.data = ser->elems;
22678 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
22679 *ret_conv = ChannelConfig_read(ser_ref);
22681 return (uint32_t)ret_conv;
22684 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
22685 LDKUserConfig this_obj_conv;
22686 this_obj_conv.inner = (void*)(this_obj & (~1));
22687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22689 UserConfig_free(this_obj_conv);
22692 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint32_t this_ptr) {
22693 LDKUserConfig this_ptr_conv;
22694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22695 this_ptr_conv.is_owned = false;
22696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22697 LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
22698 uint32_t ret_ref = 0;
22699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22702 ret_ref = (uintptr_t)ret_var.inner;
22703 if (ret_var.is_owned) {
22709 void __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint32_t this_ptr, uint32_t val) {
22710 LDKUserConfig this_ptr_conv;
22711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22712 this_ptr_conv.is_owned = false;
22713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22714 LDKChannelHandshakeConfig val_conv;
22715 val_conv.inner = (void*)(val & (~1));
22716 val_conv.is_owned = (val & 1) || (val == 0);
22717 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22718 val_conv = ChannelHandshakeConfig_clone(&val_conv);
22719 UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
22722 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint32_t this_ptr) {
22723 LDKUserConfig this_ptr_conv;
22724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22725 this_ptr_conv.is_owned = false;
22726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22727 LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
22728 uint32_t ret_ref = 0;
22729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22732 ret_ref = (uintptr_t)ret_var.inner;
22733 if (ret_var.is_owned) {
22739 void __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint32_t this_ptr, uint32_t val) {
22740 LDKUserConfig this_ptr_conv;
22741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22742 this_ptr_conv.is_owned = false;
22743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22744 LDKChannelHandshakeLimits val_conv;
22745 val_conv.inner = (void*)(val & (~1));
22746 val_conv.is_owned = (val & 1) || (val == 0);
22747 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22748 val_conv = ChannelHandshakeLimits_clone(&val_conv);
22749 UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
22752 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint32_t this_ptr) {
22753 LDKUserConfig this_ptr_conv;
22754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22755 this_ptr_conv.is_owned = false;
22756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22757 LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
22758 uint32_t ret_ref = 0;
22759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22762 ret_ref = (uintptr_t)ret_var.inner;
22763 if (ret_var.is_owned) {
22769 void __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint32_t this_ptr, uint32_t val) {
22770 LDKUserConfig this_ptr_conv;
22771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22772 this_ptr_conv.is_owned = false;
22773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22774 LDKChannelConfig val_conv;
22775 val_conv.inner = (void*)(val & (~1));
22776 val_conv.is_owned = (val & 1) || (val == 0);
22777 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22778 val_conv = ChannelConfig_clone(&val_conv);
22779 UserConfig_set_channel_config(&this_ptr_conv, val_conv);
22782 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
22783 LDKUserConfig this_ptr_conv;
22784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22785 this_ptr_conv.is_owned = false;
22786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22787 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
22791 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) {
22792 LDKUserConfig this_ptr_conv;
22793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22794 this_ptr_conv.is_owned = false;
22795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22796 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
22799 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
22800 LDKUserConfig this_ptr_conv;
22801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22802 this_ptr_conv.is_owned = false;
22803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22804 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
22808 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
22809 LDKUserConfig this_ptr_conv;
22810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22811 this_ptr_conv.is_owned = false;
22812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22813 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
22816 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
22817 LDKUserConfig this_ptr_conv;
22818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22819 this_ptr_conv.is_owned = false;
22820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22821 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
22825 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
22826 LDKUserConfig this_ptr_conv;
22827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22828 this_ptr_conv.is_owned = false;
22829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22830 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
22833 uint32_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint32_t channel_handshake_config_arg, uint32_t channel_handshake_limits_arg, uint32_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
22834 LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
22835 channel_handshake_config_arg_conv.inner = (void*)(channel_handshake_config_arg & (~1));
22836 channel_handshake_config_arg_conv.is_owned = (channel_handshake_config_arg & 1) || (channel_handshake_config_arg == 0);
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
22838 channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
22839 LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
22840 channel_handshake_limits_arg_conv.inner = (void*)(channel_handshake_limits_arg & (~1));
22841 channel_handshake_limits_arg_conv.is_owned = (channel_handshake_limits_arg & 1) || (channel_handshake_limits_arg == 0);
22842 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
22843 channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
22844 LDKChannelConfig channel_config_arg_conv;
22845 channel_config_arg_conv.inner = (void*)(channel_config_arg & (~1));
22846 channel_config_arg_conv.is_owned = (channel_config_arg & 1) || (channel_config_arg == 0);
22847 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
22848 channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
22849 LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
22850 uint32_t ret_ref = 0;
22851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22854 ret_ref = (uintptr_t)ret_var.inner;
22855 if (ret_var.is_owned) {
22861 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
22862 LDKUserConfig ret_var = UserConfig_clone(arg);
22863 uint32_t ret_ref = 0;
22864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22867 ret_ref = (uintptr_t)ret_var.inner;
22868 if (ret_var.is_owned) {
22873 uint32_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
22874 LDKUserConfig arg_conv;
22875 arg_conv.inner = (void*)(arg & (~1));
22876 arg_conv.is_owned = false;
22877 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22878 uint32_t ret_conv = UserConfig_clone_ptr(&arg_conv);
22882 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
22883 LDKUserConfig orig_conv;
22884 orig_conv.inner = (void*)(orig & (~1));
22885 orig_conv.is_owned = false;
22886 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22887 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
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) {
22899 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
22900 LDKUserConfig ret_var = UserConfig_default();
22901 uint32_t ret_ref = 0;
22902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22905 ret_ref = (uintptr_t)ret_var.inner;
22906 if (ret_var.is_owned) {
22912 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
22913 LDKBestBlock this_obj_conv;
22914 this_obj_conv.inner = (void*)(this_obj & (~1));
22915 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22917 BestBlock_free(this_obj_conv);
22920 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
22921 LDKBestBlock ret_var = BestBlock_clone(arg);
22922 uint32_t ret_ref = 0;
22923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22926 ret_ref = (uintptr_t)ret_var.inner;
22927 if (ret_var.is_owned) {
22932 uint32_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
22933 LDKBestBlock arg_conv;
22934 arg_conv.inner = (void*)(arg & (~1));
22935 arg_conv.is_owned = false;
22936 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22937 uint32_t ret_conv = BestBlock_clone_ptr(&arg_conv);
22941 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
22942 LDKBestBlock orig_conv;
22943 orig_conv.inner = (void*)(orig & (~1));
22944 orig_conv.is_owned = false;
22945 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22946 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
22947 uint32_t ret_ref = 0;
22948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22951 ret_ref = (uintptr_t)ret_var.inner;
22952 if (ret_var.is_owned) {
22958 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
22959 LDKNetwork network_conv = LDKNetwork_from_js(network);
22960 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
22961 uint32_t ret_ref = 0;
22962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22965 ret_ref = (uintptr_t)ret_var.inner;
22966 if (ret_var.is_owned) {
22972 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
22973 LDKThirtyTwoBytes block_hash_ref;
22974 CHECK(block_hash->arr_len == 32);
22975 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
22976 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
22977 uint32_t ret_ref = 0;
22978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22981 ret_ref = (uintptr_t)ret_var.inner;
22982 if (ret_var.is_owned) {
22988 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
22989 LDKBestBlock this_arg_conv;
22990 this_arg_conv.inner = (void*)(this_arg & (~1));
22991 this_arg_conv.is_owned = false;
22992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22993 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22994 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
22998 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
22999 LDKBestBlock this_arg_conv;
23000 this_arg_conv.inner = (void*)(this_arg & (~1));
23001 this_arg_conv.is_owned = false;
23002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23003 int32_t ret_conv = BestBlock_height(&this_arg_conv);
23007 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
23008 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
23009 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
23013 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
23014 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
23018 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
23019 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
23023 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
23024 if ((this_ptr & 1) != 0) return;
23025 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23026 CHECK_ACCESS(this_ptr_ptr);
23027 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23028 FREE((void*)this_ptr);
23029 Access_free(this_ptr_conv);
23032 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
23033 if ((this_ptr & 1) != 0) return;
23034 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23035 CHECK_ACCESS(this_ptr_ptr);
23036 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23037 FREE((void*)this_ptr);
23038 Listen_free(this_ptr_conv);
23041 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
23042 if ((this_ptr & 1) != 0) return;
23043 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23044 CHECK_ACCESS(this_ptr_ptr);
23045 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23046 FREE((void*)this_ptr);
23047 Confirm_free(this_ptr_conv);
23050 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
23051 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
23052 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
23056 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
23057 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
23061 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
23062 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
23066 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
23067 if ((this_ptr & 1) != 0) return;
23068 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23069 CHECK_ACCESS(this_ptr_ptr);
23070 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23071 FREE((void*)this_ptr);
23072 Watch_free(this_ptr_conv);
23075 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
23076 if ((this_ptr & 1) != 0) return;
23077 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23078 CHECK_ACCESS(this_ptr_ptr);
23079 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23080 FREE((void*)this_ptr);
23081 Filter_free(this_ptr_conv);
23084 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
23085 LDKWatchedOutput this_obj_conv;
23086 this_obj_conv.inner = (void*)(this_obj & (~1));
23087 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23089 WatchedOutput_free(this_obj_conv);
23092 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
23093 LDKWatchedOutput this_ptr_conv;
23094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23095 this_ptr_conv.is_owned = false;
23096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23097 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23098 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
23102 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
23103 LDKWatchedOutput this_ptr_conv;
23104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23105 this_ptr_conv.is_owned = false;
23106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23107 LDKThirtyTwoBytes val_ref;
23108 CHECK(val->arr_len == 32);
23109 memcpy(val_ref.data, val->elems, 32); FREE(val);
23110 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23113 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
23114 LDKWatchedOutput this_ptr_conv;
23115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23116 this_ptr_conv.is_owned = false;
23117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23118 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23119 uint32_t ret_ref = 0;
23120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23123 ret_ref = (uintptr_t)ret_var.inner;
23124 if (ret_var.is_owned) {
23130 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
23131 LDKWatchedOutput this_ptr_conv;
23132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23133 this_ptr_conv.is_owned = false;
23134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23135 LDKOutPoint val_conv;
23136 val_conv.inner = (void*)(val & (~1));
23137 val_conv.is_owned = (val & 1) || (val == 0);
23138 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23139 val_conv = OutPoint_clone(&val_conv);
23140 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23143 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
23144 LDKWatchedOutput this_ptr_conv;
23145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23146 this_ptr_conv.is_owned = false;
23147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23148 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23149 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23150 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23154 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
23155 LDKWatchedOutput this_ptr_conv;
23156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23157 this_ptr_conv.is_owned = false;
23158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23159 LDKCVec_u8Z val_ref;
23160 val_ref.datalen = val->arr_len;
23161 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23162 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
23163 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23166 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) {
23167 LDKThirtyTwoBytes block_hash_arg_ref;
23168 CHECK(block_hash_arg->arr_len == 32);
23169 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
23170 LDKOutPoint outpoint_arg_conv;
23171 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23172 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23173 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23174 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23175 LDKCVec_u8Z script_pubkey_arg_ref;
23176 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
23177 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23178 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
23179 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23180 uint32_t ret_ref = 0;
23181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23184 ret_ref = (uintptr_t)ret_var.inner;
23185 if (ret_var.is_owned) {
23191 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23192 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23193 uint32_t ret_ref = 0;
23194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23197 ret_ref = (uintptr_t)ret_var.inner;
23198 if (ret_var.is_owned) {
23203 uint32_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
23204 LDKWatchedOutput arg_conv;
23205 arg_conv.inner = (void*)(arg & (~1));
23206 arg_conv.is_owned = false;
23207 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23208 uint32_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
23212 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
23213 LDKWatchedOutput orig_conv;
23214 orig_conv.inner = (void*)(orig & (~1));
23215 orig_conv.is_owned = false;
23216 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23217 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23218 uint32_t ret_ref = 0;
23219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23222 ret_ref = (uintptr_t)ret_var.inner;
23223 if (ret_var.is_owned) {
23229 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
23230 LDKWatchedOutput o_conv;
23231 o_conv.inner = (void*)(o & (~1));
23232 o_conv.is_owned = false;
23233 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23234 int64_t ret_conv = WatchedOutput_hash(&o_conv);
23238 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
23239 if ((this_ptr & 1) != 0) return;
23240 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23241 CHECK_ACCESS(this_ptr_ptr);
23242 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23243 FREE((void*)this_ptr);
23244 BroadcasterInterface_free(this_ptr_conv);
23247 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
23248 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
23249 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
23253 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
23254 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
23258 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
23259 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
23263 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
23264 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
23268 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
23269 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
23270 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
23271 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
23275 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
23276 if ((this_ptr & 1) != 0) return;
23277 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23278 CHECK_ACCESS(this_ptr_ptr);
23279 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23280 FREE((void*)this_ptr);
23281 FeeEstimator_free(this_ptr_conv);
23284 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
23285 LDKMonitorUpdateId this_obj_conv;
23286 this_obj_conv.inner = (void*)(this_obj & (~1));
23287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23289 MonitorUpdateId_free(this_obj_conv);
23292 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23293 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23294 uint32_t ret_ref = 0;
23295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23298 ret_ref = (uintptr_t)ret_var.inner;
23299 if (ret_var.is_owned) {
23304 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
23305 LDKMonitorUpdateId arg_conv;
23306 arg_conv.inner = (void*)(arg & (~1));
23307 arg_conv.is_owned = false;
23308 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23309 uint32_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
23313 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
23314 LDKMonitorUpdateId orig_conv;
23315 orig_conv.inner = (void*)(orig & (~1));
23316 orig_conv.is_owned = false;
23317 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23318 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23319 uint32_t ret_ref = 0;
23320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23323 ret_ref = (uintptr_t)ret_var.inner;
23324 if (ret_var.is_owned) {
23330 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
23331 LDKMonitorUpdateId o_conv;
23332 o_conv.inner = (void*)(o & (~1));
23333 o_conv.is_owned = false;
23334 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23335 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
23339 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
23340 LDKMonitorUpdateId a_conv;
23341 a_conv.inner = (void*)(a & (~1));
23342 a_conv.is_owned = false;
23343 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23344 LDKMonitorUpdateId b_conv;
23345 b_conv.inner = (void*)(b & (~1));
23346 b_conv.is_owned = false;
23347 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23348 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
23352 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
23353 if ((this_ptr & 1) != 0) return;
23354 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23355 CHECK_ACCESS(this_ptr_ptr);
23356 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23357 FREE((void*)this_ptr);
23358 Persist_free(this_ptr_conv);
23361 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
23362 LDKLockedChannelMonitor this_obj_conv;
23363 this_obj_conv.inner = (void*)(this_obj & (~1));
23364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23366 LockedChannelMonitor_free(this_obj_conv);
23369 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
23370 LDKChainMonitor this_obj_conv;
23371 this_obj_conv.inner = (void*)(this_obj & (~1));
23372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23374 ChainMonitor_free(this_obj_conv);
23377 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) {
23378 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
23379 CHECK_ACCESS(chain_source_ptr);
23380 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23381 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
23382 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23383 // Manually implement clone for Java trait instances
23384 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23385 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23386 LDKFilter_JCalls_cloned(&chain_source_conv.some);
23389 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23390 CHECK_ACCESS(broadcaster_ptr);
23391 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23392 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23393 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23394 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23396 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23397 CHECK_ACCESS(logger_ptr);
23398 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23399 if (logger_conv.free == LDKLogger_JCalls_free) {
23400 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23401 LDKLogger_JCalls_cloned(&logger_conv);
23403 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
23404 CHECK_ACCESS(feeest_ptr);
23405 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23406 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23407 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23408 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23410 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
23411 CHECK_ACCESS(persister_ptr);
23412 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23413 if (persister_conv.free == LDKPersist_JCalls_free) {
23414 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23415 LDKPersist_JCalls_cloned(&persister_conv);
23417 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23418 uint32_t ret_ref = 0;
23419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23422 ret_ref = (uintptr_t)ret_var.inner;
23423 if (ret_var.is_owned) {
23429 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
23430 LDKChainMonitor this_arg_conv;
23431 this_arg_conv.inner = (void*)(this_arg & (~1));
23432 this_arg_conv.is_owned = false;
23433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23434 LDKCVec_ChannelDetailsZ ignored_channels_constr;
23435 ignored_channels_constr.datalen = ignored_channels->arr_len;
23436 if (ignored_channels_constr.datalen > 0)
23437 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23439 ignored_channels_constr.data = NULL;
23440 uint32_t* ignored_channels_vals = ignored_channels->elems;
23441 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23442 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
23443 LDKChannelDetails ignored_channels_conv_16_conv;
23444 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
23445 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
23446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23447 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23448 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23450 FREE(ignored_channels);
23451 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23452 uint32_tArray ret_arr = NULL;
23453 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23454 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23455 for (size_t j = 0; j < ret_var.datalen; j++) {
23456 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23457 *ret_conv_9_copy = ret_var.data[j];
23458 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
23459 ret_arr_ptr[j] = ret_conv_9_ref;
23462 FREE(ret_var.data);
23466 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
23467 LDKChainMonitor this_arg_conv;
23468 this_arg_conv.inner = (void*)(this_arg & (~1));
23469 this_arg_conv.is_owned = false;
23470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23471 LDKOutPoint funding_txo_conv;
23472 funding_txo_conv.inner = (void*)(funding_txo & (~1));
23473 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
23474 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23475 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23476 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23477 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23478 return (uint32_t)ret_conv;
23481 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
23482 LDKChainMonitor this_arg_conv;
23483 this_arg_conv.inner = (void*)(this_arg & (~1));
23484 this_arg_conv.is_owned = false;
23485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23486 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23487 uint32_tArray ret_arr = NULL;
23488 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23489 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23490 for (size_t k = 0; k < ret_var.datalen; k++) {
23491 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23492 uint32_t ret_conv_10_ref = 0;
23493 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23494 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23496 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
23497 if (ret_conv_10_var.is_owned) {
23498 ret_conv_10_ref |= 1;
23500 ret_arr_ptr[k] = ret_conv_10_ref;
23503 FREE(ret_var.data);
23507 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) {
23508 LDKChainMonitor this_arg_conv;
23509 this_arg_conv.inner = (void*)(this_arg & (~1));
23510 this_arg_conv.is_owned = false;
23511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23512 LDKOutPoint funding_txo_conv;
23513 funding_txo_conv.inner = (void*)(funding_txo & (~1));
23514 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
23515 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23516 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23517 LDKMonitorUpdateId completed_update_id_conv;
23518 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
23519 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
23520 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23521 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23522 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23523 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23524 return (uint32_t)ret_conv;
23527 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
23528 LDKChainMonitor this_arg_conv;
23529 this_arg_conv.inner = (void*)(this_arg & (~1));
23530 this_arg_conv.is_owned = false;
23531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23532 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23533 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23534 return (uint32_t)ret_ret;
23537 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
23538 LDKChainMonitor this_arg_conv;
23539 this_arg_conv.inner = (void*)(this_arg & (~1));
23540 this_arg_conv.is_owned = false;
23541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23542 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23543 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23544 return (uint32_t)ret_ret;
23547 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
23548 LDKChainMonitor this_arg_conv;
23549 this_arg_conv.inner = (void*)(this_arg & (~1));
23550 this_arg_conv.is_owned = false;
23551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23552 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23553 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23554 return (uint32_t)ret_ret;
23557 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
23558 LDKChainMonitor this_arg_conv;
23559 this_arg_conv.inner = (void*)(this_arg & (~1));
23560 this_arg_conv.is_owned = false;
23561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23562 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23563 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23564 return (uint32_t)ret_ret;
23567 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
23568 LDKChannelMonitorUpdate this_obj_conv;
23569 this_obj_conv.inner = (void*)(this_obj & (~1));
23570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23572 ChannelMonitorUpdate_free(this_obj_conv);
23575 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
23576 LDKChannelMonitorUpdate this_ptr_conv;
23577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23578 this_ptr_conv.is_owned = false;
23579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23580 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23584 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
23585 LDKChannelMonitorUpdate this_ptr_conv;
23586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23587 this_ptr_conv.is_owned = false;
23588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23589 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23592 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23593 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23594 uint32_t ret_ref = 0;
23595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23598 ret_ref = (uintptr_t)ret_var.inner;
23599 if (ret_var.is_owned) {
23604 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
23605 LDKChannelMonitorUpdate arg_conv;
23606 arg_conv.inner = (void*)(arg & (~1));
23607 arg_conv.is_owned = false;
23608 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23609 uint32_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23613 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
23614 LDKChannelMonitorUpdate orig_conv;
23615 orig_conv.inner = (void*)(orig & (~1));
23616 orig_conv.is_owned = false;
23617 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23618 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23619 uint32_t ret_ref = 0;
23620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23623 ret_ref = (uintptr_t)ret_var.inner;
23624 if (ret_var.is_owned) {
23630 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
23631 LDKChannelMonitorUpdate obj_conv;
23632 obj_conv.inner = (void*)(obj & (~1));
23633 obj_conv.is_owned = false;
23634 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23635 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23636 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23637 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23638 CVec_u8Z_free(ret_var);
23642 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
23643 LDKu8slice ser_ref;
23644 ser_ref.datalen = ser->arr_len;
23645 ser_ref.data = ser->elems;
23646 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23647 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23649 return (uint32_t)ret_conv;
23652 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
23653 if ((this_ptr & 1) != 0) return;
23654 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23655 CHECK_ACCESS(this_ptr_ptr);
23656 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23657 FREE((void*)this_ptr);
23658 MonitorEvent_free(this_ptr_conv);
23661 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23662 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23663 *ret_copy = MonitorEvent_clone(arg);
23664 uint32_t ret_ref = (uintptr_t)ret_copy;
23667 uint32_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
23668 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
23669 uint32_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
23673 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
23674 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
23675 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23676 *ret_copy = MonitorEvent_clone(orig_conv);
23677 uint32_t ret_ref = (uintptr_t)ret_copy;
23681 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
23682 LDKHTLCUpdate a_conv;
23683 a_conv.inner = (void*)(a & (~1));
23684 a_conv.is_owned = (a & 1) || (a == 0);
23685 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23686 a_conv = HTLCUpdate_clone(&a_conv);
23687 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23688 *ret_copy = MonitorEvent_htlcevent(a_conv);
23689 uint32_t ret_ref = (uintptr_t)ret_copy;
23693 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
23694 LDKOutPoint a_conv;
23695 a_conv.inner = (void*)(a & (~1));
23696 a_conv.is_owned = (a & 1) || (a == 0);
23697 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23698 a_conv = OutPoint_clone(&a_conv);
23699 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23700 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
23701 uint32_t ret_ref = (uintptr_t)ret_copy;
23705 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
23706 LDKOutPoint funding_txo_conv;
23707 funding_txo_conv.inner = (void*)(funding_txo & (~1));
23708 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
23709 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23710 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23711 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23712 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
23713 uint32_t ret_ref = (uintptr_t)ret_copy;
23717 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
23718 LDKOutPoint a_conv;
23719 a_conv.inner = (void*)(a & (~1));
23720 a_conv.is_owned = (a & 1) || (a == 0);
23721 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23722 a_conv = OutPoint_clone(&a_conv);
23723 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23724 *ret_copy = MonitorEvent_update_failed(a_conv);
23725 uint32_t ret_ref = (uintptr_t)ret_copy;
23729 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
23730 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
23731 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
23732 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23733 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23734 CVec_u8Z_free(ret_var);
23738 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
23739 LDKu8slice ser_ref;
23740 ser_ref.datalen = ser->arr_len;
23741 ser_ref.data = ser->elems;
23742 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23743 *ret_conv = MonitorEvent_read(ser_ref);
23745 return (uint32_t)ret_conv;
23748 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
23749 LDKHTLCUpdate this_obj_conv;
23750 this_obj_conv.inner = (void*)(this_obj & (~1));
23751 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23753 HTLCUpdate_free(this_obj_conv);
23756 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
23757 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
23758 uint32_t ret_ref = 0;
23759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23762 ret_ref = (uintptr_t)ret_var.inner;
23763 if (ret_var.is_owned) {
23768 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
23769 LDKHTLCUpdate arg_conv;
23770 arg_conv.inner = (void*)(arg & (~1));
23771 arg_conv.is_owned = false;
23772 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23773 uint32_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
23777 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
23778 LDKHTLCUpdate orig_conv;
23779 orig_conv.inner = (void*)(orig & (~1));
23780 orig_conv.is_owned = false;
23781 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23782 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
23783 uint32_t ret_ref = 0;
23784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23787 ret_ref = (uintptr_t)ret_var.inner;
23788 if (ret_var.is_owned) {
23794 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
23795 LDKHTLCUpdate obj_conv;
23796 obj_conv.inner = (void*)(obj & (~1));
23797 obj_conv.is_owned = false;
23798 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23799 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
23800 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23801 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23802 CVec_u8Z_free(ret_var);
23806 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
23807 LDKu8slice ser_ref;
23808 ser_ref.datalen = ser->arr_len;
23809 ser_ref.data = ser->elems;
23810 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23811 *ret_conv = HTLCUpdate_read(ser_ref);
23813 return (uint32_t)ret_conv;
23816 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
23817 if ((this_ptr & 1) != 0) return;
23818 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23819 CHECK_ACCESS(this_ptr_ptr);
23820 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
23821 FREE((void*)this_ptr);
23822 Balance_free(this_ptr_conv);
23825 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
23826 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23827 *ret_copy = Balance_clone(arg);
23828 uint32_t ret_ref = (uintptr_t)ret_copy;
23831 uint32_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
23832 LDKBalance* arg_conv = (LDKBalance*)arg;
23833 uint32_t ret_conv = Balance_clone_ptr(arg_conv);
23837 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
23838 LDKBalance* orig_conv = (LDKBalance*)orig;
23839 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23840 *ret_copy = Balance_clone(orig_conv);
23841 uint32_t ret_ref = (uintptr_t)ret_copy;
23845 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
23846 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23847 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
23848 uint32_t ret_ref = (uintptr_t)ret_copy;
23852 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
23853 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23854 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
23855 uint32_t ret_ref = (uintptr_t)ret_copy;
23859 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
23860 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23861 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
23862 uint32_t ret_ref = (uintptr_t)ret_copy;
23866 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) {
23867 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23868 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
23869 uint32_t ret_ref = (uintptr_t)ret_copy;
23873 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
23874 LDKBalance* a_conv = (LDKBalance*)a;
23875 LDKBalance* b_conv = (LDKBalance*)b;
23876 jboolean ret_conv = Balance_eq(a_conv, b_conv);
23880 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
23881 LDKChannelMonitor this_obj_conv;
23882 this_obj_conv.inner = (void*)(this_obj & (~1));
23883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23885 ChannelMonitor_free(this_obj_conv);
23888 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
23889 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
23890 uint32_t ret_ref = 0;
23891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23894 ret_ref = (uintptr_t)ret_var.inner;
23895 if (ret_var.is_owned) {
23900 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
23901 LDKChannelMonitor arg_conv;
23902 arg_conv.inner = (void*)(arg & (~1));
23903 arg_conv.is_owned = false;
23904 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23905 uint32_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
23909 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
23910 LDKChannelMonitor orig_conv;
23911 orig_conv.inner = (void*)(orig & (~1));
23912 orig_conv.is_owned = false;
23913 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23914 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
23915 uint32_t ret_ref = 0;
23916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23919 ret_ref = (uintptr_t)ret_var.inner;
23920 if (ret_var.is_owned) {
23926 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
23927 LDKChannelMonitor obj_conv;
23928 obj_conv.inner = (void*)(obj & (~1));
23929 obj_conv.is_owned = false;
23930 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23931 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
23932 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23933 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23934 CVec_u8Z_free(ret_var);
23938 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) {
23939 LDKChannelMonitor this_arg_conv;
23940 this_arg_conv.inner = (void*)(this_arg & (~1));
23941 this_arg_conv.is_owned = false;
23942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23943 LDKChannelMonitorUpdate updates_conv;
23944 updates_conv.inner = (void*)(updates & (~1));
23945 updates_conv.is_owned = false;
23946 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23947 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23948 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
23949 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
23950 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23951 CHECK_ACCESS(fee_estimator_ptr);
23952 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23953 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23954 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23955 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23957 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23958 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23959 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23960 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23961 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
23962 return (uint32_t)ret_conv;
23965 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
23966 LDKChannelMonitor this_arg_conv;
23967 this_arg_conv.inner = (void*)(this_arg & (~1));
23968 this_arg_conv.is_owned = false;
23969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23970 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
23974 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
23975 LDKChannelMonitor this_arg_conv;
23976 this_arg_conv.inner = (void*)(this_arg & (~1));
23977 this_arg_conv.is_owned = false;
23978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23979 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
23980 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
23981 return ((uint32_t)ret_conv);
23984 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
23985 LDKChannelMonitor this_arg_conv;
23986 this_arg_conv.inner = (void*)(this_arg & (~1));
23987 this_arg_conv.is_owned = false;
23988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23989 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
23990 uint32_tArray ret_arr = NULL;
23991 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23992 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23993 for (size_t o = 0; o < ret_var.datalen; o++) {
23994 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
23995 *ret_conv_40_conv = ret_var.data[o];
23996 ret_arr_ptr[o] = ((uint32_t)ret_conv_40_conv);
23999 FREE(ret_var.data);
24003 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
24004 LDKChannelMonitor this_arg_conv;
24005 this_arg_conv.inner = (void*)(this_arg & (~1));
24006 this_arg_conv.is_owned = false;
24007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24008 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
24009 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
24010 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24011 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24014 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) {
24015 LDKChannelMonitor this_arg_conv;
24016 this_arg_conv.inner = (void*)(this_arg & (~1));
24017 this_arg_conv.is_owned = false;
24018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24019 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24020 uint32_tArray ret_arr = NULL;
24021 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24022 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24023 for (size_t o = 0; o < ret_var.datalen; o++) {
24024 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24025 *ret_conv_14_copy = ret_var.data[o];
24026 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
24027 ret_arr_ptr[o] = ret_conv_14_ref;
24030 FREE(ret_var.data);
24034 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
24035 LDKChannelMonitor this_arg_conv;
24036 this_arg_conv.inner = (void*)(this_arg & (~1));
24037 this_arg_conv.is_owned = false;
24038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24039 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24040 uint32_tArray ret_arr = NULL;
24041 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24042 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24043 for (size_t h = 0; h < ret_var.datalen; h++) {
24044 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24045 *ret_conv_7_copy = ret_var.data[h];
24046 uint32_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
24047 ret_arr_ptr[h] = ret_conv_7_ref;
24050 FREE(ret_var.data);
24054 int8_tArray __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint32_t this_arg) {
24055 LDKChannelMonitor this_arg_conv;
24056 this_arg_conv.inner = (void*)(this_arg & (~1));
24057 this_arg_conv.is_owned = false;
24058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24059 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24060 memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
24064 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) {
24065 LDKChannelMonitor this_arg_conv;
24066 this_arg_conv.inner = (void*)(this_arg & (~1));
24067 this_arg_conv.is_owned = false;
24068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24069 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24070 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
24071 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24072 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24073 ptrArray ret_arr = NULL;
24074 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24075 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
24076 for (size_t m = 0; m < ret_var.datalen; m++) {
24077 LDKTransaction ret_conv_12_var = ret_var.data[m];
24078 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
24079 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
24080 Transaction_free(ret_conv_12_var);
24081 ret_arr_ptr[m] = ret_conv_12_arr;
24084 FREE(ret_var.data);
24088 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) {
24089 LDKChannelMonitor this_arg_conv;
24090 this_arg_conv.inner = (void*)(this_arg & (~1));
24091 this_arg_conv.is_owned = false;
24092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24093 unsigned char header_arr[80];
24094 CHECK(header->arr_len == 80);
24095 memcpy(header_arr, header->elems, 80); FREE(header);
24096 unsigned char (*header_ref)[80] = &header_arr;
24097 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24098 txdata_constr.datalen = txdata->arr_len;
24099 if (txdata_constr.datalen > 0)
24100 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24102 txdata_constr.data = NULL;
24103 uint32_t* txdata_vals = txdata->elems;
24104 for (size_t c = 0; c < txdata_constr.datalen; c++) {
24105 uint32_t txdata_conv_28 = txdata_vals[c];
24106 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
24107 CHECK_ACCESS(txdata_conv_28_ptr);
24108 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24109 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
24110 txdata_constr.data[c] = txdata_conv_28_conv;
24113 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24114 CHECK_ACCESS(broadcaster_ptr);
24115 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24116 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24118 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24120 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24121 CHECK_ACCESS(fee_estimator_ptr);
24122 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24123 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24124 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24125 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24127 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24128 CHECK_ACCESS(logger_ptr);
24129 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24130 if (logger_conv.free == LDKLogger_JCalls_free) {
24131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24132 LDKLogger_JCalls_cloned(&logger_conv);
24134 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);
24135 uint32_tArray ret_arr = NULL;
24136 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24137 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24138 for (size_t n = 0; n < ret_var.datalen; n++) {
24139 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24140 *ret_conv_39_conv = ret_var.data[n];
24141 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
24144 FREE(ret_var.data);
24148 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) {
24149 LDKChannelMonitor this_arg_conv;
24150 this_arg_conv.inner = (void*)(this_arg & (~1));
24151 this_arg_conv.is_owned = false;
24152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24153 unsigned char header_arr[80];
24154 CHECK(header->arr_len == 80);
24155 memcpy(header_arr, header->elems, 80); FREE(header);
24156 unsigned char (*header_ref)[80] = &header_arr;
24157 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24158 CHECK_ACCESS(broadcaster_ptr);
24159 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24160 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24161 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24162 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24164 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24165 CHECK_ACCESS(fee_estimator_ptr);
24166 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24167 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24168 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24169 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24171 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24172 CHECK_ACCESS(logger_ptr);
24173 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24174 if (logger_conv.free == LDKLogger_JCalls_free) {
24175 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24176 LDKLogger_JCalls_cloned(&logger_conv);
24178 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24181 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) {
24182 LDKChannelMonitor this_arg_conv;
24183 this_arg_conv.inner = (void*)(this_arg & (~1));
24184 this_arg_conv.is_owned = false;
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24186 unsigned char header_arr[80];
24187 CHECK(header->arr_len == 80);
24188 memcpy(header_arr, header->elems, 80); FREE(header);
24189 unsigned char (*header_ref)[80] = &header_arr;
24190 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24191 txdata_constr.datalen = txdata->arr_len;
24192 if (txdata_constr.datalen > 0)
24193 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24195 txdata_constr.data = NULL;
24196 uint32_t* txdata_vals = txdata->elems;
24197 for (size_t c = 0; c < txdata_constr.datalen; c++) {
24198 uint32_t txdata_conv_28 = txdata_vals[c];
24199 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
24200 CHECK_ACCESS(txdata_conv_28_ptr);
24201 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24202 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
24203 txdata_constr.data[c] = txdata_conv_28_conv;
24206 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24207 CHECK_ACCESS(broadcaster_ptr);
24208 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24209 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24210 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24211 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24213 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24214 CHECK_ACCESS(fee_estimator_ptr);
24215 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24216 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24217 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24218 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24220 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24221 CHECK_ACCESS(logger_ptr);
24222 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24223 if (logger_conv.free == LDKLogger_JCalls_free) {
24224 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24225 LDKLogger_JCalls_cloned(&logger_conv);
24227 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);
24228 uint32_tArray ret_arr = NULL;
24229 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24230 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24231 for (size_t n = 0; n < ret_var.datalen; n++) {
24232 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24233 *ret_conv_39_conv = ret_var.data[n];
24234 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
24237 FREE(ret_var.data);
24241 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) {
24242 LDKChannelMonitor this_arg_conv;
24243 this_arg_conv.inner = (void*)(this_arg & (~1));
24244 this_arg_conv.is_owned = false;
24245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24246 unsigned char txid_arr[32];
24247 CHECK(txid->arr_len == 32);
24248 memcpy(txid_arr, txid->elems, 32); FREE(txid);
24249 unsigned char (*txid_ref)[32] = &txid_arr;
24250 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24251 CHECK_ACCESS(broadcaster_ptr);
24252 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24253 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24254 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24255 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24257 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24258 CHECK_ACCESS(fee_estimator_ptr);
24259 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24260 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24261 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24262 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24264 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24265 CHECK_ACCESS(logger_ptr);
24266 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24267 if (logger_conv.free == LDKLogger_JCalls_free) {
24268 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24269 LDKLogger_JCalls_cloned(&logger_conv);
24271 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24274 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) {
24275 LDKChannelMonitor this_arg_conv;
24276 this_arg_conv.inner = (void*)(this_arg & (~1));
24277 this_arg_conv.is_owned = false;
24278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24279 unsigned char header_arr[80];
24280 CHECK(header->arr_len == 80);
24281 memcpy(header_arr, header->elems, 80); FREE(header);
24282 unsigned char (*header_ref)[80] = &header_arr;
24283 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24284 CHECK_ACCESS(broadcaster_ptr);
24285 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24286 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24287 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24288 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24290 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24291 CHECK_ACCESS(fee_estimator_ptr);
24292 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24293 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24294 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24295 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24297 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24298 CHECK_ACCESS(logger_ptr);
24299 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24300 if (logger_conv.free == LDKLogger_JCalls_free) {
24301 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24302 LDKLogger_JCalls_cloned(&logger_conv);
24304 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24305 uint32_tArray ret_arr = NULL;
24306 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24307 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24308 for (size_t n = 0; n < ret_var.datalen; n++) {
24309 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24310 *ret_conv_39_conv = ret_var.data[n];
24311 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
24314 FREE(ret_var.data);
24318 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
24319 LDKChannelMonitor this_arg_conv;
24320 this_arg_conv.inner = (void*)(this_arg & (~1));
24321 this_arg_conv.is_owned = false;
24322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24323 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24324 ptrArray ret_arr = NULL;
24325 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24326 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
24327 for (size_t m = 0; m < ret_var.datalen; m++) {
24328 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
24329 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
24330 ret_arr_ptr[m] = ret_conv_12_arr;
24333 FREE(ret_var.data);
24337 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
24338 LDKChannelMonitor this_arg_conv;
24339 this_arg_conv.inner = (void*)(this_arg & (~1));
24340 this_arg_conv.is_owned = false;
24341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24342 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24343 uint32_t ret_ref = 0;
24344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24347 ret_ref = (uintptr_t)ret_var.inner;
24348 if (ret_var.is_owned) {
24354 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
24355 LDKChannelMonitor this_arg_conv;
24356 this_arg_conv.inner = (void*)(this_arg & (~1));
24357 this_arg_conv.is_owned = false;
24358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24359 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24360 uint32_tArray ret_arr = NULL;
24361 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24362 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24363 for (size_t j = 0; j < ret_var.datalen; j++) {
24364 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24365 *ret_conv_9_copy = ret_var.data[j];
24366 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
24367 ret_arr_ptr[j] = ret_conv_9_ref;
24370 FREE(ret_var.data);
24374 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
24375 LDKu8slice ser_ref;
24376 ser_ref.datalen = ser->arr_len;
24377 ser_ref.data = ser->elems;
24378 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
24379 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
24380 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24381 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24382 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24384 return (uint32_t)ret_conv;
24387 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
24388 LDKOutPoint this_obj_conv;
24389 this_obj_conv.inner = (void*)(this_obj & (~1));
24390 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24392 OutPoint_free(this_obj_conv);
24395 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
24396 LDKOutPoint this_ptr_conv;
24397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24398 this_ptr_conv.is_owned = false;
24399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24400 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24401 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
24405 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
24406 LDKOutPoint this_ptr_conv;
24407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24408 this_ptr_conv.is_owned = false;
24409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24410 LDKThirtyTwoBytes val_ref;
24411 CHECK(val->arr_len == 32);
24412 memcpy(val_ref.data, val->elems, 32); FREE(val);
24413 OutPoint_set_txid(&this_ptr_conv, val_ref);
24416 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
24417 LDKOutPoint this_ptr_conv;
24418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24419 this_ptr_conv.is_owned = false;
24420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24421 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
24425 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
24426 LDKOutPoint this_ptr_conv;
24427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24428 this_ptr_conv.is_owned = false;
24429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24430 OutPoint_set_index(&this_ptr_conv, val);
24433 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
24434 LDKThirtyTwoBytes txid_arg_ref;
24435 CHECK(txid_arg->arr_len == 32);
24436 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
24437 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24438 uint32_t ret_ref = 0;
24439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24442 ret_ref = (uintptr_t)ret_var.inner;
24443 if (ret_var.is_owned) {
24449 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24450 LDKOutPoint ret_var = OutPoint_clone(arg);
24451 uint32_t ret_ref = 0;
24452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24455 ret_ref = (uintptr_t)ret_var.inner;
24456 if (ret_var.is_owned) {
24461 uint32_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
24462 LDKOutPoint arg_conv;
24463 arg_conv.inner = (void*)(arg & (~1));
24464 arg_conv.is_owned = false;
24465 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24466 uint32_t ret_conv = OutPoint_clone_ptr(&arg_conv);
24470 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
24471 LDKOutPoint orig_conv;
24472 orig_conv.inner = (void*)(orig & (~1));
24473 orig_conv.is_owned = false;
24474 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24475 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24476 uint32_t ret_ref = 0;
24477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24480 ret_ref = (uintptr_t)ret_var.inner;
24481 if (ret_var.is_owned) {
24487 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
24488 LDKOutPoint a_conv;
24489 a_conv.inner = (void*)(a & (~1));
24490 a_conv.is_owned = false;
24491 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24492 LDKOutPoint b_conv;
24493 b_conv.inner = (void*)(b & (~1));
24494 b_conv.is_owned = false;
24495 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24496 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
24500 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
24501 LDKOutPoint o_conv;
24502 o_conv.inner = (void*)(o & (~1));
24503 o_conv.is_owned = false;
24504 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24505 int64_t ret_conv = OutPoint_hash(&o_conv);
24509 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
24510 LDKOutPoint this_arg_conv;
24511 this_arg_conv.inner = (void*)(this_arg & (~1));
24512 this_arg_conv.is_owned = false;
24513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24514 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24515 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
24519 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
24520 LDKOutPoint obj_conv;
24521 obj_conv.inner = (void*)(obj & (~1));
24522 obj_conv.is_owned = false;
24523 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24524 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24525 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24526 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24527 CVec_u8Z_free(ret_var);
24531 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
24532 LDKu8slice ser_ref;
24533 ser_ref.datalen = ser->arr_len;
24534 ser_ref.data = ser->elems;
24535 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24536 *ret_conv = OutPoint_read(ser_ref);
24538 return (uint32_t)ret_conv;
24541 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
24542 LDKDelayedPaymentOutputDescriptor this_obj_conv;
24543 this_obj_conv.inner = (void*)(this_obj & (~1));
24544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24546 DelayedPaymentOutputDescriptor_free(this_obj_conv);
24549 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
24550 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24552 this_ptr_conv.is_owned = false;
24553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24554 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24555 uint32_t ret_ref = 0;
24556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24559 ret_ref = (uintptr_t)ret_var.inner;
24560 if (ret_var.is_owned) {
24566 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
24567 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24569 this_ptr_conv.is_owned = false;
24570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24571 LDKOutPoint val_conv;
24572 val_conv.inner = (void*)(val & (~1));
24573 val_conv.is_owned = (val & 1) || (val == 0);
24574 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24575 val_conv = OutPoint_clone(&val_conv);
24576 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24579 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
24580 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24582 this_ptr_conv.is_owned = false;
24583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24584 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24585 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24589 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24590 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24592 this_ptr_conv.is_owned = false;
24593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24594 LDKPublicKey val_ref;
24595 CHECK(val->arr_len == 33);
24596 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24597 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24600 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
24601 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24603 this_ptr_conv.is_owned = false;
24604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24605 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24609 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
24610 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24612 this_ptr_conv.is_owned = false;
24613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24614 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24617 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
24618 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24620 this_ptr_conv.is_owned = false;
24621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24622 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24623 CHECK_ACCESS(val_ptr);
24624 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24625 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
24626 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24629 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
24630 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24632 this_ptr_conv.is_owned = false;
24633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24634 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24635 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
24639 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
24640 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24642 this_ptr_conv.is_owned = false;
24643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24644 LDKPublicKey val_ref;
24645 CHECK(val->arr_len == 33);
24646 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24647 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24650 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
24651 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24653 this_ptr_conv.is_owned = false;
24654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24655 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24656 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24660 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
24661 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24663 this_ptr_conv.is_owned = false;
24664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24665 LDKThirtyTwoBytes val_ref;
24666 CHECK(val->arr_len == 32);
24667 memcpy(val_ref.data, val->elems, 32); FREE(val);
24668 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24671 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
24672 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24674 this_ptr_conv.is_owned = false;
24675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24676 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24680 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
24681 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24683 this_ptr_conv.is_owned = false;
24684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24685 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24688 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) {
24689 LDKOutPoint outpoint_arg_conv;
24690 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
24691 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
24692 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24693 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24694 LDKPublicKey per_commitment_point_arg_ref;
24695 CHECK(per_commitment_point_arg->arr_len == 33);
24696 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
24697 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
24698 CHECK_ACCESS(output_arg_ptr);
24699 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
24700 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
24701 LDKPublicKey revocation_pubkey_arg_ref;
24702 CHECK(revocation_pubkey_arg->arr_len == 33);
24703 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
24704 LDKThirtyTwoBytes channel_keys_id_arg_ref;
24705 CHECK(channel_keys_id_arg->arr_len == 32);
24706 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
24707 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);
24708 uint32_t ret_ref = 0;
24709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24712 ret_ref = (uintptr_t)ret_var.inner;
24713 if (ret_var.is_owned) {
24719 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
24720 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
24721 uint32_t ret_ref = 0;
24722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24725 ret_ref = (uintptr_t)ret_var.inner;
24726 if (ret_var.is_owned) {
24731 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
24732 LDKDelayedPaymentOutputDescriptor arg_conv;
24733 arg_conv.inner = (void*)(arg & (~1));
24734 arg_conv.is_owned = false;
24735 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24736 uint32_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
24740 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
24741 LDKDelayedPaymentOutputDescriptor orig_conv;
24742 orig_conv.inner = (void*)(orig & (~1));
24743 orig_conv.is_owned = false;
24744 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24745 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
24746 uint32_t ret_ref = 0;
24747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24750 ret_ref = (uintptr_t)ret_var.inner;
24751 if (ret_var.is_owned) {
24757 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
24758 LDKDelayedPaymentOutputDescriptor obj_conv;
24759 obj_conv.inner = (void*)(obj & (~1));
24760 obj_conv.is_owned = false;
24761 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24762 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
24763 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24764 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24765 CVec_u8Z_free(ret_var);
24769 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
24770 LDKu8slice ser_ref;
24771 ser_ref.datalen = ser->arr_len;
24772 ser_ref.data = ser->elems;
24773 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24774 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
24776 return (uint32_t)ret_conv;
24779 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
24780 LDKStaticPaymentOutputDescriptor this_obj_conv;
24781 this_obj_conv.inner = (void*)(this_obj & (~1));
24782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24784 StaticPaymentOutputDescriptor_free(this_obj_conv);
24787 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
24788 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24790 this_ptr_conv.is_owned = false;
24791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24792 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24793 uint32_t ret_ref = 0;
24794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24797 ret_ref = (uintptr_t)ret_var.inner;
24798 if (ret_var.is_owned) {
24804 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
24805 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24807 this_ptr_conv.is_owned = false;
24808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24809 LDKOutPoint val_conv;
24810 val_conv.inner = (void*)(val & (~1));
24811 val_conv.is_owned = (val & 1) || (val == 0);
24812 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24813 val_conv = OutPoint_clone(&val_conv);
24814 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24817 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
24818 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24820 this_ptr_conv.is_owned = false;
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24822 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24823 CHECK_ACCESS(val_ptr);
24824 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24825 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
24826 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24829 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
24830 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24832 this_ptr_conv.is_owned = false;
24833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24834 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24835 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24839 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
24840 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24842 this_ptr_conv.is_owned = false;
24843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24844 LDKThirtyTwoBytes val_ref;
24845 CHECK(val->arr_len == 32);
24846 memcpy(val_ref.data, val->elems, 32); FREE(val);
24847 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24850 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
24851 LDKStaticPaymentOutputDescriptor this_ptr_conv;
24852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24853 this_ptr_conv.is_owned = false;
24854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24855 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24859 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
24860 LDKStaticPaymentOutputDescriptor 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 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24867 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) {
24868 LDKOutPoint outpoint_arg_conv;
24869 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
24870 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
24871 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24872 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24873 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
24874 CHECK_ACCESS(output_arg_ptr);
24875 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
24876 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
24877 LDKThirtyTwoBytes channel_keys_id_arg_ref;
24878 CHECK(channel_keys_id_arg->arr_len == 32);
24879 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
24880 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
24881 uint32_t ret_ref = 0;
24882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24885 ret_ref = (uintptr_t)ret_var.inner;
24886 if (ret_var.is_owned) {
24892 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
24893 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
24894 uint32_t ret_ref = 0;
24895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24898 ret_ref = (uintptr_t)ret_var.inner;
24899 if (ret_var.is_owned) {
24904 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
24905 LDKStaticPaymentOutputDescriptor arg_conv;
24906 arg_conv.inner = (void*)(arg & (~1));
24907 arg_conv.is_owned = false;
24908 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24909 uint32_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
24913 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
24914 LDKStaticPaymentOutputDescriptor orig_conv;
24915 orig_conv.inner = (void*)(orig & (~1));
24916 orig_conv.is_owned = false;
24917 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24918 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
24919 uint32_t ret_ref = 0;
24920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24923 ret_ref = (uintptr_t)ret_var.inner;
24924 if (ret_var.is_owned) {
24930 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
24931 LDKStaticPaymentOutputDescriptor obj_conv;
24932 obj_conv.inner = (void*)(obj & (~1));
24933 obj_conv.is_owned = false;
24934 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24935 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
24936 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24937 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24938 CVec_u8Z_free(ret_var);
24942 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
24943 LDKu8slice ser_ref;
24944 ser_ref.datalen = ser->arr_len;
24945 ser_ref.data = ser->elems;
24946 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24947 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
24949 return (uint32_t)ret_conv;
24952 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
24953 if ((this_ptr & 1) != 0) return;
24954 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24955 CHECK_ACCESS(this_ptr_ptr);
24956 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
24957 FREE((void*)this_ptr);
24958 SpendableOutputDescriptor_free(this_ptr_conv);
24961 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
24962 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24963 *ret_copy = SpendableOutputDescriptor_clone(arg);
24964 uint32_t ret_ref = (uintptr_t)ret_copy;
24967 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
24968 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
24969 uint32_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
24973 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
24974 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
24975 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24976 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
24977 uint32_t ret_ref = (uintptr_t)ret_copy;
24981 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
24982 LDKOutPoint outpoint_conv;
24983 outpoint_conv.inner = (void*)(outpoint & (~1));
24984 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
24985 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
24986 outpoint_conv = OutPoint_clone(&outpoint_conv);
24987 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
24988 CHECK_ACCESS(output_ptr);
24989 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
24990 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
24991 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24992 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
24993 uint32_t ret_ref = (uintptr_t)ret_copy;
24997 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
24998 LDKDelayedPaymentOutputDescriptor a_conv;
24999 a_conv.inner = (void*)(a & (~1));
25000 a_conv.is_owned = (a & 1) || (a == 0);
25001 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25002 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25003 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25004 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25005 uint32_t ret_ref = (uintptr_t)ret_copy;
25009 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
25010 LDKStaticPaymentOutputDescriptor a_conv;
25011 a_conv.inner = (void*)(a & (~1));
25012 a_conv.is_owned = (a & 1) || (a == 0);
25013 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25014 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25015 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25016 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25017 uint32_t ret_ref = (uintptr_t)ret_copy;
25021 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
25022 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
25023 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25024 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25025 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25026 CVec_u8Z_free(ret_var);
25030 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
25031 LDKu8slice ser_ref;
25032 ser_ref.datalen = ser->arr_len;
25033 ser_ref.data = ser->elems;
25034 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25035 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25037 return (uint32_t)ret_conv;
25040 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
25041 if ((this_ptr & 1) != 0) return;
25042 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25043 CHECK_ACCESS(this_ptr_ptr);
25044 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25045 FREE((void*)this_ptr);
25046 BaseSign_free(this_ptr_conv);
25049 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25050 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25051 *ret_ret = Sign_clone(arg);
25052 return (uint32_t)ret_ret;
25054 uint32_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
25055 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
25056 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
25057 LDKSign* arg_conv = (LDKSign*)arg_ptr;
25058 uint32_t ret_conv = Sign_clone_ptr(arg_conv);
25062 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
25063 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
25064 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
25065 LDKSign* orig_conv = (LDKSign*)orig_ptr;
25066 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25067 *ret_ret = Sign_clone(orig_conv);
25068 return (uint32_t)ret_ret;
25071 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
25072 if ((this_ptr & 1) != 0) return;
25073 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25074 CHECK_ACCESS(this_ptr_ptr);
25075 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25076 FREE((void*)this_ptr);
25077 Sign_free(this_ptr_conv);
25080 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
25081 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
25082 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
25086 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
25087 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
25091 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
25092 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
25096 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
25097 if ((this_ptr & 1) != 0) return;
25098 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25099 CHECK_ACCESS(this_ptr_ptr);
25100 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25101 FREE((void*)this_ptr);
25102 KeysInterface_free(this_ptr_conv);
25105 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
25106 LDKInMemorySigner this_obj_conv;
25107 this_obj_conv.inner = (void*)(this_obj & (~1));
25108 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25110 InMemorySigner_free(this_obj_conv);
25113 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
25114 LDKInMemorySigner this_ptr_conv;
25115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25116 this_ptr_conv.is_owned = false;
25117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25118 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25119 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
25123 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
25124 LDKInMemorySigner this_ptr_conv;
25125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25126 this_ptr_conv.is_owned = false;
25127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25128 LDKSecretKey val_ref;
25129 CHECK(val->arr_len == 32);
25130 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25131 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25134 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
25135 LDKInMemorySigner 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25140 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
25144 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
25145 LDKInMemorySigner this_ptr_conv;
25146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25147 this_ptr_conv.is_owned = false;
25148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25149 LDKSecretKey val_ref;
25150 CHECK(val->arr_len == 32);
25151 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25152 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25155 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
25156 LDKInMemorySigner this_ptr_conv;
25157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25158 this_ptr_conv.is_owned = false;
25159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25160 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25161 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
25165 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
25166 LDKInMemorySigner this_ptr_conv;
25167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25168 this_ptr_conv.is_owned = false;
25169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25170 LDKSecretKey val_ref;
25171 CHECK(val->arr_len == 32);
25172 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25173 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25176 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
25177 LDKInMemorySigner this_ptr_conv;
25178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25179 this_ptr_conv.is_owned = false;
25180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25181 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25182 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
25186 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) {
25187 LDKInMemorySigner this_ptr_conv;
25188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25189 this_ptr_conv.is_owned = false;
25190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25191 LDKSecretKey val_ref;
25192 CHECK(val->arr_len == 32);
25193 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25194 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25197 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
25198 LDKInMemorySigner this_ptr_conv;
25199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25200 this_ptr_conv.is_owned = false;
25201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25202 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25203 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
25207 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
25208 LDKInMemorySigner this_ptr_conv;
25209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25210 this_ptr_conv.is_owned = false;
25211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25212 LDKSecretKey val_ref;
25213 CHECK(val->arr_len == 32);
25214 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25215 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25218 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
25219 LDKInMemorySigner this_ptr_conv;
25220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25221 this_ptr_conv.is_owned = false;
25222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25223 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25224 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
25228 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
25229 LDKInMemorySigner this_ptr_conv;
25230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25231 this_ptr_conv.is_owned = false;
25232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25233 LDKThirtyTwoBytes val_ref;
25234 CHECK(val->arr_len == 32);
25235 memcpy(val_ref.data, val->elems, 32); FREE(val);
25236 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25239 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25240 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25241 uint32_t ret_ref = 0;
25242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25245 ret_ref = (uintptr_t)ret_var.inner;
25246 if (ret_var.is_owned) {
25251 uint32_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
25252 LDKInMemorySigner arg_conv;
25253 arg_conv.inner = (void*)(arg & (~1));
25254 arg_conv.is_owned = false;
25255 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25256 uint32_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
25260 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
25261 LDKInMemorySigner orig_conv;
25262 orig_conv.inner = (void*)(orig & (~1));
25263 orig_conv.is_owned = false;
25264 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25265 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25266 uint32_t ret_ref = 0;
25267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25270 ret_ref = (uintptr_t)ret_var.inner;
25271 if (ret_var.is_owned) {
25277 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) {
25278 LDKSecretKey node_secret_ref;
25279 CHECK(node_secret->arr_len == 32);
25280 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
25281 LDKSecretKey funding_key_ref;
25282 CHECK(funding_key->arr_len == 32);
25283 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
25284 LDKSecretKey revocation_base_key_ref;
25285 CHECK(revocation_base_key->arr_len == 32);
25286 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
25287 LDKSecretKey payment_key_ref;
25288 CHECK(payment_key->arr_len == 32);
25289 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
25290 LDKSecretKey delayed_payment_base_key_ref;
25291 CHECK(delayed_payment_base_key->arr_len == 32);
25292 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
25293 LDKSecretKey htlc_base_key_ref;
25294 CHECK(htlc_base_key->arr_len == 32);
25295 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
25296 LDKThirtyTwoBytes commitment_seed_ref;
25297 CHECK(commitment_seed->arr_len == 32);
25298 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
25299 LDKThirtyTwoBytes channel_keys_id_ref;
25300 CHECK(channel_keys_id->arr_len == 32);
25301 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
25302 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);
25303 uint32_t ret_ref = 0;
25304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25307 ret_ref = (uintptr_t)ret_var.inner;
25308 if (ret_var.is_owned) {
25314 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
25315 LDKInMemorySigner this_arg_conv;
25316 this_arg_conv.inner = (void*)(this_arg & (~1));
25317 this_arg_conv.is_owned = false;
25318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25319 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25320 uint32_t ret_ref = 0;
25321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25324 ret_ref = (uintptr_t)ret_var.inner;
25325 if (ret_var.is_owned) {
25331 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
25332 LDKInMemorySigner this_arg_conv;
25333 this_arg_conv.inner = (void*)(this_arg & (~1));
25334 this_arg_conv.is_owned = false;
25335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25336 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25340 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
25341 LDKInMemorySigner this_arg_conv;
25342 this_arg_conv.inner = (void*)(this_arg & (~1));
25343 this_arg_conv.is_owned = false;
25344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25345 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25349 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
25350 LDKInMemorySigner this_arg_conv;
25351 this_arg_conv.inner = (void*)(this_arg & (~1));
25352 this_arg_conv.is_owned = false;
25353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25354 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
25358 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
25359 LDKInMemorySigner this_arg_conv;
25360 this_arg_conv.inner = (void*)(this_arg & (~1));
25361 this_arg_conv.is_owned = false;
25362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25363 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25364 uint32_t ret_ref = 0;
25365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25368 ret_ref = (uintptr_t)ret_var.inner;
25369 if (ret_var.is_owned) {
25375 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
25376 LDKInMemorySigner this_arg_conv;
25377 this_arg_conv.inner = (void*)(this_arg & (~1));
25378 this_arg_conv.is_owned = false;
25379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25380 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25381 uint32_t ret_ref = 0;
25382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25385 ret_ref = (uintptr_t)ret_var.inner;
25386 if (ret_var.is_owned) {
25392 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
25393 LDKInMemorySigner this_arg_conv;
25394 this_arg_conv.inner = (void*)(this_arg & (~1));
25395 this_arg_conv.is_owned = false;
25396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25397 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
25401 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) {
25402 LDKInMemorySigner this_arg_conv;
25403 this_arg_conv.inner = (void*)(this_arg & (~1));
25404 this_arg_conv.is_owned = false;
25405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25406 LDKTransaction spend_tx_ref;
25407 spend_tx_ref.datalen = spend_tx->arr_len;
25408 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25409 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25410 spend_tx_ref.data_is_owned = true;
25411 LDKStaticPaymentOutputDescriptor descriptor_conv;
25412 descriptor_conv.inner = (void*)(descriptor & (~1));
25413 descriptor_conv.is_owned = false;
25414 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25415 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25416 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25417 return (uint32_t)ret_conv;
25420 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) {
25421 LDKInMemorySigner this_arg_conv;
25422 this_arg_conv.inner = (void*)(this_arg & (~1));
25423 this_arg_conv.is_owned = false;
25424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25425 LDKTransaction spend_tx_ref;
25426 spend_tx_ref.datalen = spend_tx->arr_len;
25427 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25428 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25429 spend_tx_ref.data_is_owned = true;
25430 LDKDelayedPaymentOutputDescriptor descriptor_conv;
25431 descriptor_conv.inner = (void*)(descriptor & (~1));
25432 descriptor_conv.is_owned = false;
25433 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25434 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25435 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25436 return (uint32_t)ret_conv;
25439 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
25440 LDKInMemorySigner this_arg_conv;
25441 this_arg_conv.inner = (void*)(this_arg & (~1));
25442 this_arg_conv.is_owned = false;
25443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25444 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25445 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25446 return (uint32_t)ret_ret;
25449 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
25450 LDKInMemorySigner this_arg_conv;
25451 this_arg_conv.inner = (void*)(this_arg & (~1));
25452 this_arg_conv.is_owned = false;
25453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25454 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25455 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25456 return (uint32_t)ret_ret;
25459 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
25460 LDKInMemorySigner obj_conv;
25461 obj_conv.inner = (void*)(obj & (~1));
25462 obj_conv.is_owned = false;
25463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25464 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25465 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25466 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25467 CVec_u8Z_free(ret_var);
25471 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
25472 LDKu8slice ser_ref;
25473 ser_ref.datalen = ser->arr_len;
25474 ser_ref.data = ser->elems;
25475 LDKSecretKey arg_ref;
25476 CHECK(arg->arr_len == 32);
25477 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
25478 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25479 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
25481 return (uint32_t)ret_conv;
25484 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
25485 LDKKeysManager this_obj_conv;
25486 this_obj_conv.inner = (void*)(this_obj & (~1));
25487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25489 KeysManager_free(this_obj_conv);
25492 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
25493 unsigned char seed_arr[32];
25494 CHECK(seed->arr_len == 32);
25495 memcpy(seed_arr, seed->elems, 32); FREE(seed);
25496 unsigned char (*seed_ref)[32] = &seed_arr;
25497 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25498 uint32_t ret_ref = 0;
25499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25502 ret_ref = (uintptr_t)ret_var.inner;
25503 if (ret_var.is_owned) {
25509 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) {
25510 LDKKeysManager this_arg_conv;
25511 this_arg_conv.inner = (void*)(this_arg & (~1));
25512 this_arg_conv.is_owned = false;
25513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25514 unsigned char params_arr[32];
25515 CHECK(params->arr_len == 32);
25516 memcpy(params_arr, params->elems, 32); FREE(params);
25517 unsigned char (*params_ref)[32] = ¶ms_arr;
25518 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25519 uint32_t ret_ref = 0;
25520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25523 ret_ref = (uintptr_t)ret_var.inner;
25524 if (ret_var.is_owned) {
25530 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) {
25531 LDKKeysManager this_arg_conv;
25532 this_arg_conv.inner = (void*)(this_arg & (~1));
25533 this_arg_conv.is_owned = false;
25534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25535 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25536 descriptors_constr.datalen = descriptors->arr_len;
25537 if (descriptors_constr.datalen > 0)
25538 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25540 descriptors_constr.data = NULL;
25541 uint32_t* descriptors_vals = descriptors->elems;
25542 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25543 uint32_t descriptors_conv_27 = descriptors_vals[b];
25544 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
25545 CHECK_ACCESS(descriptors_conv_27_ptr);
25546 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25547 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
25548 descriptors_constr.data[b] = descriptors_conv_27_conv;
25551 LDKCVec_TxOutZ outputs_constr;
25552 outputs_constr.datalen = outputs->arr_len;
25553 if (outputs_constr.datalen > 0)
25554 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25556 outputs_constr.data = NULL;
25557 uint32_t* outputs_vals = outputs->elems;
25558 for (size_t h = 0; h < outputs_constr.datalen; h++) {
25559 uint32_t outputs_conv_7 = outputs_vals[h];
25560 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
25561 CHECK_ACCESS(outputs_conv_7_ptr);
25562 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25563 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
25564 outputs_constr.data[h] = outputs_conv_7_conv;
25567 LDKCVec_u8Z change_destination_script_ref;
25568 change_destination_script_ref.datalen = change_destination_script->arr_len;
25569 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25570 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25571 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25572 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25573 return (uint32_t)ret_conv;
25576 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
25577 LDKKeysManager this_arg_conv;
25578 this_arg_conv.inner = (void*)(this_arg & (~1));
25579 this_arg_conv.is_owned = false;
25580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25581 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25582 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25583 return (uint32_t)ret_ret;
25586 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
25587 LDKPhantomKeysManager this_obj_conv;
25588 this_obj_conv.inner = (void*)(this_obj & (~1));
25589 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25591 PhantomKeysManager_free(this_obj_conv);
25594 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
25595 LDKPhantomKeysManager this_arg_conv;
25596 this_arg_conv.inner = (void*)(this_arg & (~1));
25597 this_arg_conv.is_owned = false;
25598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25599 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25600 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
25601 return (uint32_t)ret_ret;
25604 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) {
25605 unsigned char seed_arr[32];
25606 CHECK(seed->arr_len == 32);
25607 memcpy(seed_arr, seed->elems, 32); FREE(seed);
25608 unsigned char (*seed_ref)[32] = &seed_arr;
25609 unsigned char cross_node_seed_arr[32];
25610 CHECK(cross_node_seed->arr_len == 32);
25611 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
25612 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
25613 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
25614 uint32_t ret_ref = 0;
25615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25618 ret_ref = (uintptr_t)ret_var.inner;
25619 if (ret_var.is_owned) {
25625 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) {
25626 LDKPhantomKeysManager this_arg_conv;
25627 this_arg_conv.inner = (void*)(this_arg & (~1));
25628 this_arg_conv.is_owned = false;
25629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25630 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25631 descriptors_constr.datalen = descriptors->arr_len;
25632 if (descriptors_constr.datalen > 0)
25633 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25635 descriptors_constr.data = NULL;
25636 uint32_t* descriptors_vals = descriptors->elems;
25637 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25638 uint32_t descriptors_conv_27 = descriptors_vals[b];
25639 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
25640 CHECK_ACCESS(descriptors_conv_27_ptr);
25641 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25642 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
25643 descriptors_constr.data[b] = descriptors_conv_27_conv;
25646 LDKCVec_TxOutZ outputs_constr;
25647 outputs_constr.datalen = outputs->arr_len;
25648 if (outputs_constr.datalen > 0)
25649 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25651 outputs_constr.data = NULL;
25652 uint32_t* outputs_vals = outputs->elems;
25653 for (size_t h = 0; h < outputs_constr.datalen; h++) {
25654 uint32_t outputs_conv_7 = outputs_vals[h];
25655 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
25656 CHECK_ACCESS(outputs_conv_7_ptr);
25657 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25658 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
25659 outputs_constr.data[h] = outputs_conv_7_conv;
25662 LDKCVec_u8Z change_destination_script_ref;
25663 change_destination_script_ref.datalen = change_destination_script->arr_len;
25664 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25665 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25666 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25667 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25668 return (uint32_t)ret_conv;
25671 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) {
25672 LDKPhantomKeysManager this_arg_conv;
25673 this_arg_conv.inner = (void*)(this_arg & (~1));
25674 this_arg_conv.is_owned = false;
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25676 unsigned char params_arr[32];
25677 CHECK(params->arr_len == 32);
25678 memcpy(params_arr, params->elems, 32); FREE(params);
25679 unsigned char (*params_ref)[32] = ¶ms_arr;
25680 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25681 uint32_t ret_ref = 0;
25682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25685 ret_ref = (uintptr_t)ret_var.inner;
25686 if (ret_var.is_owned) {
25692 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
25693 LDKChannelManager this_obj_conv;
25694 this_obj_conv.inner = (void*)(this_obj & (~1));
25695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25697 ChannelManager_free(this_obj_conv);
25700 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
25701 LDKChainParameters this_obj_conv;
25702 this_obj_conv.inner = (void*)(this_obj & (~1));
25703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25705 ChainParameters_free(this_obj_conv);
25708 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
25709 LDKChainParameters this_ptr_conv;
25710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25711 this_ptr_conv.is_owned = false;
25712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25713 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
25717 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
25718 LDKChainParameters this_ptr_conv;
25719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25720 this_ptr_conv.is_owned = false;
25721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25722 LDKNetwork val_conv = LDKNetwork_from_js(val);
25723 ChainParameters_set_network(&this_ptr_conv, val_conv);
25726 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
25727 LDKChainParameters this_ptr_conv;
25728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25729 this_ptr_conv.is_owned = false;
25730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25731 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
25732 uint32_t ret_ref = 0;
25733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25736 ret_ref = (uintptr_t)ret_var.inner;
25737 if (ret_var.is_owned) {
25743 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
25744 LDKChainParameters this_ptr_conv;
25745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25746 this_ptr_conv.is_owned = false;
25747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25748 LDKBestBlock val_conv;
25749 val_conv.inner = (void*)(val & (~1));
25750 val_conv.is_owned = (val & 1) || (val == 0);
25751 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25752 val_conv = BestBlock_clone(&val_conv);
25753 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
25756 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
25757 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
25758 LDKBestBlock best_block_arg_conv;
25759 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
25760 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
25761 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
25762 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
25763 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
25764 uint32_t ret_ref = 0;
25765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25768 ret_ref = (uintptr_t)ret_var.inner;
25769 if (ret_var.is_owned) {
25775 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
25776 LDKChainParameters ret_var = ChainParameters_clone(arg);
25777 uint32_t ret_ref = 0;
25778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25781 ret_ref = (uintptr_t)ret_var.inner;
25782 if (ret_var.is_owned) {
25787 uint32_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
25788 LDKChainParameters arg_conv;
25789 arg_conv.inner = (void*)(arg & (~1));
25790 arg_conv.is_owned = false;
25791 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25792 uint32_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
25796 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
25797 LDKChainParameters orig_conv;
25798 orig_conv.inner = (void*)(orig & (~1));
25799 orig_conv.is_owned = false;
25800 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25801 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
25802 uint32_t ret_ref = 0;
25803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25806 ret_ref = (uintptr_t)ret_var.inner;
25807 if (ret_var.is_owned) {
25813 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
25814 LDKCounterpartyForwardingInfo this_obj_conv;
25815 this_obj_conv.inner = (void*)(this_obj & (~1));
25816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25818 CounterpartyForwardingInfo_free(this_obj_conv);
25821 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
25822 LDKCounterpartyForwardingInfo this_ptr_conv;
25823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25824 this_ptr_conv.is_owned = false;
25825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25826 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
25830 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
25831 LDKCounterpartyForwardingInfo this_ptr_conv;
25832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25833 this_ptr_conv.is_owned = false;
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25835 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
25838 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
25839 LDKCounterpartyForwardingInfo this_ptr_conv;
25840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25841 this_ptr_conv.is_owned = false;
25842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25843 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
25847 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
25848 LDKCounterpartyForwardingInfo this_ptr_conv;
25849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25850 this_ptr_conv.is_owned = false;
25851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25852 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
25855 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
25856 LDKCounterpartyForwardingInfo this_ptr_conv;
25857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25858 this_ptr_conv.is_owned = false;
25859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25860 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
25864 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25865 LDKCounterpartyForwardingInfo this_ptr_conv;
25866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25867 this_ptr_conv.is_owned = false;
25868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25869 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
25872 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) {
25873 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
25874 uint32_t ret_ref = 0;
25875 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25876 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25878 ret_ref = (uintptr_t)ret_var.inner;
25879 if (ret_var.is_owned) {
25885 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
25886 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
25887 uint32_t ret_ref = 0;
25888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25891 ret_ref = (uintptr_t)ret_var.inner;
25892 if (ret_var.is_owned) {
25897 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
25898 LDKCounterpartyForwardingInfo arg_conv;
25899 arg_conv.inner = (void*)(arg & (~1));
25900 arg_conv.is_owned = false;
25901 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25902 uint32_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
25906 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
25907 LDKCounterpartyForwardingInfo orig_conv;
25908 orig_conv.inner = (void*)(orig & (~1));
25909 orig_conv.is_owned = false;
25910 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25911 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
25912 uint32_t ret_ref = 0;
25913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25916 ret_ref = (uintptr_t)ret_var.inner;
25917 if (ret_var.is_owned) {
25923 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
25924 LDKChannelCounterparty this_obj_conv;
25925 this_obj_conv.inner = (void*)(this_obj & (~1));
25926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25928 ChannelCounterparty_free(this_obj_conv);
25931 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
25932 LDKChannelCounterparty this_ptr_conv;
25933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25934 this_ptr_conv.is_owned = false;
25935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25936 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25937 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
25941 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
25942 LDKChannelCounterparty this_ptr_conv;
25943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25944 this_ptr_conv.is_owned = false;
25945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25946 LDKPublicKey val_ref;
25947 CHECK(val->arr_len == 33);
25948 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25949 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
25952 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
25953 LDKChannelCounterparty this_ptr_conv;
25954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25955 this_ptr_conv.is_owned = false;
25956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25957 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
25958 uint32_t ret_ref = 0;
25959 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25960 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25962 ret_ref = (uintptr_t)ret_var.inner;
25963 if (ret_var.is_owned) {
25969 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
25970 LDKChannelCounterparty this_ptr_conv;
25971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25972 this_ptr_conv.is_owned = false;
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25974 LDKInitFeatures val_conv;
25975 val_conv.inner = (void*)(val & (~1));
25976 val_conv.is_owned = (val & 1) || (val == 0);
25977 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25978 val_conv = InitFeatures_clone(&val_conv);
25979 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
25982 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25983 LDKChannelCounterparty this_ptr_conv;
25984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25985 this_ptr_conv.is_owned = false;
25986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25987 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
25991 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
25992 LDKChannelCounterparty this_ptr_conv;
25993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25994 this_ptr_conv.is_owned = false;
25995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25996 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
25999 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
26000 LDKChannelCounterparty this_ptr_conv;
26001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26002 this_ptr_conv.is_owned = false;
26003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26004 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26005 uint32_t ret_ref = 0;
26006 if ((uintptr_t)ret_var.inner > 4096) {
26007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26010 ret_ref = (uintptr_t)ret_var.inner;
26011 if (ret_var.is_owned) {
26018 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
26019 LDKChannelCounterparty this_ptr_conv;
26020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26021 this_ptr_conv.is_owned = false;
26022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26023 LDKCounterpartyForwardingInfo val_conv;
26024 val_conv.inner = (void*)(val & (~1));
26025 val_conv.is_owned = (val & 1) || (val == 0);
26026 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26027 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26028 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26031 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint32_t this_ptr) {
26032 LDKChannelCounterparty this_ptr_conv;
26033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26034 this_ptr_conv.is_owned = false;
26035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26036 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26037 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
26038 uint32_t ret_ref = (uintptr_t)ret_copy;
26042 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) {
26043 LDKChannelCounterparty this_ptr_conv;
26044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26045 this_ptr_conv.is_owned = false;
26046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26047 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26048 CHECK_ACCESS(val_ptr);
26049 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26050 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26051 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26054 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint32_t this_ptr) {
26055 LDKChannelCounterparty this_ptr_conv;
26056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26057 this_ptr_conv.is_owned = false;
26058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26059 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26060 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
26061 uint32_t ret_ref = (uintptr_t)ret_copy;
26065 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) {
26066 LDKChannelCounterparty this_ptr_conv;
26067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26068 this_ptr_conv.is_owned = false;
26069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26070 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26071 CHECK_ACCESS(val_ptr);
26072 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26073 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26074 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26077 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) {
26078 LDKPublicKey node_id_arg_ref;
26079 CHECK(node_id_arg->arr_len == 33);
26080 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
26081 LDKInitFeatures features_arg_conv;
26082 features_arg_conv.inner = (void*)(features_arg & (~1));
26083 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26084 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26085 features_arg_conv = InitFeatures_clone(&features_arg_conv);
26086 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26087 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
26088 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
26089 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26090 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26091 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
26092 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
26093 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
26094 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
26095 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
26096 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
26097 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
26098 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
26099 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);
26100 uint32_t ret_ref = 0;
26101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26104 ret_ref = (uintptr_t)ret_var.inner;
26105 if (ret_var.is_owned) {
26111 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26112 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26113 uint32_t ret_ref = 0;
26114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26117 ret_ref = (uintptr_t)ret_var.inner;
26118 if (ret_var.is_owned) {
26123 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
26124 LDKChannelCounterparty arg_conv;
26125 arg_conv.inner = (void*)(arg & (~1));
26126 arg_conv.is_owned = false;
26127 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26128 uint32_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
26132 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
26133 LDKChannelCounterparty orig_conv;
26134 orig_conv.inner = (void*)(orig & (~1));
26135 orig_conv.is_owned = false;
26136 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26137 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26138 uint32_t ret_ref = 0;
26139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26142 ret_ref = (uintptr_t)ret_var.inner;
26143 if (ret_var.is_owned) {
26149 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
26150 LDKChannelDetails this_obj_conv;
26151 this_obj_conv.inner = (void*)(this_obj & (~1));
26152 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26154 ChannelDetails_free(this_obj_conv);
26157 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
26158 LDKChannelDetails this_ptr_conv;
26159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26160 this_ptr_conv.is_owned = false;
26161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26162 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26163 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
26167 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
26168 LDKChannelDetails this_ptr_conv;
26169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26170 this_ptr_conv.is_owned = false;
26171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26172 LDKThirtyTwoBytes val_ref;
26173 CHECK(val->arr_len == 32);
26174 memcpy(val_ref.data, val->elems, 32); FREE(val);
26175 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26178 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
26179 LDKChannelDetails this_ptr_conv;
26180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26181 this_ptr_conv.is_owned = false;
26182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26183 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26184 uint32_t ret_ref = 0;
26185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26188 ret_ref = (uintptr_t)ret_var.inner;
26189 if (ret_var.is_owned) {
26195 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
26196 LDKChannelDetails this_ptr_conv;
26197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26198 this_ptr_conv.is_owned = false;
26199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26200 LDKChannelCounterparty val_conv;
26201 val_conv.inner = (void*)(val & (~1));
26202 val_conv.is_owned = (val & 1) || (val == 0);
26203 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26204 val_conv = ChannelCounterparty_clone(&val_conv);
26205 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26208 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
26209 LDKChannelDetails this_ptr_conv;
26210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26211 this_ptr_conv.is_owned = false;
26212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26213 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26214 uint32_t ret_ref = 0;
26215 if ((uintptr_t)ret_var.inner > 4096) {
26216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26219 ret_ref = (uintptr_t)ret_var.inner;
26220 if (ret_var.is_owned) {
26227 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
26228 LDKChannelDetails this_ptr_conv;
26229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26230 this_ptr_conv.is_owned = false;
26231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26232 LDKOutPoint val_conv;
26233 val_conv.inner = (void*)(val & (~1));
26234 val_conv.is_owned = (val & 1) || (val == 0);
26235 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26236 val_conv = OutPoint_clone(&val_conv);
26237 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26240 uint32_t __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint32_t this_ptr) {
26241 LDKChannelDetails this_ptr_conv;
26242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26243 this_ptr_conv.is_owned = false;
26244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26245 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
26246 uint32_t ret_ref = 0;
26247 if ((uintptr_t)ret_var.inner > 4096) {
26248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26251 ret_ref = (uintptr_t)ret_var.inner;
26252 if (ret_var.is_owned) {
26259 void __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint32_t this_ptr, uint32_t val) {
26260 LDKChannelDetails this_ptr_conv;
26261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26262 this_ptr_conv.is_owned = false;
26263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26264 LDKChannelTypeFeatures val_conv;
26265 val_conv.inner = (void*)(val & (~1));
26266 val_conv.is_owned = (val & 1) || (val == 0);
26267 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26268 val_conv = ChannelTypeFeatures_clone(&val_conv);
26269 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
26272 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
26273 LDKChannelDetails this_ptr_conv;
26274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26275 this_ptr_conv.is_owned = false;
26276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26277 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26278 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26279 uint32_t ret_ref = (uintptr_t)ret_copy;
26283 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
26284 LDKChannelDetails this_ptr_conv;
26285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26286 this_ptr_conv.is_owned = false;
26287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26288 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26289 CHECK_ACCESS(val_ptr);
26290 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26291 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26292 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26295 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint32_t this_ptr) {
26296 LDKChannelDetails this_ptr_conv;
26297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26298 this_ptr_conv.is_owned = false;
26299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26300 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26301 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
26302 uint32_t ret_ref = (uintptr_t)ret_copy;
26306 void __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint32_t this_ptr, uint32_t val) {
26307 LDKChannelDetails this_ptr_conv;
26308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26309 this_ptr_conv.is_owned = false;
26310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26311 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26312 CHECK_ACCESS(val_ptr);
26313 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26314 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26315 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
26318 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint32_t this_ptr) {
26319 LDKChannelDetails this_ptr_conv;
26320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26321 this_ptr_conv.is_owned = false;
26322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26323 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26324 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
26325 uint32_t ret_ref = (uintptr_t)ret_copy;
26329 void __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint32_t this_ptr, uint32_t val) {
26330 LDKChannelDetails this_ptr_conv;
26331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26332 this_ptr_conv.is_owned = false;
26333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26334 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26335 CHECK_ACCESS(val_ptr);
26336 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26337 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26338 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
26341 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
26342 LDKChannelDetails this_ptr_conv;
26343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26344 this_ptr_conv.is_owned = false;
26345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26346 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26350 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
26351 LDKChannelDetails this_ptr_conv;
26352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26353 this_ptr_conv.is_owned = false;
26354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26355 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26358 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
26359 LDKChannelDetails this_ptr_conv;
26360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26361 this_ptr_conv.is_owned = false;
26362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26363 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26364 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26365 uint32_t ret_ref = (uintptr_t)ret_copy;
26369 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
26370 LDKChannelDetails this_ptr_conv;
26371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26372 this_ptr_conv.is_owned = false;
26373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26374 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26375 CHECK_ACCESS(val_ptr);
26376 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26377 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26378 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26381 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
26382 LDKChannelDetails this_ptr_conv;
26383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26384 this_ptr_conv.is_owned = false;
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26386 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26390 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
26391 LDKChannelDetails this_ptr_conv;
26392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26393 this_ptr_conv.is_owned = false;
26394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26395 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26398 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
26399 LDKChannelDetails this_ptr_conv;
26400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26401 this_ptr_conv.is_owned = false;
26402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26403 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
26407 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
26408 LDKChannelDetails this_ptr_conv;
26409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26410 this_ptr_conv.is_owned = false;
26411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26412 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26415 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
26416 LDKChannelDetails this_ptr_conv;
26417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26418 this_ptr_conv.is_owned = false;
26419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26420 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26424 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
26425 LDKChannelDetails this_ptr_conv;
26426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26427 this_ptr_conv.is_owned = false;
26428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26429 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26432 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) {
26433 LDKChannelDetails this_ptr_conv;
26434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26435 this_ptr_conv.is_owned = false;
26436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26437 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
26441 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) {
26442 LDKChannelDetails this_ptr_conv;
26443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26444 this_ptr_conv.is_owned = false;
26445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26446 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
26449 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
26450 LDKChannelDetails this_ptr_conv;
26451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26452 this_ptr_conv.is_owned = false;
26453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26454 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26458 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
26459 LDKChannelDetails this_ptr_conv;
26460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26461 this_ptr_conv.is_owned = false;
26462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26463 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26466 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
26467 LDKChannelDetails this_ptr_conv;
26468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26469 this_ptr_conv.is_owned = false;
26470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26471 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26472 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26473 uint32_t ret_ref = (uintptr_t)ret_copy;
26477 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
26478 LDKChannelDetails this_ptr_conv;
26479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26480 this_ptr_conv.is_owned = false;
26481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26482 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26483 CHECK_ACCESS(val_ptr);
26484 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26485 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
26486 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26489 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
26490 LDKChannelDetails this_ptr_conv;
26491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26492 this_ptr_conv.is_owned = false;
26493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26494 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26495 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26496 uint32_t ret_ref = (uintptr_t)ret_copy;
26500 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) {
26501 LDKChannelDetails this_ptr_conv;
26502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26503 this_ptr_conv.is_owned = false;
26504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26505 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26506 CHECK_ACCESS(val_ptr);
26507 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26508 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
26509 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26512 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
26513 LDKChannelDetails this_ptr_conv;
26514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26515 this_ptr_conv.is_owned = false;
26516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26517 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
26521 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
26522 LDKChannelDetails this_ptr_conv;
26523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26524 this_ptr_conv.is_owned = false;
26525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26526 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26529 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint32_t this_ptr) {
26530 LDKChannelDetails this_ptr_conv;
26531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26532 this_ptr_conv.is_owned = false;
26533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26534 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
26538 void __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint32_t this_ptr, jboolean val) {
26539 LDKChannelDetails this_ptr_conv;
26540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26541 this_ptr_conv.is_owned = false;
26542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26543 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
26546 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
26547 LDKChannelDetails this_ptr_conv;
26548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26549 this_ptr_conv.is_owned = false;
26550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26551 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
26555 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
26556 LDKChannelDetails this_ptr_conv;
26557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26558 this_ptr_conv.is_owned = false;
26559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26560 ChannelDetails_set_is_usable(&this_ptr_conv, val);
26563 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
26564 LDKChannelDetails this_ptr_conv;
26565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26566 this_ptr_conv.is_owned = false;
26567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26568 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
26572 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
26573 LDKChannelDetails this_ptr_conv;
26574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26575 this_ptr_conv.is_owned = false;
26576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26577 ChannelDetails_set_is_public(&this_ptr_conv, val);
26580 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint32_t this_ptr) {
26581 LDKChannelDetails this_ptr_conv;
26582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26583 this_ptr_conv.is_owned = false;
26584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26585 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26586 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
26587 uint32_t ret_ref = (uintptr_t)ret_copy;
26591 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) {
26592 LDKChannelDetails this_ptr_conv;
26593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26594 this_ptr_conv.is_owned = false;
26595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26596 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26597 CHECK_ACCESS(val_ptr);
26598 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26599 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26600 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26603 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint32_t this_ptr) {
26604 LDKChannelDetails this_ptr_conv;
26605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26606 this_ptr_conv.is_owned = false;
26607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26608 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26609 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
26610 uint32_t ret_ref = (uintptr_t)ret_copy;
26614 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) {
26615 LDKChannelDetails this_ptr_conv;
26616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26617 this_ptr_conv.is_owned = false;
26618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26619 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26620 CHECK_ACCESS(val_ptr);
26621 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26622 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26623 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26626 uint32_t __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint32_t this_ptr) {
26627 LDKChannelDetails this_ptr_conv;
26628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26629 this_ptr_conv.is_owned = false;
26630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26631 LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
26632 uint32_t ret_ref = 0;
26633 if ((uintptr_t)ret_var.inner > 4096) {
26634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26637 ret_ref = (uintptr_t)ret_var.inner;
26638 if (ret_var.is_owned) {
26645 void __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint32_t this_ptr, uint32_t val) {
26646 LDKChannelDetails this_ptr_conv;
26647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26648 this_ptr_conv.is_owned = false;
26649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26650 LDKChannelConfig val_conv;
26651 val_conv.inner = (void*)(val & (~1));
26652 val_conv.is_owned = (val & 1) || (val == 0);
26653 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26654 val_conv = ChannelConfig_clone(&val_conv);
26655 ChannelDetails_set_config(&this_ptr_conv, val_conv);
26658 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, uint32_t config_arg) {
26659 LDKThirtyTwoBytes channel_id_arg_ref;
26660 CHECK(channel_id_arg->arr_len == 32);
26661 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26662 LDKChannelCounterparty counterparty_arg_conv;
26663 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
26664 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
26665 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26666 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26667 LDKOutPoint funding_txo_arg_conv;
26668 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
26669 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
26670 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
26671 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
26672 LDKChannelTypeFeatures channel_type_arg_conv;
26673 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
26674 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
26675 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
26676 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
26677 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
26678 CHECK_ACCESS(short_channel_id_arg_ptr);
26679 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
26680 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
26681 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
26682 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
26683 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
26684 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
26685 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
26686 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
26687 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
26688 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
26689 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
26690 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
26691 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
26692 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
26693 CHECK_ACCESS(confirmations_required_arg_ptr);
26694 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
26695 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
26696 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
26697 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
26698 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
26699 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
26700 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
26701 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
26702 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
26703 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
26704 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
26705 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
26706 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
26707 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
26708 LDKChannelConfig config_arg_conv;
26709 config_arg_conv.inner = (void*)(config_arg & (~1));
26710 config_arg_conv.is_owned = (config_arg & 1) || (config_arg == 0);
26711 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
26712 config_arg_conv = ChannelConfig_clone(&config_arg_conv);
26713 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, config_arg_conv);
26714 uint32_t ret_ref = 0;
26715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26718 ret_ref = (uintptr_t)ret_var.inner;
26719 if (ret_var.is_owned) {
26725 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
26726 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
26727 uint32_t ret_ref = 0;
26728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26731 ret_ref = (uintptr_t)ret_var.inner;
26732 if (ret_var.is_owned) {
26737 uint32_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
26738 LDKChannelDetails arg_conv;
26739 arg_conv.inner = (void*)(arg & (~1));
26740 arg_conv.is_owned = false;
26741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26742 uint32_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
26746 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
26747 LDKChannelDetails orig_conv;
26748 orig_conv.inner = (void*)(orig & (~1));
26749 orig_conv.is_owned = false;
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26751 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
26752 uint32_t ret_ref = 0;
26753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26756 ret_ref = (uintptr_t)ret_var.inner;
26757 if (ret_var.is_owned) {
26763 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint32_t this_arg) {
26764 LDKChannelDetails this_arg_conv;
26765 this_arg_conv.inner = (void*)(this_arg & (~1));
26766 this_arg_conv.is_owned = false;
26767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26768 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26769 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
26770 uint32_t ret_ref = (uintptr_t)ret_copy;
26774 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint32_t this_arg) {
26775 LDKChannelDetails this_arg_conv;
26776 this_arg_conv.inner = (void*)(this_arg & (~1));
26777 this_arg_conv.is_owned = false;
26778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26779 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26780 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
26781 uint32_t ret_ref = (uintptr_t)ret_copy;
26785 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
26786 if ((this_ptr & 1) != 0) return;
26787 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26788 CHECK_ACCESS(this_ptr_ptr);
26789 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
26790 FREE((void*)this_ptr);
26791 PaymentSendFailure_free(this_ptr_conv);
26794 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
26795 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26796 *ret_copy = PaymentSendFailure_clone(arg);
26797 uint32_t ret_ref = (uintptr_t)ret_copy;
26800 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
26801 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
26802 uint32_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
26806 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
26807 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
26808 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26809 *ret_copy = PaymentSendFailure_clone(orig_conv);
26810 uint32_t ret_ref = (uintptr_t)ret_copy;
26814 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
26815 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
26816 CHECK_ACCESS(a_ptr);
26817 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
26818 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
26819 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26820 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
26821 uint32_t ret_ref = (uintptr_t)ret_copy;
26825 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
26826 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
26827 a_constr.datalen = a->arr_len;
26828 if (a_constr.datalen > 0)
26829 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26831 a_constr.data = NULL;
26832 uint32_t* a_vals = a->elems;
26833 for (size_t w = 0; w < a_constr.datalen; w++) {
26834 uint32_t a_conv_22 = a_vals[w];
26835 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
26836 CHECK_ACCESS(a_conv_22_ptr);
26837 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
26838 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
26839 a_constr.data[w] = a_conv_22_conv;
26842 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26843 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
26844 uint32_t ret_ref = (uintptr_t)ret_copy;
26848 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
26849 LDKCVec_APIErrorZ a_constr;
26850 a_constr.datalen = a->arr_len;
26851 if (a_constr.datalen > 0)
26852 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
26854 a_constr.data = NULL;
26855 uint32_t* a_vals = a->elems;
26856 for (size_t k = 0; k < a_constr.datalen; k++) {
26857 uint32_t a_conv_10 = a_vals[k];
26858 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
26859 CHECK_ACCESS(a_conv_10_ptr);
26860 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
26861 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
26862 a_constr.data[k] = a_conv_10_conv;
26865 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26866 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
26867 uint32_t ret_ref = (uintptr_t)ret_copy;
26871 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) {
26872 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
26873 results_constr.datalen = results->arr_len;
26874 if (results_constr.datalen > 0)
26875 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26877 results_constr.data = NULL;
26878 uint32_t* results_vals = results->elems;
26879 for (size_t w = 0; w < results_constr.datalen; w++) {
26880 uint32_t results_conv_22 = results_vals[w];
26881 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
26882 CHECK_ACCESS(results_conv_22_ptr);
26883 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
26884 results_constr.data[w] = results_conv_22_conv;
26887 LDKRouteParameters failed_paths_retry_conv;
26888 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
26889 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
26890 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
26891 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
26892 LDKThirtyTwoBytes payment_id_ref;
26893 CHECK(payment_id->arr_len == 32);
26894 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26895 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26896 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
26897 uint32_t ret_ref = (uintptr_t)ret_copy;
26901 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
26902 LDKPhantomRouteHints this_obj_conv;
26903 this_obj_conv.inner = (void*)(this_obj & (~1));
26904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26906 PhantomRouteHints_free(this_obj_conv);
26909 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
26910 LDKPhantomRouteHints this_ptr_conv;
26911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26912 this_ptr_conv.is_owned = false;
26913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26914 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
26915 uint32_tArray ret_arr = NULL;
26916 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26917 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26918 for (size_t q = 0; q < ret_var.datalen; q++) {
26919 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26920 uint32_t ret_conv_16_ref = 0;
26921 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26922 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26924 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26925 if (ret_conv_16_var.is_owned) {
26926 ret_conv_16_ref |= 1;
26928 ret_arr_ptr[q] = ret_conv_16_ref;
26931 FREE(ret_var.data);
26935 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
26936 LDKPhantomRouteHints this_ptr_conv;
26937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26938 this_ptr_conv.is_owned = false;
26939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26940 LDKCVec_ChannelDetailsZ val_constr;
26941 val_constr.datalen = val->arr_len;
26942 if (val_constr.datalen > 0)
26943 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26945 val_constr.data = NULL;
26946 uint32_t* val_vals = val->elems;
26947 for (size_t q = 0; q < val_constr.datalen; q++) {
26948 uint32_t val_conv_16 = val_vals[q];
26949 LDKChannelDetails val_conv_16_conv;
26950 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
26951 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
26952 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
26953 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
26954 val_constr.data[q] = val_conv_16_conv;
26957 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
26960 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
26961 LDKPhantomRouteHints this_ptr_conv;
26962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26963 this_ptr_conv.is_owned = false;
26964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26965 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
26969 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
26970 LDKPhantomRouteHints this_ptr_conv;
26971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26972 this_ptr_conv.is_owned = false;
26973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26974 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
26977 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
26978 LDKPhantomRouteHints this_ptr_conv;
26979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26980 this_ptr_conv.is_owned = false;
26981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26982 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26983 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
26987 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
26988 LDKPhantomRouteHints this_ptr_conv;
26989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26990 this_ptr_conv.is_owned = false;
26991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26992 LDKPublicKey val_ref;
26993 CHECK(val->arr_len == 33);
26994 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26995 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
26998 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) {
26999 LDKCVec_ChannelDetailsZ channels_arg_constr;
27000 channels_arg_constr.datalen = channels_arg->arr_len;
27001 if (channels_arg_constr.datalen > 0)
27002 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27004 channels_arg_constr.data = NULL;
27005 uint32_t* channels_arg_vals = channels_arg->elems;
27006 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
27007 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
27008 LDKChannelDetails channels_arg_conv_16_conv;
27009 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
27010 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
27011 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
27012 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
27013 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
27015 FREE(channels_arg);
27016 LDKPublicKey real_node_pubkey_arg_ref;
27017 CHECK(real_node_pubkey_arg->arr_len == 33);
27018 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
27019 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
27020 uint32_t ret_ref = 0;
27021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27024 ret_ref = (uintptr_t)ret_var.inner;
27025 if (ret_var.is_owned) {
27031 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
27032 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
27033 uint32_t ret_ref = 0;
27034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27037 ret_ref = (uintptr_t)ret_var.inner;
27038 if (ret_var.is_owned) {
27043 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
27044 LDKPhantomRouteHints arg_conv;
27045 arg_conv.inner = (void*)(arg & (~1));
27046 arg_conv.is_owned = false;
27047 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27048 uint32_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
27052 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
27053 LDKPhantomRouteHints orig_conv;
27054 orig_conv.inner = (void*)(orig & (~1));
27055 orig_conv.is_owned = false;
27056 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27057 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
27058 uint32_t ret_ref = 0;
27059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27062 ret_ref = (uintptr_t)ret_var.inner;
27063 if (ret_var.is_owned) {
27069 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) {
27070 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
27071 CHECK_ACCESS(fee_est_ptr);
27072 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
27073 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
27074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27075 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
27077 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
27078 CHECK_ACCESS(chain_monitor_ptr);
27079 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27080 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27082 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27084 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
27085 CHECK_ACCESS(tx_broadcaster_ptr);
27086 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27087 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27088 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27089 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27091 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27092 CHECK_ACCESS(logger_ptr);
27093 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27094 if (logger_conv.free == LDKLogger_JCalls_free) {
27095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27096 LDKLogger_JCalls_cloned(&logger_conv);
27098 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
27099 CHECK_ACCESS(keys_manager_ptr);
27100 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27101 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27103 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27105 LDKUserConfig config_conv;
27106 config_conv.inner = (void*)(config & (~1));
27107 config_conv.is_owned = (config & 1) || (config == 0);
27108 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27109 config_conv = UserConfig_clone(&config_conv);
27110 LDKChainParameters params_conv;
27111 params_conv.inner = (void*)(params & (~1));
27112 params_conv.is_owned = (params & 1) || (params == 0);
27113 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
27114 params_conv = ChainParameters_clone(¶ms_conv);
27115 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
27116 uint32_t ret_ref = 0;
27117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27120 ret_ref = (uintptr_t)ret_var.inner;
27121 if (ret_var.is_owned) {
27127 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
27128 LDKChannelManager this_arg_conv;
27129 this_arg_conv.inner = (void*)(this_arg & (~1));
27130 this_arg_conv.is_owned = false;
27131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27132 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
27133 uint32_t ret_ref = 0;
27134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27137 ret_ref = (uintptr_t)ret_var.inner;
27138 if (ret_var.is_owned) {
27144 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) {
27145 LDKChannelManager this_arg_conv;
27146 this_arg_conv.inner = (void*)(this_arg & (~1));
27147 this_arg_conv.is_owned = false;
27148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27149 LDKPublicKey their_network_key_ref;
27150 CHECK(their_network_key->arr_len == 33);
27151 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
27152 LDKUserConfig override_config_conv;
27153 override_config_conv.inner = (void*)(override_config & (~1));
27154 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
27155 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
27156 override_config_conv = UserConfig_clone(&override_config_conv);
27157 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
27158 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
27159 return (uint32_t)ret_conv;
27162 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
27163 LDKChannelManager this_arg_conv;
27164 this_arg_conv.inner = (void*)(this_arg & (~1));
27165 this_arg_conv.is_owned = false;
27166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27167 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
27168 uint32_tArray ret_arr = NULL;
27169 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
27170 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27171 for (size_t q = 0; q < ret_var.datalen; q++) {
27172 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27173 uint32_t ret_conv_16_ref = 0;
27174 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27175 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27177 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
27178 if (ret_conv_16_var.is_owned) {
27179 ret_conv_16_ref |= 1;
27181 ret_arr_ptr[q] = ret_conv_16_ref;
27184 FREE(ret_var.data);
27188 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
27189 LDKChannelManager this_arg_conv;
27190 this_arg_conv.inner = (void*)(this_arg & (~1));
27191 this_arg_conv.is_owned = false;
27192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27193 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
27194 uint32_tArray ret_arr = NULL;
27195 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
27196 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
27197 for (size_t q = 0; q < ret_var.datalen; q++) {
27198 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27199 uint32_t ret_conv_16_ref = 0;
27200 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27201 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27203 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
27204 if (ret_conv_16_var.is_owned) {
27205 ret_conv_16_ref |= 1;
27207 ret_arr_ptr[q] = ret_conv_16_ref;
27210 FREE(ret_var.data);
27214 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) {
27215 LDKChannelManager this_arg_conv;
27216 this_arg_conv.inner = (void*)(this_arg & (~1));
27217 this_arg_conv.is_owned = false;
27218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27219 unsigned char channel_id_arr[32];
27220 CHECK(channel_id->arr_len == 32);
27221 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27222 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27223 LDKPublicKey counterparty_node_id_ref;
27224 CHECK(counterparty_node_id->arr_len == 33);
27225 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27226 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27227 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27228 return (uint32_t)ret_conv;
27231 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) {
27232 LDKChannelManager this_arg_conv;
27233 this_arg_conv.inner = (void*)(this_arg & (~1));
27234 this_arg_conv.is_owned = false;
27235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27236 unsigned char channel_id_arr[32];
27237 CHECK(channel_id->arr_len == 32);
27238 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27239 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27240 LDKPublicKey counterparty_node_id_ref;
27241 CHECK(counterparty_node_id->arr_len == 33);
27242 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27243 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27244 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
27245 return (uint32_t)ret_conv;
27248 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_broadcasting_latest_txn"))) TS_ChannelManager_force_close_broadcasting_latest_txn(uint32_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
27249 LDKChannelManager this_arg_conv;
27250 this_arg_conv.inner = (void*)(this_arg & (~1));
27251 this_arg_conv.is_owned = false;
27252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27253 unsigned char channel_id_arr[32];
27254 CHECK(channel_id->arr_len == 32);
27255 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27256 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27257 LDKPublicKey counterparty_node_id_ref;
27258 CHECK(counterparty_node_id->arr_len == 33);
27259 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27260 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27261 *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27262 return (uint32_t)ret_conv;
27265 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_without_broadcasting_txn"))) TS_ChannelManager_force_close_without_broadcasting_txn(uint32_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
27266 LDKChannelManager this_arg_conv;
27267 this_arg_conv.inner = (void*)(this_arg & (~1));
27268 this_arg_conv.is_owned = false;
27269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27270 unsigned char channel_id_arr[32];
27271 CHECK(channel_id->arr_len == 32);
27272 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27273 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27274 LDKPublicKey counterparty_node_id_ref;
27275 CHECK(counterparty_node_id->arr_len == 33);
27276 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27277 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27278 *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27279 return (uint32_t)ret_conv;
27282 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels_broadcasting_latest_txn"))) TS_ChannelManager_force_close_all_channels_broadcasting_latest_txn(uint32_t this_arg) {
27283 LDKChannelManager this_arg_conv;
27284 this_arg_conv.inner = (void*)(this_arg & (~1));
27285 this_arg_conv.is_owned = false;
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27287 ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
27290 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels_without_broadcasting_txn"))) TS_ChannelManager_force_close_all_channels_without_broadcasting_txn(uint32_t this_arg) {
27291 LDKChannelManager this_arg_conv;
27292 this_arg_conv.inner = (void*)(this_arg & (~1));
27293 this_arg_conv.is_owned = false;
27294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27295 ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
27298 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) {
27299 LDKChannelManager this_arg_conv;
27300 this_arg_conv.inner = (void*)(this_arg & (~1));
27301 this_arg_conv.is_owned = false;
27302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27303 LDKRoute route_conv;
27304 route_conv.inner = (void*)(route & (~1));
27305 route_conv.is_owned = false;
27306 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27307 LDKThirtyTwoBytes payment_hash_ref;
27308 CHECK(payment_hash->arr_len == 32);
27309 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27310 LDKThirtyTwoBytes payment_secret_ref;
27311 CHECK(payment_secret->arr_len == 32);
27312 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27313 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27314 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27315 return (uint32_t)ret_conv;
27318 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
27319 LDKChannelManager this_arg_conv;
27320 this_arg_conv.inner = (void*)(this_arg & (~1));
27321 this_arg_conv.is_owned = false;
27322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27323 LDKRoute route_conv;
27324 route_conv.inner = (void*)(route & (~1));
27325 route_conv.is_owned = false;
27326 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27327 LDKThirtyTwoBytes payment_id_ref;
27328 CHECK(payment_id->arr_len == 32);
27329 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27330 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27331 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27332 return (uint32_t)ret_conv;
27335 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
27336 LDKChannelManager this_arg_conv;
27337 this_arg_conv.inner = (void*)(this_arg & (~1));
27338 this_arg_conv.is_owned = false;
27339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27340 LDKThirtyTwoBytes payment_id_ref;
27341 CHECK(payment_id->arr_len == 32);
27342 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27343 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27346 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) {
27347 LDKChannelManager this_arg_conv;
27348 this_arg_conv.inner = (void*)(this_arg & (~1));
27349 this_arg_conv.is_owned = false;
27350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27351 LDKRoute route_conv;
27352 route_conv.inner = (void*)(route & (~1));
27353 route_conv.is_owned = false;
27354 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27355 LDKThirtyTwoBytes payment_preimage_ref;
27356 CHECK(payment_preimage->arr_len == 32);
27357 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27358 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27359 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27360 return (uint32_t)ret_conv;
27363 uint32_t __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint32_t this_arg, uint32_tArray hops) {
27364 LDKChannelManager this_arg_conv;
27365 this_arg_conv.inner = (void*)(this_arg & (~1));
27366 this_arg_conv.is_owned = false;
27367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27368 LDKCVec_RouteHopZ hops_constr;
27369 hops_constr.datalen = hops->arr_len;
27370 if (hops_constr.datalen > 0)
27371 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27373 hops_constr.data = NULL;
27374 uint32_t* hops_vals = hops->elems;
27375 for (size_t k = 0; k < hops_constr.datalen; k++) {
27376 uint32_t hops_conv_10 = hops_vals[k];
27377 LDKRouteHop hops_conv_10_conv;
27378 hops_conv_10_conv.inner = (void*)(hops_conv_10 & (~1));
27379 hops_conv_10_conv.is_owned = (hops_conv_10 & 1) || (hops_conv_10 == 0);
27380 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
27381 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
27382 hops_constr.data[k] = hops_conv_10_conv;
27385 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27386 *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
27387 return (uint32_t)ret_conv;
27390 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) {
27391 LDKChannelManager this_arg_conv;
27392 this_arg_conv.inner = (void*)(this_arg & (~1));
27393 this_arg_conv.is_owned = false;
27394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27395 unsigned char temporary_channel_id_arr[32];
27396 CHECK(temporary_channel_id->arr_len == 32);
27397 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27398 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27399 LDKPublicKey counterparty_node_id_ref;
27400 CHECK(counterparty_node_id->arr_len == 33);
27401 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27402 LDKTransaction funding_transaction_ref;
27403 funding_transaction_ref.datalen = funding_transaction->arr_len;
27404 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27405 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
27406 funding_transaction_ref.data_is_owned = true;
27407 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27408 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
27409 return (uint32_t)ret_conv;
27412 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) {
27413 LDKChannelManager this_arg_conv;
27414 this_arg_conv.inner = (void*)(this_arg & (~1));
27415 this_arg_conv.is_owned = false;
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27417 LDKThreeBytes rgb_ref;
27418 CHECK(rgb->arr_len == 3);
27419 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
27420 LDKThirtyTwoBytes alias_ref;
27421 CHECK(alias->arr_len == 32);
27422 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
27423 LDKCVec_NetAddressZ addresses_constr;
27424 addresses_constr.datalen = addresses->arr_len;
27425 if (addresses_constr.datalen > 0)
27426 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27428 addresses_constr.data = NULL;
27429 uint32_t* addresses_vals = addresses->elems;
27430 for (size_t m = 0; m < addresses_constr.datalen; m++) {
27431 uint32_t addresses_conv_12 = addresses_vals[m];
27432 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
27433 CHECK_ACCESS(addresses_conv_12_ptr);
27434 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
27435 addresses_constr.data[m] = addresses_conv_12_conv;
27438 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
27441 uint32_t __attribute__((export_name("TS_ChannelManager_update_channel_config"))) TS_ChannelManager_update_channel_config(uint32_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, uint32_t config) {
27442 LDKChannelManager this_arg_conv;
27443 this_arg_conv.inner = (void*)(this_arg & (~1));
27444 this_arg_conv.is_owned = false;
27445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27446 LDKPublicKey counterparty_node_id_ref;
27447 CHECK(counterparty_node_id->arr_len == 33);
27448 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27449 LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
27450 channel_ids_constr.datalen = channel_ids->arr_len;
27451 if (channel_ids_constr.datalen > 0)
27452 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
27454 channel_ids_constr.data = NULL;
27455 int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
27456 for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
27457 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
27458 LDKThirtyTwoBytes channel_ids_conv_12_ref;
27459 CHECK(channel_ids_conv_12->arr_len == 32);
27460 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
27461 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
27464 LDKChannelConfig config_conv;
27465 config_conv.inner = (void*)(config & (~1));
27466 config_conv.is_owned = false;
27467 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27468 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27469 *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
27470 return (uint32_t)ret_conv;
27473 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
27474 LDKChannelManager this_arg_conv;
27475 this_arg_conv.inner = (void*)(this_arg & (~1));
27476 this_arg_conv.is_owned = false;
27477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27478 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27481 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
27482 LDKChannelManager this_arg_conv;
27483 this_arg_conv.inner = (void*)(this_arg & (~1));
27484 this_arg_conv.is_owned = false;
27485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27486 ChannelManager_timer_tick_occurred(&this_arg_conv);
27489 void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
27490 LDKChannelManager this_arg_conv;
27491 this_arg_conv.inner = (void*)(this_arg & (~1));
27492 this_arg_conv.is_owned = false;
27493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27494 unsigned char payment_hash_arr[32];
27495 CHECK(payment_hash->arr_len == 32);
27496 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
27497 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27498 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27501 void __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
27502 LDKChannelManager this_arg_conv;
27503 this_arg_conv.inner = (void*)(this_arg & (~1));
27504 this_arg_conv.is_owned = false;
27505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27506 LDKThirtyTwoBytes payment_preimage_ref;
27507 CHECK(payment_preimage->arr_len == 32);
27508 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27509 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27512 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
27513 LDKChannelManager this_arg_conv;
27514 this_arg_conv.inner = (void*)(this_arg & (~1));
27515 this_arg_conv.is_owned = false;
27516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27517 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27518 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
27522 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) {
27523 LDKChannelManager this_arg_conv;
27524 this_arg_conv.inner = (void*)(this_arg & (~1));
27525 this_arg_conv.is_owned = false;
27526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27527 unsigned char temporary_channel_id_arr[32];
27528 CHECK(temporary_channel_id->arr_len == 32);
27529 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27530 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27531 LDKPublicKey counterparty_node_id_ref;
27532 CHECK(counterparty_node_id->arr_len == 33);
27533 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27534 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27535 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27536 return (uint32_t)ret_conv;
27539 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) {
27540 LDKChannelManager this_arg_conv;
27541 this_arg_conv.inner = (void*)(this_arg & (~1));
27542 this_arg_conv.is_owned = false;
27543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27544 unsigned char temporary_channel_id_arr[32];
27545 CHECK(temporary_channel_id->arr_len == 32);
27546 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27547 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27548 LDKPublicKey counterparty_node_id_ref;
27549 CHECK(counterparty_node_id->arr_len == 33);
27550 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27551 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27552 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27553 return (uint32_t)ret_conv;
27556 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) {
27557 LDKChannelManager this_arg_conv;
27558 this_arg_conv.inner = (void*)(this_arg & (~1));
27559 this_arg_conv.is_owned = false;
27560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27561 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27562 CHECK_ACCESS(min_value_msat_ptr);
27563 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27564 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27565 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27566 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27567 return (uint32_t)ret_conv;
27570 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) {
27571 LDKChannelManager this_arg_conv;
27572 this_arg_conv.inner = (void*)(this_arg & (~1));
27573 this_arg_conv.is_owned = false;
27574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27575 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27576 CHECK_ACCESS(min_value_msat_ptr);
27577 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27578 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27579 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27580 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27581 return (uint32_t)ret_conv;
27584 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) {
27585 LDKChannelManager this_arg_conv;
27586 this_arg_conv.inner = (void*)(this_arg & (~1));
27587 this_arg_conv.is_owned = false;
27588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27589 LDKThirtyTwoBytes payment_hash_ref;
27590 CHECK(payment_hash->arr_len == 32);
27591 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27592 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27593 CHECK_ACCESS(min_value_msat_ptr);
27594 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27595 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27596 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27597 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27598 return (uint32_t)ret_conv;
27601 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) {
27602 LDKChannelManager this_arg_conv;
27603 this_arg_conv.inner = (void*)(this_arg & (~1));
27604 this_arg_conv.is_owned = false;
27605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27606 LDKThirtyTwoBytes payment_hash_ref;
27607 CHECK(payment_hash->arr_len == 32);
27608 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27609 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27610 CHECK_ACCESS(min_value_msat_ptr);
27611 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27612 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27613 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27614 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27615 return (uint32_t)ret_conv;
27618 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) {
27619 LDKChannelManager this_arg_conv;
27620 this_arg_conv.inner = (void*)(this_arg & (~1));
27621 this_arg_conv.is_owned = false;
27622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27623 LDKThirtyTwoBytes payment_hash_ref;
27624 CHECK(payment_hash->arr_len == 32);
27625 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27626 LDKThirtyTwoBytes payment_secret_ref;
27627 CHECK(payment_secret->arr_len == 32);
27628 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27629 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27630 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27631 return (uint32_t)ret_conv;
27634 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
27635 LDKChannelManager this_arg_conv;
27636 this_arg_conv.inner = (void*)(this_arg & (~1));
27637 this_arg_conv.is_owned = false;
27638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27639 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
27643 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
27644 LDKChannelManager this_arg_conv;
27645 this_arg_conv.inner = (void*)(this_arg & (~1));
27646 this_arg_conv.is_owned = false;
27647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27648 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
27649 uint32_t ret_ref = 0;
27650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27653 ret_ref = (uintptr_t)ret_var.inner;
27654 if (ret_var.is_owned) {
27660 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
27661 LDKChannelManager this_arg_conv;
27662 this_arg_conv.inner = (void*)(this_arg & (~1));
27663 this_arg_conv.is_owned = false;
27664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27665 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27666 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27667 return (uint32_t)ret_ret;
27670 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
27671 LDKChannelManager this_arg_conv;
27672 this_arg_conv.inner = (void*)(this_arg & (~1));
27673 this_arg_conv.is_owned = false;
27674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27675 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27676 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27677 return (uint32_t)ret_ret;
27680 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
27681 LDKChannelManager this_arg_conv;
27682 this_arg_conv.inner = (void*)(this_arg & (~1));
27683 this_arg_conv.is_owned = false;
27684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27685 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27686 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27687 return (uint32_t)ret_ret;
27690 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
27691 LDKChannelManager this_arg_conv;
27692 this_arg_conv.inner = (void*)(this_arg & (~1));
27693 this_arg_conv.is_owned = false;
27694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27695 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27696 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27697 return (uint32_t)ret_ret;
27700 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
27701 LDKChannelManager this_arg_conv;
27702 this_arg_conv.inner = (void*)(this_arg & (~1));
27703 this_arg_conv.is_owned = false;
27704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27705 ChannelManager_await_persistable_update(&this_arg_conv);
27708 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
27709 LDKChannelManager this_arg_conv;
27710 this_arg_conv.inner = (void*)(this_arg & (~1));
27711 this_arg_conv.is_owned = false;
27712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27713 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
27714 uint32_t ret_ref = 0;
27715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27718 ret_ref = (uintptr_t)ret_var.inner;
27719 if (ret_var.is_owned) {
27725 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
27726 LDKChannelManager this_arg_conv;
27727 this_arg_conv.inner = (void*)(this_arg & (~1));
27728 this_arg_conv.is_owned = false;
27729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27730 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27731 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
27732 return (uint32_t)ret_ret;
27735 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
27736 LDKCounterpartyForwardingInfo obj_conv;
27737 obj_conv.inner = (void*)(obj & (~1));
27738 obj_conv.is_owned = false;
27739 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27740 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
27741 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27742 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27743 CVec_u8Z_free(ret_var);
27747 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
27748 LDKu8slice ser_ref;
27749 ser_ref.datalen = ser->arr_len;
27750 ser_ref.data = ser->elems;
27751 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
27752 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
27754 return (uint32_t)ret_conv;
27757 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
27758 LDKChannelCounterparty obj_conv;
27759 obj_conv.inner = (void*)(obj & (~1));
27760 obj_conv.is_owned = false;
27761 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27762 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
27763 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27764 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27765 CVec_u8Z_free(ret_var);
27769 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
27770 LDKu8slice ser_ref;
27771 ser_ref.datalen = ser->arr_len;
27772 ser_ref.data = ser->elems;
27773 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
27774 *ret_conv = ChannelCounterparty_read(ser_ref);
27776 return (uint32_t)ret_conv;
27779 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
27780 LDKChannelDetails obj_conv;
27781 obj_conv.inner = (void*)(obj & (~1));
27782 obj_conv.is_owned = false;
27783 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27784 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
27785 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27786 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27787 CVec_u8Z_free(ret_var);
27791 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
27792 LDKu8slice ser_ref;
27793 ser_ref.datalen = ser->arr_len;
27794 ser_ref.data = ser->elems;
27795 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
27796 *ret_conv = ChannelDetails_read(ser_ref);
27798 return (uint32_t)ret_conv;
27801 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
27802 LDKPhantomRouteHints obj_conv;
27803 obj_conv.inner = (void*)(obj & (~1));
27804 obj_conv.is_owned = false;
27805 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27806 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
27807 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27808 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27809 CVec_u8Z_free(ret_var);
27813 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
27814 LDKu8slice ser_ref;
27815 ser_ref.datalen = ser->arr_len;
27816 ser_ref.data = ser->elems;
27817 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
27818 *ret_conv = PhantomRouteHints_read(ser_ref);
27820 return (uint32_t)ret_conv;
27823 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
27824 LDKChannelManager obj_conv;
27825 obj_conv.inner = (void*)(obj & (~1));
27826 obj_conv.is_owned = false;
27827 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27828 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
27829 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27830 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27831 CVec_u8Z_free(ret_var);
27835 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
27836 LDKChannelManagerReadArgs this_obj_conv;
27837 this_obj_conv.inner = (void*)(this_obj & (~1));
27838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27840 ChannelManagerReadArgs_free(this_obj_conv);
27843 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
27844 LDKChannelManagerReadArgs this_ptr_conv;
27845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27846 this_ptr_conv.is_owned = false;
27847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27848 // WARNING: This object doesn't live past this scope, needs clone!
27849 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
27853 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
27854 LDKChannelManagerReadArgs this_ptr_conv;
27855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27856 this_ptr_conv.is_owned = false;
27857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27858 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27859 CHECK_ACCESS(val_ptr);
27860 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
27861 if (val_conv.free == LDKKeysInterface_JCalls_free) {
27862 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27863 LDKKeysInterface_JCalls_cloned(&val_conv);
27865 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
27868 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
27869 LDKChannelManagerReadArgs this_ptr_conv;
27870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27871 this_ptr_conv.is_owned = false;
27872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27873 // WARNING: This object doesn't live past this scope, needs clone!
27874 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
27878 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
27879 LDKChannelManagerReadArgs this_ptr_conv;
27880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27881 this_ptr_conv.is_owned = false;
27882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27883 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27884 CHECK_ACCESS(val_ptr);
27885 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
27886 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
27887 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27888 LDKFeeEstimator_JCalls_cloned(&val_conv);
27890 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
27893 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
27894 LDKChannelManagerReadArgs this_ptr_conv;
27895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27896 this_ptr_conv.is_owned = false;
27897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27898 // WARNING: This object doesn't live past this scope, needs clone!
27899 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
27903 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
27904 LDKChannelManagerReadArgs 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27909 CHECK_ACCESS(val_ptr);
27910 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
27911 if (val_conv.free == LDKWatch_JCalls_free) {
27912 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27913 LDKWatch_JCalls_cloned(&val_conv);
27915 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
27918 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
27919 LDKChannelManagerReadArgs this_ptr_conv;
27920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27921 this_ptr_conv.is_owned = false;
27922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27923 // WARNING: This object doesn't live past this scope, needs clone!
27924 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
27928 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
27929 LDKChannelManagerReadArgs this_ptr_conv;
27930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27931 this_ptr_conv.is_owned = false;
27932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27933 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27934 CHECK_ACCESS(val_ptr);
27935 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
27936 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
27937 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27938 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
27940 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
27943 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
27944 LDKChannelManagerReadArgs this_ptr_conv;
27945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27946 this_ptr_conv.is_owned = false;
27947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27948 // WARNING: This object doesn't live past this scope, needs clone!
27949 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
27953 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
27954 LDKChannelManagerReadArgs this_ptr_conv;
27955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27956 this_ptr_conv.is_owned = false;
27957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27958 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27959 CHECK_ACCESS(val_ptr);
27960 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
27961 if (val_conv.free == LDKLogger_JCalls_free) {
27962 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27963 LDKLogger_JCalls_cloned(&val_conv);
27965 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
27968 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
27969 LDKChannelManagerReadArgs this_ptr_conv;
27970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27971 this_ptr_conv.is_owned = false;
27972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27973 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
27974 uint32_t ret_ref = 0;
27975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27978 ret_ref = (uintptr_t)ret_var.inner;
27979 if (ret_var.is_owned) {
27985 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
27986 LDKChannelManagerReadArgs this_ptr_conv;
27987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27988 this_ptr_conv.is_owned = false;
27989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27990 LDKUserConfig val_conv;
27991 val_conv.inner = (void*)(val & (~1));
27992 val_conv.is_owned = (val & 1) || (val == 0);
27993 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27994 val_conv = UserConfig_clone(&val_conv);
27995 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
27998 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) {
27999 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28000 CHECK_ACCESS(keys_manager_ptr);
28001 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28002 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28004 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28006 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
28007 CHECK_ACCESS(fee_estimator_ptr);
28008 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28009 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28010 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28011 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28013 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
28014 CHECK_ACCESS(chain_monitor_ptr);
28015 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28016 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28017 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28018 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28020 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
28021 CHECK_ACCESS(tx_broadcaster_ptr);
28022 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28023 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28025 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28027 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
28028 CHECK_ACCESS(logger_ptr);
28029 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28030 if (logger_conv.free == LDKLogger_JCalls_free) {
28031 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28032 LDKLogger_JCalls_cloned(&logger_conv);
28034 LDKUserConfig default_config_conv;
28035 default_config_conv.inner = (void*)(default_config & (~1));
28036 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
28037 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
28038 default_config_conv = UserConfig_clone(&default_config_conv);
28039 LDKCVec_ChannelMonitorZ channel_monitors_constr;
28040 channel_monitors_constr.datalen = channel_monitors->arr_len;
28041 if (channel_monitors_constr.datalen > 0)
28042 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28044 channel_monitors_constr.data = NULL;
28045 uint32_t* channel_monitors_vals = channel_monitors->elems;
28046 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
28047 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
28048 LDKChannelMonitor channel_monitors_conv_16_conv;
28049 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
28050 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
28051 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
28052 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
28054 FREE(channel_monitors);
28055 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);
28056 uint32_t ret_ref = 0;
28057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28060 ret_ref = (uintptr_t)ret_var.inner;
28061 if (ret_var.is_owned) {
28067 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
28068 LDKu8slice ser_ref;
28069 ser_ref.datalen = ser->arr_len;
28070 ser_ref.data = ser->elems;
28071 LDKChannelManagerReadArgs arg_conv;
28072 arg_conv.inner = (void*)(arg & (~1));
28073 arg_conv.is_owned = (arg & 1) || (arg == 0);
28074 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28075 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
28076 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
28077 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
28079 return (uint32_t)ret_conv;
28082 void __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint32_t this_obj) {
28083 LDKExpandedKey this_obj_conv;
28084 this_obj_conv.inner = (void*)(this_obj & (~1));
28085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28087 ExpandedKey_free(this_obj_conv);
28090 uint32_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
28091 unsigned char key_material_arr[32];
28092 CHECK(key_material->arr_len == 32);
28093 memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
28094 unsigned char (*key_material_ref)[32] = &key_material_arr;
28095 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
28096 uint32_t ret_ref = 0;
28097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28100 ret_ref = (uintptr_t)ret_var.inner;
28101 if (ret_var.is_owned) {
28107 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) {
28108 LDKExpandedKey keys_conv;
28109 keys_conv.inner = (void*)(keys & (~1));
28110 keys_conv.is_owned = false;
28111 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28112 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28113 CHECK_ACCESS(min_value_msat_ptr);
28114 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28115 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28116 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28117 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
28118 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
28119 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28120 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
28121 return (uint32_t)ret_conv;
28124 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) {
28125 LDKExpandedKey keys_conv;
28126 keys_conv.inner = (void*)(keys & (~1));
28127 keys_conv.is_owned = false;
28128 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28129 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28130 CHECK_ACCESS(min_value_msat_ptr);
28131 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28132 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28133 LDKThirtyTwoBytes payment_hash_ref;
28134 CHECK(payment_hash->arr_len == 32);
28135 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28136 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28137 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
28138 return (uint32_t)ret_conv;
28141 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
28142 LDKDecodeError this_obj_conv;
28143 this_obj_conv.inner = (void*)(this_obj & (~1));
28144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28146 DecodeError_free(this_obj_conv);
28149 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
28150 LDKDecodeError ret_var = DecodeError_clone(arg);
28151 uint32_t ret_ref = 0;
28152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28155 ret_ref = (uintptr_t)ret_var.inner;
28156 if (ret_var.is_owned) {
28161 uint32_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
28162 LDKDecodeError arg_conv;
28163 arg_conv.inner = (void*)(arg & (~1));
28164 arg_conv.is_owned = false;
28165 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28166 uint32_t ret_conv = DecodeError_clone_ptr(&arg_conv);
28170 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
28171 LDKDecodeError orig_conv;
28172 orig_conv.inner = (void*)(orig & (~1));
28173 orig_conv.is_owned = false;
28174 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28175 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
28176 uint32_t ret_ref = 0;
28177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28180 ret_ref = (uintptr_t)ret_var.inner;
28181 if (ret_var.is_owned) {
28187 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
28188 LDKInit this_obj_conv;
28189 this_obj_conv.inner = (void*)(this_obj & (~1));
28190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28192 Init_free(this_obj_conv);
28195 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
28196 LDKInit this_ptr_conv;
28197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28198 this_ptr_conv.is_owned = false;
28199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28200 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
28201 uint32_t ret_ref = 0;
28202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28205 ret_ref = (uintptr_t)ret_var.inner;
28206 if (ret_var.is_owned) {
28212 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
28213 LDKInit this_ptr_conv;
28214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28215 this_ptr_conv.is_owned = false;
28216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28217 LDKInitFeatures val_conv;
28218 val_conv.inner = (void*)(val & (~1));
28219 val_conv.is_owned = (val & 1) || (val == 0);
28220 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28221 val_conv = InitFeatures_clone(&val_conv);
28222 Init_set_features(&this_ptr_conv, val_conv);
28225 uint32_t __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint32_t this_ptr) {
28226 LDKInit this_ptr_conv;
28227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28228 this_ptr_conv.is_owned = false;
28229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28230 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
28231 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
28232 uint32_t ret_ref = (uintptr_t)ret_copy;
28236 void __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint32_t this_ptr, uint32_t val) {
28237 LDKInit this_ptr_conv;
28238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28239 this_ptr_conv.is_owned = false;
28240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28241 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28242 CHECK_ACCESS(val_ptr);
28243 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
28244 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
28245 Init_set_remote_network_address(&this_ptr_conv, val_conv);
28248 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg, uint32_t remote_network_address_arg) {
28249 LDKInitFeatures features_arg_conv;
28250 features_arg_conv.inner = (void*)(features_arg & (~1));
28251 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28252 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28253 features_arg_conv = InitFeatures_clone(&features_arg_conv);
28254 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
28255 CHECK_ACCESS(remote_network_address_arg_ptr);
28256 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
28257 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
28258 uint32_t ret_ref = 0;
28259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28262 ret_ref = (uintptr_t)ret_var.inner;
28263 if (ret_var.is_owned) {
28269 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
28270 LDKInit ret_var = Init_clone(arg);
28271 uint32_t ret_ref = 0;
28272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28275 ret_ref = (uintptr_t)ret_var.inner;
28276 if (ret_var.is_owned) {
28281 uint32_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
28283 arg_conv.inner = (void*)(arg & (~1));
28284 arg_conv.is_owned = false;
28285 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28286 uint32_t ret_conv = Init_clone_ptr(&arg_conv);
28290 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
28292 orig_conv.inner = (void*)(orig & (~1));
28293 orig_conv.is_owned = false;
28294 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28295 LDKInit ret_var = Init_clone(&orig_conv);
28296 uint32_t ret_ref = 0;
28297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28300 ret_ref = (uintptr_t)ret_var.inner;
28301 if (ret_var.is_owned) {
28307 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
28308 LDKErrorMessage this_obj_conv;
28309 this_obj_conv.inner = (void*)(this_obj & (~1));
28310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28312 ErrorMessage_free(this_obj_conv);
28315 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
28316 LDKErrorMessage this_ptr_conv;
28317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28318 this_ptr_conv.is_owned = false;
28319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28320 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28321 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
28325 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28326 LDKErrorMessage this_ptr_conv;
28327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28328 this_ptr_conv.is_owned = false;
28329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28330 LDKThirtyTwoBytes val_ref;
28331 CHECK(val->arr_len == 32);
28332 memcpy(val_ref.data, val->elems, 32); FREE(val);
28333 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
28336 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
28337 LDKErrorMessage this_ptr_conv;
28338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28339 this_ptr_conv.is_owned = false;
28340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28341 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
28342 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28347 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
28348 LDKErrorMessage this_ptr_conv;
28349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28350 this_ptr_conv.is_owned = false;
28351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28352 LDKStr val_conv = str_ref_to_owned_c(val);
28353 ErrorMessage_set_data(&this_ptr_conv, val_conv);
28356 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28357 LDKThirtyTwoBytes channel_id_arg_ref;
28358 CHECK(channel_id_arg->arr_len == 32);
28359 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28360 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28361 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
28362 uint32_t ret_ref = 0;
28363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28366 ret_ref = (uintptr_t)ret_var.inner;
28367 if (ret_var.is_owned) {
28373 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
28374 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
28375 uint32_t ret_ref = 0;
28376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28379 ret_ref = (uintptr_t)ret_var.inner;
28380 if (ret_var.is_owned) {
28385 uint32_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
28386 LDKErrorMessage arg_conv;
28387 arg_conv.inner = (void*)(arg & (~1));
28388 arg_conv.is_owned = false;
28389 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28390 uint32_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
28394 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
28395 LDKErrorMessage orig_conv;
28396 orig_conv.inner = (void*)(orig & (~1));
28397 orig_conv.is_owned = false;
28398 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28399 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
28400 uint32_t ret_ref = 0;
28401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28404 ret_ref = (uintptr_t)ret_var.inner;
28405 if (ret_var.is_owned) {
28411 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
28412 LDKWarningMessage this_obj_conv;
28413 this_obj_conv.inner = (void*)(this_obj & (~1));
28414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28416 WarningMessage_free(this_obj_conv);
28419 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
28420 LDKWarningMessage this_ptr_conv;
28421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28422 this_ptr_conv.is_owned = false;
28423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28424 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28425 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
28429 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28430 LDKWarningMessage this_ptr_conv;
28431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28432 this_ptr_conv.is_owned = false;
28433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28434 LDKThirtyTwoBytes val_ref;
28435 CHECK(val->arr_len == 32);
28436 memcpy(val_ref.data, val->elems, 32); FREE(val);
28437 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
28440 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
28441 LDKWarningMessage this_ptr_conv;
28442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28443 this_ptr_conv.is_owned = false;
28444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28445 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
28446 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28451 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
28452 LDKWarningMessage this_ptr_conv;
28453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28454 this_ptr_conv.is_owned = false;
28455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28456 LDKStr val_conv = str_ref_to_owned_c(val);
28457 WarningMessage_set_data(&this_ptr_conv, val_conv);
28460 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28461 LDKThirtyTwoBytes channel_id_arg_ref;
28462 CHECK(channel_id_arg->arr_len == 32);
28463 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28464 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28465 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
28466 uint32_t ret_ref = 0;
28467 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28468 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28470 ret_ref = (uintptr_t)ret_var.inner;
28471 if (ret_var.is_owned) {
28477 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
28478 LDKWarningMessage ret_var = WarningMessage_clone(arg);
28479 uint32_t ret_ref = 0;
28480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28483 ret_ref = (uintptr_t)ret_var.inner;
28484 if (ret_var.is_owned) {
28489 uint32_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
28490 LDKWarningMessage arg_conv;
28491 arg_conv.inner = (void*)(arg & (~1));
28492 arg_conv.is_owned = false;
28493 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28494 uint32_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
28498 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
28499 LDKWarningMessage orig_conv;
28500 orig_conv.inner = (void*)(orig & (~1));
28501 orig_conv.is_owned = false;
28502 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28503 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
28504 uint32_t ret_ref = 0;
28505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28508 ret_ref = (uintptr_t)ret_var.inner;
28509 if (ret_var.is_owned) {
28515 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
28516 LDKPing this_obj_conv;
28517 this_obj_conv.inner = (void*)(this_obj & (~1));
28518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28520 Ping_free(this_obj_conv);
28523 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
28524 LDKPing this_ptr_conv;
28525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28526 this_ptr_conv.is_owned = false;
28527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28528 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
28532 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
28533 LDKPing this_ptr_conv;
28534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28535 this_ptr_conv.is_owned = false;
28536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28537 Ping_set_ponglen(&this_ptr_conv, val);
28540 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
28541 LDKPing this_ptr_conv;
28542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28543 this_ptr_conv.is_owned = false;
28544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28545 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
28549 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
28550 LDKPing this_ptr_conv;
28551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28552 this_ptr_conv.is_owned = false;
28553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28554 Ping_set_byteslen(&this_ptr_conv, val);
28557 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
28558 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
28559 uint32_t ret_ref = 0;
28560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28563 ret_ref = (uintptr_t)ret_var.inner;
28564 if (ret_var.is_owned) {
28570 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
28571 LDKPing ret_var = Ping_clone(arg);
28572 uint32_t ret_ref = 0;
28573 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28574 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28576 ret_ref = (uintptr_t)ret_var.inner;
28577 if (ret_var.is_owned) {
28582 uint32_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
28584 arg_conv.inner = (void*)(arg & (~1));
28585 arg_conv.is_owned = false;
28586 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28587 uint32_t ret_conv = Ping_clone_ptr(&arg_conv);
28591 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
28593 orig_conv.inner = (void*)(orig & (~1));
28594 orig_conv.is_owned = false;
28595 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28596 LDKPing ret_var = Ping_clone(&orig_conv);
28597 uint32_t ret_ref = 0;
28598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28601 ret_ref = (uintptr_t)ret_var.inner;
28602 if (ret_var.is_owned) {
28608 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
28609 LDKPong this_obj_conv;
28610 this_obj_conv.inner = (void*)(this_obj & (~1));
28611 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28613 Pong_free(this_obj_conv);
28616 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
28617 LDKPong 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 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
28625 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
28626 LDKPong this_ptr_conv;
28627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28628 this_ptr_conv.is_owned = false;
28629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28630 Pong_set_byteslen(&this_ptr_conv, val);
28633 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
28634 LDKPong ret_var = Pong_new(byteslen_arg);
28635 uint32_t ret_ref = 0;
28636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28639 ret_ref = (uintptr_t)ret_var.inner;
28640 if (ret_var.is_owned) {
28646 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
28647 LDKPong ret_var = Pong_clone(arg);
28648 uint32_t ret_ref = 0;
28649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28652 ret_ref = (uintptr_t)ret_var.inner;
28653 if (ret_var.is_owned) {
28658 uint32_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
28660 arg_conv.inner = (void*)(arg & (~1));
28661 arg_conv.is_owned = false;
28662 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28663 uint32_t ret_conv = Pong_clone_ptr(&arg_conv);
28667 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
28669 orig_conv.inner = (void*)(orig & (~1));
28670 orig_conv.is_owned = false;
28671 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28672 LDKPong ret_var = Pong_clone(&orig_conv);
28673 uint32_t ret_ref = 0;
28674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28677 ret_ref = (uintptr_t)ret_var.inner;
28678 if (ret_var.is_owned) {
28684 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
28685 LDKOpenChannel this_obj_conv;
28686 this_obj_conv.inner = (void*)(this_obj & (~1));
28687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28689 OpenChannel_free(this_obj_conv);
28692 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
28693 LDKOpenChannel this_ptr_conv;
28694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28695 this_ptr_conv.is_owned = false;
28696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28697 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28698 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
28702 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
28703 LDKOpenChannel 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 LDKThirtyTwoBytes val_ref;
28708 CHECK(val->arr_len == 32);
28709 memcpy(val_ref.data, val->elems, 32); FREE(val);
28710 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
28713 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
28714 LDKOpenChannel this_ptr_conv;
28715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28716 this_ptr_conv.is_owned = false;
28717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28718 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28719 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28723 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28724 LDKOpenChannel 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 LDKThirtyTwoBytes val_ref;
28729 CHECK(val->arr_len == 32);
28730 memcpy(val_ref.data, val->elems, 32); FREE(val);
28731 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28734 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
28735 LDKOpenChannel this_ptr_conv;
28736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28737 this_ptr_conv.is_owned = false;
28738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28739 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
28743 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
28744 LDKOpenChannel this_ptr_conv;
28745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28746 this_ptr_conv.is_owned = false;
28747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28748 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
28751 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
28752 LDKOpenChannel this_ptr_conv;
28753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28754 this_ptr_conv.is_owned = false;
28755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28756 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
28760 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
28761 LDKOpenChannel this_ptr_conv;
28762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28763 this_ptr_conv.is_owned = false;
28764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28765 OpenChannel_set_push_msat(&this_ptr_conv, val);
28768 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
28769 LDKOpenChannel this_ptr_conv;
28770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28771 this_ptr_conv.is_owned = false;
28772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28773 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
28777 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
28778 LDKOpenChannel this_ptr_conv;
28779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28780 this_ptr_conv.is_owned = false;
28781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28782 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28785 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) {
28786 LDKOpenChannel this_ptr_conv;
28787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28788 this_ptr_conv.is_owned = false;
28789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28790 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28794 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) {
28795 LDKOpenChannel this_ptr_conv;
28796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28797 this_ptr_conv.is_owned = false;
28798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28799 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28802 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
28803 LDKOpenChannel this_ptr_conv;
28804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28805 this_ptr_conv.is_owned = false;
28806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28807 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28811 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
28812 LDKOpenChannel this_ptr_conv;
28813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28814 this_ptr_conv.is_owned = false;
28815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28816 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28819 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
28820 LDKOpenChannel this_ptr_conv;
28821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28822 this_ptr_conv.is_owned = false;
28823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28824 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
28828 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
28829 LDKOpenChannel this_ptr_conv;
28830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28831 this_ptr_conv.is_owned = false;
28832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28833 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28836 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
28837 LDKOpenChannel 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 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
28845 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
28846 LDKOpenChannel this_ptr_conv;
28847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28848 this_ptr_conv.is_owned = false;
28849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28850 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
28853 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
28854 LDKOpenChannel this_ptr_conv;
28855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28856 this_ptr_conv.is_owned = false;
28857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28858 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
28862 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
28863 LDKOpenChannel this_ptr_conv;
28864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28865 this_ptr_conv.is_owned = false;
28866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28867 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
28870 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
28871 LDKOpenChannel this_ptr_conv;
28872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28873 this_ptr_conv.is_owned = false;
28874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28875 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
28879 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
28880 LDKOpenChannel this_ptr_conv;
28881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28882 this_ptr_conv.is_owned = false;
28883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28884 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28887 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
28888 LDKOpenChannel this_ptr_conv;
28889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28890 this_ptr_conv.is_owned = false;
28891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28892 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28893 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28897 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28898 LDKOpenChannel this_ptr_conv;
28899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28900 this_ptr_conv.is_owned = false;
28901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28902 LDKPublicKey val_ref;
28903 CHECK(val->arr_len == 33);
28904 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28905 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28908 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
28909 LDKOpenChannel this_ptr_conv;
28910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28911 this_ptr_conv.is_owned = false;
28912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28913 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28914 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28918 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28919 LDKOpenChannel this_ptr_conv;
28920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28921 this_ptr_conv.is_owned = false;
28922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28923 LDKPublicKey val_ref;
28924 CHECK(val->arr_len == 33);
28925 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28926 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28929 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
28930 LDKOpenChannel this_ptr_conv;
28931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28932 this_ptr_conv.is_owned = false;
28933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28934 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28935 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28939 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28940 LDKOpenChannel this_ptr_conv;
28941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28942 this_ptr_conv.is_owned = false;
28943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28944 LDKPublicKey val_ref;
28945 CHECK(val->arr_len == 33);
28946 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28947 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
28950 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
28951 LDKOpenChannel this_ptr_conv;
28952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28953 this_ptr_conv.is_owned = false;
28954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28955 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28956 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28960 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28961 LDKOpenChannel this_ptr_conv;
28962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28963 this_ptr_conv.is_owned = false;
28964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28965 LDKPublicKey val_ref;
28966 CHECK(val->arr_len == 33);
28967 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28968 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28971 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
28972 LDKOpenChannel this_ptr_conv;
28973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28974 this_ptr_conv.is_owned = false;
28975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28976 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28977 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28981 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28982 LDKOpenChannel this_ptr_conv;
28983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28984 this_ptr_conv.is_owned = false;
28985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28986 LDKPublicKey val_ref;
28987 CHECK(val->arr_len == 33);
28988 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28989 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28992 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
28993 LDKOpenChannel this_ptr_conv;
28994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28995 this_ptr_conv.is_owned = false;
28996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28997 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28998 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29002 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) {
29003 LDKOpenChannel this_ptr_conv;
29004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29005 this_ptr_conv.is_owned = false;
29006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29007 LDKPublicKey val_ref;
29008 CHECK(val->arr_len == 33);
29009 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29010 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29013 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
29014 LDKOpenChannel this_ptr_conv;
29015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29016 this_ptr_conv.is_owned = false;
29017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29018 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
29022 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
29023 LDKOpenChannel this_ptr_conv;
29024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29025 this_ptr_conv.is_owned = false;
29026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29027 OpenChannel_set_channel_flags(&this_ptr_conv, val);
29030 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
29031 LDKOpenChannel this_ptr_conv;
29032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29033 this_ptr_conv.is_owned = false;
29034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29035 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
29036 uint32_t ret_ref = 0;
29037 if ((uintptr_t)ret_var.inner > 4096) {
29038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29041 ret_ref = (uintptr_t)ret_var.inner;
29042 if (ret_var.is_owned) {
29049 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
29050 LDKOpenChannel 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 LDKChannelTypeFeatures val_conv;
29055 val_conv.inner = (void*)(val & (~1));
29056 val_conv.is_owned = (val & 1) || (val == 0);
29057 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29058 val_conv = ChannelTypeFeatures_clone(&val_conv);
29059 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
29062 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
29063 LDKOpenChannel ret_var = OpenChannel_clone(arg);
29064 uint32_t ret_ref = 0;
29065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29068 ret_ref = (uintptr_t)ret_var.inner;
29069 if (ret_var.is_owned) {
29074 uint32_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
29075 LDKOpenChannel arg_conv;
29076 arg_conv.inner = (void*)(arg & (~1));
29077 arg_conv.is_owned = false;
29078 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29079 uint32_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
29083 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
29084 LDKOpenChannel orig_conv;
29085 orig_conv.inner = (void*)(orig & (~1));
29086 orig_conv.is_owned = false;
29087 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29088 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
29089 uint32_t ret_ref = 0;
29090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29093 ret_ref = (uintptr_t)ret_var.inner;
29094 if (ret_var.is_owned) {
29100 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
29101 LDKAcceptChannel this_obj_conv;
29102 this_obj_conv.inner = (void*)(this_obj & (~1));
29103 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29105 AcceptChannel_free(this_obj_conv);
29108 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
29109 LDKAcceptChannel this_ptr_conv;
29110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29111 this_ptr_conv.is_owned = false;
29112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29113 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29114 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29118 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
29119 LDKAcceptChannel this_ptr_conv;
29120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29121 this_ptr_conv.is_owned = false;
29122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29123 LDKThirtyTwoBytes val_ref;
29124 CHECK(val->arr_len == 32);
29125 memcpy(val_ref.data, val->elems, 32); FREE(val);
29126 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29129 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
29130 LDKAcceptChannel this_ptr_conv;
29131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29132 this_ptr_conv.is_owned = false;
29133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29134 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
29138 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
29139 LDKAcceptChannel this_ptr_conv;
29140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29141 this_ptr_conv.is_owned = false;
29142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29143 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29146 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) {
29147 LDKAcceptChannel this_ptr_conv;
29148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29149 this_ptr_conv.is_owned = false;
29150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29151 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29155 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) {
29156 LDKAcceptChannel this_ptr_conv;
29157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29158 this_ptr_conv.is_owned = false;
29159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29160 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29163 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
29164 LDKAcceptChannel this_ptr_conv;
29165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29166 this_ptr_conv.is_owned = false;
29167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29168 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29172 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
29173 LDKAcceptChannel this_ptr_conv;
29174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29175 this_ptr_conv.is_owned = false;
29176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29177 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29180 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
29181 LDKAcceptChannel this_ptr_conv;
29182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29183 this_ptr_conv.is_owned = false;
29184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29185 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
29189 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
29190 LDKAcceptChannel this_ptr_conv;
29191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29192 this_ptr_conv.is_owned = false;
29193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29194 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29197 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
29198 LDKAcceptChannel this_ptr_conv;
29199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29200 this_ptr_conv.is_owned = false;
29201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29202 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
29206 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
29207 LDKAcceptChannel this_ptr_conv;
29208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29209 this_ptr_conv.is_owned = false;
29210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29211 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
29214 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
29215 LDKAcceptChannel this_ptr_conv;
29216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29217 this_ptr_conv.is_owned = false;
29218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29219 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
29223 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
29224 LDKAcceptChannel this_ptr_conv;
29225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29226 this_ptr_conv.is_owned = false;
29227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29228 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
29231 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
29232 LDKAcceptChannel this_ptr_conv;
29233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29234 this_ptr_conv.is_owned = false;
29235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29236 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
29240 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
29241 LDKAcceptChannel this_ptr_conv;
29242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29243 this_ptr_conv.is_owned = false;
29244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29245 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29248 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
29249 LDKAcceptChannel this_ptr_conv;
29250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29251 this_ptr_conv.is_owned = false;
29252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29253 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29254 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29258 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
29259 LDKAcceptChannel this_ptr_conv;
29260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29261 this_ptr_conv.is_owned = false;
29262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29263 LDKPublicKey val_ref;
29264 CHECK(val->arr_len == 33);
29265 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29266 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29269 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
29270 LDKAcceptChannel this_ptr_conv;
29271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29272 this_ptr_conv.is_owned = false;
29273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29274 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29275 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29279 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
29280 LDKAcceptChannel this_ptr_conv;
29281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29282 this_ptr_conv.is_owned = false;
29283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29284 LDKPublicKey val_ref;
29285 CHECK(val->arr_len == 33);
29286 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29287 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29290 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
29291 LDKAcceptChannel this_ptr_conv;
29292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29293 this_ptr_conv.is_owned = false;
29294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29295 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29296 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29300 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
29301 LDKAcceptChannel this_ptr_conv;
29302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29303 this_ptr_conv.is_owned = false;
29304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29305 LDKPublicKey val_ref;
29306 CHECK(val->arr_len == 33);
29307 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29308 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
29311 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
29312 LDKAcceptChannel this_ptr_conv;
29313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29314 this_ptr_conv.is_owned = false;
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29317 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29321 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
29322 LDKAcceptChannel this_ptr_conv;
29323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29324 this_ptr_conv.is_owned = false;
29325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29326 LDKPublicKey val_ref;
29327 CHECK(val->arr_len == 33);
29328 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29329 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29332 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
29333 LDKAcceptChannel this_ptr_conv;
29334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29335 this_ptr_conv.is_owned = false;
29336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29337 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29338 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29342 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
29343 LDKAcceptChannel this_ptr_conv;
29344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29345 this_ptr_conv.is_owned = false;
29346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29347 LDKPublicKey val_ref;
29348 CHECK(val->arr_len == 33);
29349 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29350 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29353 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
29354 LDKAcceptChannel this_ptr_conv;
29355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29356 this_ptr_conv.is_owned = false;
29357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29358 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29359 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29363 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) {
29364 LDKAcceptChannel this_ptr_conv;
29365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29366 this_ptr_conv.is_owned = false;
29367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29368 LDKPublicKey val_ref;
29369 CHECK(val->arr_len == 33);
29370 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29371 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29374 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
29375 LDKAcceptChannel this_ptr_conv;
29376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29377 this_ptr_conv.is_owned = false;
29378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29379 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
29380 uint32_t ret_ref = 0;
29381 if ((uintptr_t)ret_var.inner > 4096) {
29382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29385 ret_ref = (uintptr_t)ret_var.inner;
29386 if (ret_var.is_owned) {
29393 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
29394 LDKAcceptChannel this_ptr_conv;
29395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29396 this_ptr_conv.is_owned = false;
29397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29398 LDKChannelTypeFeatures val_conv;
29399 val_conv.inner = (void*)(val & (~1));
29400 val_conv.is_owned = (val & 1) || (val == 0);
29401 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29402 val_conv = ChannelTypeFeatures_clone(&val_conv);
29403 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
29406 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
29407 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
29408 uint32_t ret_ref = 0;
29409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29412 ret_ref = (uintptr_t)ret_var.inner;
29413 if (ret_var.is_owned) {
29418 uint32_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
29419 LDKAcceptChannel arg_conv;
29420 arg_conv.inner = (void*)(arg & (~1));
29421 arg_conv.is_owned = false;
29422 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29423 uint32_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
29427 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
29428 LDKAcceptChannel orig_conv;
29429 orig_conv.inner = (void*)(orig & (~1));
29430 orig_conv.is_owned = false;
29431 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29432 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
29433 uint32_t ret_ref = 0;
29434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29437 ret_ref = (uintptr_t)ret_var.inner;
29438 if (ret_var.is_owned) {
29444 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
29445 LDKFundingCreated this_obj_conv;
29446 this_obj_conv.inner = (void*)(this_obj & (~1));
29447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29449 FundingCreated_free(this_obj_conv);
29452 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
29453 LDKFundingCreated this_ptr_conv;
29454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29455 this_ptr_conv.is_owned = false;
29456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29457 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29458 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
29462 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
29463 LDKFundingCreated this_ptr_conv;
29464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29465 this_ptr_conv.is_owned = false;
29466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29467 LDKThirtyTwoBytes val_ref;
29468 CHECK(val->arr_len == 32);
29469 memcpy(val_ref.data, val->elems, 32); FREE(val);
29470 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
29473 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
29474 LDKFundingCreated 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29479 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
29483 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
29484 LDKFundingCreated this_ptr_conv;
29485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29486 this_ptr_conv.is_owned = false;
29487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29488 LDKThirtyTwoBytes val_ref;
29489 CHECK(val->arr_len == 32);
29490 memcpy(val_ref.data, val->elems, 32); FREE(val);
29491 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
29494 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
29495 LDKFundingCreated this_ptr_conv;
29496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29497 this_ptr_conv.is_owned = false;
29498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29499 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
29503 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
29504 LDKFundingCreated this_ptr_conv;
29505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29506 this_ptr_conv.is_owned = false;
29507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29508 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
29511 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
29512 LDKFundingCreated this_ptr_conv;
29513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29514 this_ptr_conv.is_owned = false;
29515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29516 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29517 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
29521 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
29522 LDKFundingCreated this_ptr_conv;
29523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29524 this_ptr_conv.is_owned = false;
29525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29526 LDKSignature val_ref;
29527 CHECK(val->arr_len == 64);
29528 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29529 FundingCreated_set_signature(&this_ptr_conv, val_ref);
29532 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) {
29533 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
29534 CHECK(temporary_channel_id_arg->arr_len == 32);
29535 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
29536 LDKThirtyTwoBytes funding_txid_arg_ref;
29537 CHECK(funding_txid_arg->arr_len == 32);
29538 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
29539 LDKSignature signature_arg_ref;
29540 CHECK(signature_arg->arr_len == 64);
29541 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29542 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
29543 uint32_t ret_ref = 0;
29544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29547 ret_ref = (uintptr_t)ret_var.inner;
29548 if (ret_var.is_owned) {
29554 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
29555 LDKFundingCreated ret_var = FundingCreated_clone(arg);
29556 uint32_t ret_ref = 0;
29557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29560 ret_ref = (uintptr_t)ret_var.inner;
29561 if (ret_var.is_owned) {
29566 uint32_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
29567 LDKFundingCreated arg_conv;
29568 arg_conv.inner = (void*)(arg & (~1));
29569 arg_conv.is_owned = false;
29570 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29571 uint32_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
29575 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
29576 LDKFundingCreated orig_conv;
29577 orig_conv.inner = (void*)(orig & (~1));
29578 orig_conv.is_owned = false;
29579 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29580 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
29581 uint32_t ret_ref = 0;
29582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29585 ret_ref = (uintptr_t)ret_var.inner;
29586 if (ret_var.is_owned) {
29592 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
29593 LDKFundingSigned this_obj_conv;
29594 this_obj_conv.inner = (void*)(this_obj & (~1));
29595 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29597 FundingSigned_free(this_obj_conv);
29600 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
29601 LDKFundingSigned this_ptr_conv;
29602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29603 this_ptr_conv.is_owned = false;
29604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29605 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29606 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
29610 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29611 LDKFundingSigned this_ptr_conv;
29612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29613 this_ptr_conv.is_owned = false;
29614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29615 LDKThirtyTwoBytes val_ref;
29616 CHECK(val->arr_len == 32);
29617 memcpy(val_ref.data, val->elems, 32); FREE(val);
29618 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
29621 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
29622 LDKFundingSigned this_ptr_conv;
29623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29624 this_ptr_conv.is_owned = false;
29625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29626 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29627 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
29631 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29632 LDKFundingSigned this_ptr_conv;
29633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29634 this_ptr_conv.is_owned = false;
29635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29636 LDKSignature val_ref;
29637 CHECK(val->arr_len == 64);
29638 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29639 FundingSigned_set_signature(&this_ptr_conv, val_ref);
29642 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
29643 LDKThirtyTwoBytes channel_id_arg_ref;
29644 CHECK(channel_id_arg->arr_len == 32);
29645 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29646 LDKSignature signature_arg_ref;
29647 CHECK(signature_arg->arr_len == 64);
29648 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29649 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
29650 uint32_t ret_ref = 0;
29651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29654 ret_ref = (uintptr_t)ret_var.inner;
29655 if (ret_var.is_owned) {
29661 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
29662 LDKFundingSigned ret_var = FundingSigned_clone(arg);
29663 uint32_t ret_ref = 0;
29664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29667 ret_ref = (uintptr_t)ret_var.inner;
29668 if (ret_var.is_owned) {
29673 uint32_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
29674 LDKFundingSigned arg_conv;
29675 arg_conv.inner = (void*)(arg & (~1));
29676 arg_conv.is_owned = false;
29677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29678 uint32_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
29682 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
29683 LDKFundingSigned orig_conv;
29684 orig_conv.inner = (void*)(orig & (~1));
29685 orig_conv.is_owned = false;
29686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29687 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
29688 uint32_t ret_ref = 0;
29689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29692 ret_ref = (uintptr_t)ret_var.inner;
29693 if (ret_var.is_owned) {
29699 void __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint32_t this_obj) {
29700 LDKChannelReady this_obj_conv;
29701 this_obj_conv.inner = (void*)(this_obj & (~1));
29702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29704 ChannelReady_free(this_obj_conv);
29707 int8_tArray __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint32_t this_ptr) {
29708 LDKChannelReady this_ptr_conv;
29709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29710 this_ptr_conv.is_owned = false;
29711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29712 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29713 memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
29717 void __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29718 LDKChannelReady this_ptr_conv;
29719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29720 this_ptr_conv.is_owned = false;
29721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29722 LDKThirtyTwoBytes val_ref;
29723 CHECK(val->arr_len == 32);
29724 memcpy(val_ref.data, val->elems, 32); FREE(val);
29725 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
29728 int8_tArray __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint32_t this_ptr) {
29729 LDKChannelReady this_ptr_conv;
29730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29731 this_ptr_conv.is_owned = false;
29732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29733 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29734 memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29738 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) {
29739 LDKChannelReady this_ptr_conv;
29740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29741 this_ptr_conv.is_owned = false;
29742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29743 LDKPublicKey val_ref;
29744 CHECK(val->arr_len == 33);
29745 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29746 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29749 uint32_t __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint32_t this_ptr) {
29750 LDKChannelReady this_ptr_conv;
29751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29752 this_ptr_conv.is_owned = false;
29753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29754 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29755 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
29756 uint32_t ret_ref = (uintptr_t)ret_copy;
29760 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) {
29761 LDKChannelReady this_ptr_conv;
29762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29763 this_ptr_conv.is_owned = false;
29764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29765 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29766 CHECK_ACCESS(val_ptr);
29767 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29768 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
29769 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
29772 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) {
29773 LDKThirtyTwoBytes channel_id_arg_ref;
29774 CHECK(channel_id_arg->arr_len == 32);
29775 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29776 LDKPublicKey next_per_commitment_point_arg_ref;
29777 CHECK(next_per_commitment_point_arg->arr_len == 33);
29778 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29779 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
29780 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
29781 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
29782 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
29783 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
29784 uint32_t ret_ref = 0;
29785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29788 ret_ref = (uintptr_t)ret_var.inner;
29789 if (ret_var.is_owned) {
29795 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
29796 LDKChannelReady ret_var = ChannelReady_clone(arg);
29797 uint32_t ret_ref = 0;
29798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29801 ret_ref = (uintptr_t)ret_var.inner;
29802 if (ret_var.is_owned) {
29807 uint32_t __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint32_t arg) {
29808 LDKChannelReady arg_conv;
29809 arg_conv.inner = (void*)(arg & (~1));
29810 arg_conv.is_owned = false;
29811 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29812 uint32_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
29816 uint32_t __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint32_t orig) {
29817 LDKChannelReady orig_conv;
29818 orig_conv.inner = (void*)(orig & (~1));
29819 orig_conv.is_owned = false;
29820 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29821 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
29822 uint32_t ret_ref = 0;
29823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29826 ret_ref = (uintptr_t)ret_var.inner;
29827 if (ret_var.is_owned) {
29833 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
29834 LDKShutdown this_obj_conv;
29835 this_obj_conv.inner = (void*)(this_obj & (~1));
29836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29838 Shutdown_free(this_obj_conv);
29841 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
29842 LDKShutdown this_ptr_conv;
29843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29844 this_ptr_conv.is_owned = false;
29845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29846 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29847 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
29851 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29852 LDKShutdown this_ptr_conv;
29853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29854 this_ptr_conv.is_owned = false;
29855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29856 LDKThirtyTwoBytes val_ref;
29857 CHECK(val->arr_len == 32);
29858 memcpy(val_ref.data, val->elems, 32); FREE(val);
29859 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
29862 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
29863 LDKShutdown this_ptr_conv;
29864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29865 this_ptr_conv.is_owned = false;
29866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29867 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
29868 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29869 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29873 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
29874 LDKShutdown this_ptr_conv;
29875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29876 this_ptr_conv.is_owned = false;
29877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29878 LDKCVec_u8Z val_ref;
29879 val_ref.datalen = val->arr_len;
29880 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29881 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
29882 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
29885 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
29886 LDKThirtyTwoBytes channel_id_arg_ref;
29887 CHECK(channel_id_arg->arr_len == 32);
29888 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29889 LDKCVec_u8Z scriptpubkey_arg_ref;
29890 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
29891 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29892 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
29893 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
29894 uint32_t ret_ref = 0;
29895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29898 ret_ref = (uintptr_t)ret_var.inner;
29899 if (ret_var.is_owned) {
29905 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
29906 LDKShutdown ret_var = Shutdown_clone(arg);
29907 uint32_t ret_ref = 0;
29908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29911 ret_ref = (uintptr_t)ret_var.inner;
29912 if (ret_var.is_owned) {
29917 uint32_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
29918 LDKShutdown arg_conv;
29919 arg_conv.inner = (void*)(arg & (~1));
29920 arg_conv.is_owned = false;
29921 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29922 uint32_t ret_conv = Shutdown_clone_ptr(&arg_conv);
29926 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
29927 LDKShutdown orig_conv;
29928 orig_conv.inner = (void*)(orig & (~1));
29929 orig_conv.is_owned = false;
29930 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29931 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
29932 uint32_t ret_ref = 0;
29933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29936 ret_ref = (uintptr_t)ret_var.inner;
29937 if (ret_var.is_owned) {
29943 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
29944 LDKClosingSignedFeeRange this_obj_conv;
29945 this_obj_conv.inner = (void*)(this_obj & (~1));
29946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29948 ClosingSignedFeeRange_free(this_obj_conv);
29951 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
29952 LDKClosingSignedFeeRange this_ptr_conv;
29953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29954 this_ptr_conv.is_owned = false;
29955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29956 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
29960 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
29961 LDKClosingSignedFeeRange this_ptr_conv;
29962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29963 this_ptr_conv.is_owned = false;
29964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29965 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
29968 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
29969 LDKClosingSignedFeeRange this_ptr_conv;
29970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29971 this_ptr_conv.is_owned = false;
29972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29973 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
29977 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
29978 LDKClosingSignedFeeRange this_ptr_conv;
29979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29980 this_ptr_conv.is_owned = false;
29981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29982 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
29985 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
29986 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
29987 uint32_t ret_ref = 0;
29988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29991 ret_ref = (uintptr_t)ret_var.inner;
29992 if (ret_var.is_owned) {
29998 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
29999 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
30000 uint32_t ret_ref = 0;
30001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30004 ret_ref = (uintptr_t)ret_var.inner;
30005 if (ret_var.is_owned) {
30010 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
30011 LDKClosingSignedFeeRange arg_conv;
30012 arg_conv.inner = (void*)(arg & (~1));
30013 arg_conv.is_owned = false;
30014 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30015 uint32_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
30019 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
30020 LDKClosingSignedFeeRange orig_conv;
30021 orig_conv.inner = (void*)(orig & (~1));
30022 orig_conv.is_owned = false;
30023 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30024 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
30025 uint32_t ret_ref = 0;
30026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30029 ret_ref = (uintptr_t)ret_var.inner;
30030 if (ret_var.is_owned) {
30036 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
30037 LDKClosingSigned this_obj_conv;
30038 this_obj_conv.inner = (void*)(this_obj & (~1));
30039 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30041 ClosingSigned_free(this_obj_conv);
30044 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
30045 LDKClosingSigned this_ptr_conv;
30046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30047 this_ptr_conv.is_owned = false;
30048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30049 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30050 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
30054 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30055 LDKClosingSigned this_ptr_conv;
30056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30057 this_ptr_conv.is_owned = false;
30058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30059 LDKThirtyTwoBytes val_ref;
30060 CHECK(val->arr_len == 32);
30061 memcpy(val_ref.data, val->elems, 32); FREE(val);
30062 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
30065 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
30066 LDKClosingSigned this_ptr_conv;
30067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30068 this_ptr_conv.is_owned = false;
30069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30070 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
30074 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
30075 LDKClosingSigned this_ptr_conv;
30076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30077 this_ptr_conv.is_owned = false;
30078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30079 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
30082 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
30083 LDKClosingSigned this_ptr_conv;
30084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30085 this_ptr_conv.is_owned = false;
30086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30087 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30088 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30092 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
30093 LDKClosingSigned this_ptr_conv;
30094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30095 this_ptr_conv.is_owned = false;
30096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30097 LDKSignature val_ref;
30098 CHECK(val->arr_len == 64);
30099 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30100 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
30103 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
30104 LDKClosingSigned this_ptr_conv;
30105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30106 this_ptr_conv.is_owned = false;
30107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30108 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
30109 uint32_t ret_ref = 0;
30110 if ((uintptr_t)ret_var.inner > 4096) {
30111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30114 ret_ref = (uintptr_t)ret_var.inner;
30115 if (ret_var.is_owned) {
30122 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
30123 LDKClosingSigned this_ptr_conv;
30124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30125 this_ptr_conv.is_owned = false;
30126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30127 LDKClosingSignedFeeRange val_conv;
30128 val_conv.inner = (void*)(val & (~1));
30129 val_conv.is_owned = (val & 1) || (val == 0);
30130 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30131 val_conv = ClosingSignedFeeRange_clone(&val_conv);
30132 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
30135 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) {
30136 LDKThirtyTwoBytes channel_id_arg_ref;
30137 CHECK(channel_id_arg->arr_len == 32);
30138 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30139 LDKSignature signature_arg_ref;
30140 CHECK(signature_arg->arr_len == 64);
30141 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30142 LDKClosingSignedFeeRange fee_range_arg_conv;
30143 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
30144 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
30145 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
30146 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
30147 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
30148 uint32_t ret_ref = 0;
30149 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30150 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30152 ret_ref = (uintptr_t)ret_var.inner;
30153 if (ret_var.is_owned) {
30159 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
30160 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
30161 uint32_t ret_ref = 0;
30162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30165 ret_ref = (uintptr_t)ret_var.inner;
30166 if (ret_var.is_owned) {
30171 uint32_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
30172 LDKClosingSigned arg_conv;
30173 arg_conv.inner = (void*)(arg & (~1));
30174 arg_conv.is_owned = false;
30175 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30176 uint32_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
30180 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
30181 LDKClosingSigned orig_conv;
30182 orig_conv.inner = (void*)(orig & (~1));
30183 orig_conv.is_owned = false;
30184 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30185 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
30186 uint32_t ret_ref = 0;
30187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30190 ret_ref = (uintptr_t)ret_var.inner;
30191 if (ret_var.is_owned) {
30197 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
30198 LDKUpdateAddHTLC this_obj_conv;
30199 this_obj_conv.inner = (void*)(this_obj & (~1));
30200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30202 UpdateAddHTLC_free(this_obj_conv);
30205 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
30206 LDKUpdateAddHTLC this_ptr_conv;
30207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30208 this_ptr_conv.is_owned = false;
30209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30210 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30211 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
30215 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30216 LDKUpdateAddHTLC this_ptr_conv;
30217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30218 this_ptr_conv.is_owned = false;
30219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30220 LDKThirtyTwoBytes val_ref;
30221 CHECK(val->arr_len == 32);
30222 memcpy(val_ref.data, val->elems, 32); FREE(val);
30223 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
30226 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
30227 LDKUpdateAddHTLC this_ptr_conv;
30228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30229 this_ptr_conv.is_owned = false;
30230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30231 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
30235 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
30236 LDKUpdateAddHTLC this_ptr_conv;
30237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30238 this_ptr_conv.is_owned = false;
30239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30240 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
30243 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
30244 LDKUpdateAddHTLC this_ptr_conv;
30245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30246 this_ptr_conv.is_owned = false;
30247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30248 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
30252 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
30253 LDKUpdateAddHTLC this_ptr_conv;
30254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30255 this_ptr_conv.is_owned = false;
30256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30257 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
30260 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
30261 LDKUpdateAddHTLC this_ptr_conv;
30262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30263 this_ptr_conv.is_owned = false;
30264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30265 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30266 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
30270 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
30271 LDKUpdateAddHTLC 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 LDKThirtyTwoBytes val_ref;
30276 CHECK(val->arr_len == 32);
30277 memcpy(val_ref.data, val->elems, 32); FREE(val);
30278 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
30281 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
30282 LDKUpdateAddHTLC this_ptr_conv;
30283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30284 this_ptr_conv.is_owned = false;
30285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30286 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
30290 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
30291 LDKUpdateAddHTLC this_ptr_conv;
30292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30293 this_ptr_conv.is_owned = false;
30294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30295 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
30298 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
30299 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
30300 uint32_t ret_ref = 0;
30301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30304 ret_ref = (uintptr_t)ret_var.inner;
30305 if (ret_var.is_owned) {
30310 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
30311 LDKUpdateAddHTLC arg_conv;
30312 arg_conv.inner = (void*)(arg & (~1));
30313 arg_conv.is_owned = false;
30314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30315 uint32_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
30319 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
30320 LDKUpdateAddHTLC orig_conv;
30321 orig_conv.inner = (void*)(orig & (~1));
30322 orig_conv.is_owned = false;
30323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30324 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
30325 uint32_t ret_ref = 0;
30326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30329 ret_ref = (uintptr_t)ret_var.inner;
30330 if (ret_var.is_owned) {
30336 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
30337 LDKUpdateFulfillHTLC this_obj_conv;
30338 this_obj_conv.inner = (void*)(this_obj & (~1));
30339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30341 UpdateFulfillHTLC_free(this_obj_conv);
30344 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
30345 LDKUpdateFulfillHTLC this_ptr_conv;
30346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30347 this_ptr_conv.is_owned = false;
30348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30349 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30350 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
30354 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30355 LDKUpdateFulfillHTLC this_ptr_conv;
30356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30357 this_ptr_conv.is_owned = false;
30358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30359 LDKThirtyTwoBytes val_ref;
30360 CHECK(val->arr_len == 32);
30361 memcpy(val_ref.data, val->elems, 32); FREE(val);
30362 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
30365 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
30366 LDKUpdateFulfillHTLC this_ptr_conv;
30367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30368 this_ptr_conv.is_owned = false;
30369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30370 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
30374 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
30375 LDKUpdateFulfillHTLC this_ptr_conv;
30376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30377 this_ptr_conv.is_owned = false;
30378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30379 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
30382 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
30383 LDKUpdateFulfillHTLC this_ptr_conv;
30384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30385 this_ptr_conv.is_owned = false;
30386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30387 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30388 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
30392 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
30393 LDKUpdateFulfillHTLC this_ptr_conv;
30394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30395 this_ptr_conv.is_owned = false;
30396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30397 LDKThirtyTwoBytes val_ref;
30398 CHECK(val->arr_len == 32);
30399 memcpy(val_ref.data, val->elems, 32); FREE(val);
30400 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
30403 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) {
30404 LDKThirtyTwoBytes channel_id_arg_ref;
30405 CHECK(channel_id_arg->arr_len == 32);
30406 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30407 LDKThirtyTwoBytes payment_preimage_arg_ref;
30408 CHECK(payment_preimage_arg->arr_len == 32);
30409 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
30410 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
30411 uint32_t ret_ref = 0;
30412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30415 ret_ref = (uintptr_t)ret_var.inner;
30416 if (ret_var.is_owned) {
30422 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
30423 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
30424 uint32_t ret_ref = 0;
30425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30428 ret_ref = (uintptr_t)ret_var.inner;
30429 if (ret_var.is_owned) {
30434 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
30435 LDKUpdateFulfillHTLC arg_conv;
30436 arg_conv.inner = (void*)(arg & (~1));
30437 arg_conv.is_owned = false;
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30439 uint32_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
30443 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
30444 LDKUpdateFulfillHTLC orig_conv;
30445 orig_conv.inner = (void*)(orig & (~1));
30446 orig_conv.is_owned = false;
30447 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30448 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
30449 uint32_t ret_ref = 0;
30450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30453 ret_ref = (uintptr_t)ret_var.inner;
30454 if (ret_var.is_owned) {
30460 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
30461 LDKUpdateFailHTLC 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 UpdateFailHTLC_free(this_obj_conv);
30468 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
30469 LDKUpdateFailHTLC 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30474 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
30478 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30479 LDKUpdateFailHTLC this_ptr_conv;
30480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30481 this_ptr_conv.is_owned = false;
30482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30483 LDKThirtyTwoBytes val_ref;
30484 CHECK(val->arr_len == 32);
30485 memcpy(val_ref.data, val->elems, 32); FREE(val);
30486 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
30489 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
30490 LDKUpdateFailHTLC this_ptr_conv;
30491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30492 this_ptr_conv.is_owned = false;
30493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30494 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
30498 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
30499 LDKUpdateFailHTLC 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 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
30506 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
30507 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
30508 uint32_t ret_ref = 0;
30509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30512 ret_ref = (uintptr_t)ret_var.inner;
30513 if (ret_var.is_owned) {
30518 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
30519 LDKUpdateFailHTLC arg_conv;
30520 arg_conv.inner = (void*)(arg & (~1));
30521 arg_conv.is_owned = false;
30522 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30523 uint32_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
30527 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
30528 LDKUpdateFailHTLC orig_conv;
30529 orig_conv.inner = (void*)(orig & (~1));
30530 orig_conv.is_owned = false;
30531 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30532 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
30533 uint32_t ret_ref = 0;
30534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30537 ret_ref = (uintptr_t)ret_var.inner;
30538 if (ret_var.is_owned) {
30544 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
30545 LDKUpdateFailMalformedHTLC this_obj_conv;
30546 this_obj_conv.inner = (void*)(this_obj & (~1));
30547 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30549 UpdateFailMalformedHTLC_free(this_obj_conv);
30552 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
30553 LDKUpdateFailMalformedHTLC this_ptr_conv;
30554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30555 this_ptr_conv.is_owned = false;
30556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30557 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30558 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
30562 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30563 LDKUpdateFailMalformedHTLC this_ptr_conv;
30564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30565 this_ptr_conv.is_owned = false;
30566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567 LDKThirtyTwoBytes val_ref;
30568 CHECK(val->arr_len == 32);
30569 memcpy(val_ref.data, val->elems, 32); FREE(val);
30570 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
30573 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
30574 LDKUpdateFailMalformedHTLC this_ptr_conv;
30575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30576 this_ptr_conv.is_owned = false;
30577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30578 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
30582 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
30583 LDKUpdateFailMalformedHTLC this_ptr_conv;
30584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30585 this_ptr_conv.is_owned = false;
30586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30587 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
30590 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
30591 LDKUpdateFailMalformedHTLC this_ptr_conv;
30592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30593 this_ptr_conv.is_owned = false;
30594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30595 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
30599 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
30600 LDKUpdateFailMalformedHTLC this_ptr_conv;
30601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30602 this_ptr_conv.is_owned = false;
30603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30604 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
30607 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
30608 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
30609 uint32_t ret_ref = 0;
30610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30613 ret_ref = (uintptr_t)ret_var.inner;
30614 if (ret_var.is_owned) {
30619 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
30620 LDKUpdateFailMalformedHTLC arg_conv;
30621 arg_conv.inner = (void*)(arg & (~1));
30622 arg_conv.is_owned = false;
30623 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30624 uint32_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
30628 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
30629 LDKUpdateFailMalformedHTLC orig_conv;
30630 orig_conv.inner = (void*)(orig & (~1));
30631 orig_conv.is_owned = false;
30632 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30633 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
30634 uint32_t ret_ref = 0;
30635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30638 ret_ref = (uintptr_t)ret_var.inner;
30639 if (ret_var.is_owned) {
30645 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
30646 LDKCommitmentSigned this_obj_conv;
30647 this_obj_conv.inner = (void*)(this_obj & (~1));
30648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30650 CommitmentSigned_free(this_obj_conv);
30653 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
30654 LDKCommitmentSigned this_ptr_conv;
30655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30656 this_ptr_conv.is_owned = false;
30657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30658 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30659 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
30663 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30664 LDKCommitmentSigned this_ptr_conv;
30665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30666 this_ptr_conv.is_owned = false;
30667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30668 LDKThirtyTwoBytes val_ref;
30669 CHECK(val->arr_len == 32);
30670 memcpy(val_ref.data, val->elems, 32); FREE(val);
30671 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
30674 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
30675 LDKCommitmentSigned this_ptr_conv;
30676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30677 this_ptr_conv.is_owned = false;
30678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30679 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30680 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
30684 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
30685 LDKCommitmentSigned this_ptr_conv;
30686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30687 this_ptr_conv.is_owned = false;
30688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30689 LDKSignature val_ref;
30690 CHECK(val->arr_len == 64);
30691 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30692 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
30695 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
30696 LDKCommitmentSigned this_ptr_conv;
30697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30698 this_ptr_conv.is_owned = false;
30699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30700 LDKCVec_SignatureZ val_constr;
30701 val_constr.datalen = val->arr_len;
30702 if (val_constr.datalen > 0)
30703 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30705 val_constr.data = NULL;
30706 int8_tArray* val_vals = (void*) val->elems;
30707 for (size_t m = 0; m < val_constr.datalen; m++) {
30708 int8_tArray val_conv_12 = val_vals[m];
30709 LDKSignature val_conv_12_ref;
30710 CHECK(val_conv_12->arr_len == 64);
30711 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
30712 val_constr.data[m] = val_conv_12_ref;
30715 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
30718 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
30719 LDKThirtyTwoBytes channel_id_arg_ref;
30720 CHECK(channel_id_arg->arr_len == 32);
30721 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30722 LDKSignature signature_arg_ref;
30723 CHECK(signature_arg->arr_len == 64);
30724 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30725 LDKCVec_SignatureZ htlc_signatures_arg_constr;
30726 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
30727 if (htlc_signatures_arg_constr.datalen > 0)
30728 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30730 htlc_signatures_arg_constr.data = NULL;
30731 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
30732 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
30733 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
30734 LDKSignature htlc_signatures_arg_conv_12_ref;
30735 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
30736 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
30737 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
30739 FREE(htlc_signatures_arg);
30740 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
30741 uint32_t ret_ref = 0;
30742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30745 ret_ref = (uintptr_t)ret_var.inner;
30746 if (ret_var.is_owned) {
30752 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
30753 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
30754 uint32_t ret_ref = 0;
30755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30758 ret_ref = (uintptr_t)ret_var.inner;
30759 if (ret_var.is_owned) {
30764 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
30765 LDKCommitmentSigned arg_conv;
30766 arg_conv.inner = (void*)(arg & (~1));
30767 arg_conv.is_owned = false;
30768 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30769 uint32_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
30773 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
30774 LDKCommitmentSigned orig_conv;
30775 orig_conv.inner = (void*)(orig & (~1));
30776 orig_conv.is_owned = false;
30777 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30778 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
30779 uint32_t ret_ref = 0;
30780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30783 ret_ref = (uintptr_t)ret_var.inner;
30784 if (ret_var.is_owned) {
30790 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
30791 LDKRevokeAndACK this_obj_conv;
30792 this_obj_conv.inner = (void*)(this_obj & (~1));
30793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30795 RevokeAndACK_free(this_obj_conv);
30798 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
30799 LDKRevokeAndACK this_ptr_conv;
30800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30801 this_ptr_conv.is_owned = false;
30802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30803 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30804 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
30808 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30809 LDKRevokeAndACK this_ptr_conv;
30810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30811 this_ptr_conv.is_owned = false;
30812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30813 LDKThirtyTwoBytes val_ref;
30814 CHECK(val->arr_len == 32);
30815 memcpy(val_ref.data, val->elems, 32); FREE(val);
30816 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
30819 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
30820 LDKRevokeAndACK this_ptr_conv;
30821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30822 this_ptr_conv.is_owned = false;
30823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30824 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30825 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
30829 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
30830 LDKRevokeAndACK this_ptr_conv;
30831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30832 this_ptr_conv.is_owned = false;
30833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30834 LDKThirtyTwoBytes val_ref;
30835 CHECK(val->arr_len == 32);
30836 memcpy(val_ref.data, val->elems, 32); FREE(val);
30837 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
30840 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
30841 LDKRevokeAndACK this_ptr_conv;
30842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30843 this_ptr_conv.is_owned = false;
30844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30845 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30846 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30850 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) {
30851 LDKRevokeAndACK this_ptr_conv;
30852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30853 this_ptr_conv.is_owned = false;
30854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30855 LDKPublicKey val_ref;
30856 CHECK(val->arr_len == 33);
30857 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30858 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30861 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) {
30862 LDKThirtyTwoBytes channel_id_arg_ref;
30863 CHECK(channel_id_arg->arr_len == 32);
30864 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30865 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
30866 CHECK(per_commitment_secret_arg->arr_len == 32);
30867 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
30868 LDKPublicKey next_per_commitment_point_arg_ref;
30869 CHECK(next_per_commitment_point_arg->arr_len == 33);
30870 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
30871 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
30872 uint32_t ret_ref = 0;
30873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30876 ret_ref = (uintptr_t)ret_var.inner;
30877 if (ret_var.is_owned) {
30883 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
30884 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
30885 uint32_t ret_ref = 0;
30886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30889 ret_ref = (uintptr_t)ret_var.inner;
30890 if (ret_var.is_owned) {
30895 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
30896 LDKRevokeAndACK arg_conv;
30897 arg_conv.inner = (void*)(arg & (~1));
30898 arg_conv.is_owned = false;
30899 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30900 uint32_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
30904 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
30905 LDKRevokeAndACK orig_conv;
30906 orig_conv.inner = (void*)(orig & (~1));
30907 orig_conv.is_owned = false;
30908 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30909 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
30910 uint32_t ret_ref = 0;
30911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30914 ret_ref = (uintptr_t)ret_var.inner;
30915 if (ret_var.is_owned) {
30921 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
30922 LDKUpdateFee this_obj_conv;
30923 this_obj_conv.inner = (void*)(this_obj & (~1));
30924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30926 UpdateFee_free(this_obj_conv);
30929 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
30930 LDKUpdateFee this_ptr_conv;
30931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30932 this_ptr_conv.is_owned = false;
30933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30934 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30935 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
30939 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30940 LDKUpdateFee this_ptr_conv;
30941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30942 this_ptr_conv.is_owned = false;
30943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30944 LDKThirtyTwoBytes val_ref;
30945 CHECK(val->arr_len == 32);
30946 memcpy(val_ref.data, val->elems, 32); FREE(val);
30947 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
30950 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
30951 LDKUpdateFee this_ptr_conv;
30952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30953 this_ptr_conv.is_owned = false;
30954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30955 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
30959 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
30960 LDKUpdateFee this_ptr_conv;
30961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30962 this_ptr_conv.is_owned = false;
30963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30964 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
30967 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
30968 LDKThirtyTwoBytes channel_id_arg_ref;
30969 CHECK(channel_id_arg->arr_len == 32);
30970 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30971 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
30972 uint32_t ret_ref = 0;
30973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30976 ret_ref = (uintptr_t)ret_var.inner;
30977 if (ret_var.is_owned) {
30983 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
30984 LDKUpdateFee ret_var = UpdateFee_clone(arg);
30985 uint32_t ret_ref = 0;
30986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30989 ret_ref = (uintptr_t)ret_var.inner;
30990 if (ret_var.is_owned) {
30995 uint32_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
30996 LDKUpdateFee arg_conv;
30997 arg_conv.inner = (void*)(arg & (~1));
30998 arg_conv.is_owned = false;
30999 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31000 uint32_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
31004 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
31005 LDKUpdateFee orig_conv;
31006 orig_conv.inner = (void*)(orig & (~1));
31007 orig_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31009 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
31010 uint32_t ret_ref = 0;
31011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31014 ret_ref = (uintptr_t)ret_var.inner;
31015 if (ret_var.is_owned) {
31021 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
31022 LDKDataLossProtect this_obj_conv;
31023 this_obj_conv.inner = (void*)(this_obj & (~1));
31024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31026 DataLossProtect_free(this_obj_conv);
31029 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) {
31030 LDKDataLossProtect this_ptr_conv;
31031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31032 this_ptr_conv.is_owned = false;
31033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31034 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31035 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
31039 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) {
31040 LDKDataLossProtect this_ptr_conv;
31041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31042 this_ptr_conv.is_owned = false;
31043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31044 LDKThirtyTwoBytes val_ref;
31045 CHECK(val->arr_len == 32);
31046 memcpy(val_ref.data, val->elems, 32); FREE(val);
31047 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
31050 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) {
31051 LDKDataLossProtect this_ptr_conv;
31052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31053 this_ptr_conv.is_owned = false;
31054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31055 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31056 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31060 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) {
31061 LDKDataLossProtect this_ptr_conv;
31062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31063 this_ptr_conv.is_owned = false;
31064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31065 LDKPublicKey val_ref;
31066 CHECK(val->arr_len == 33);
31067 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31068 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
31071 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) {
31072 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
31073 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
31074 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
31075 LDKPublicKey my_current_per_commitment_point_arg_ref;
31076 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
31077 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);
31078 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
31079 uint32_t ret_ref = 0;
31080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31083 ret_ref = (uintptr_t)ret_var.inner;
31084 if (ret_var.is_owned) {
31090 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
31091 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
31092 uint32_t ret_ref = 0;
31093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31096 ret_ref = (uintptr_t)ret_var.inner;
31097 if (ret_var.is_owned) {
31102 uint32_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
31103 LDKDataLossProtect arg_conv;
31104 arg_conv.inner = (void*)(arg & (~1));
31105 arg_conv.is_owned = false;
31106 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31107 uint32_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
31111 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
31112 LDKDataLossProtect orig_conv;
31113 orig_conv.inner = (void*)(orig & (~1));
31114 orig_conv.is_owned = false;
31115 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31116 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
31117 uint32_t ret_ref = 0;
31118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31121 ret_ref = (uintptr_t)ret_var.inner;
31122 if (ret_var.is_owned) {
31128 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
31129 LDKChannelReestablish this_obj_conv;
31130 this_obj_conv.inner = (void*)(this_obj & (~1));
31131 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31133 ChannelReestablish_free(this_obj_conv);
31136 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
31137 LDKChannelReestablish this_ptr_conv;
31138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31139 this_ptr_conv.is_owned = false;
31140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31141 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31142 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
31146 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
31147 LDKChannelReestablish this_ptr_conv;
31148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31149 this_ptr_conv.is_owned = false;
31150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31151 LDKThirtyTwoBytes val_ref;
31152 CHECK(val->arr_len == 32);
31153 memcpy(val_ref.data, val->elems, 32); FREE(val);
31154 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
31157 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
31158 LDKChannelReestablish this_ptr_conv;
31159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31160 this_ptr_conv.is_owned = false;
31161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31162 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
31166 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) {
31167 LDKChannelReestablish this_ptr_conv;
31168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31169 this_ptr_conv.is_owned = false;
31170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31171 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
31174 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
31175 LDKChannelReestablish this_ptr_conv;
31176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31177 this_ptr_conv.is_owned = false;
31178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31179 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
31183 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) {
31184 LDKChannelReestablish this_ptr_conv;
31185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31186 this_ptr_conv.is_owned = false;
31187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31188 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
31191 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
31192 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
31193 uint32_t ret_ref = 0;
31194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31197 ret_ref = (uintptr_t)ret_var.inner;
31198 if (ret_var.is_owned) {
31203 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
31204 LDKChannelReestablish arg_conv;
31205 arg_conv.inner = (void*)(arg & (~1));
31206 arg_conv.is_owned = false;
31207 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31208 uint32_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
31212 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
31213 LDKChannelReestablish orig_conv;
31214 orig_conv.inner = (void*)(orig & (~1));
31215 orig_conv.is_owned = false;
31216 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31217 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
31218 uint32_t ret_ref = 0;
31219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31222 ret_ref = (uintptr_t)ret_var.inner;
31223 if (ret_var.is_owned) {
31229 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
31230 LDKAnnouncementSignatures this_obj_conv;
31231 this_obj_conv.inner = (void*)(this_obj & (~1));
31232 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31234 AnnouncementSignatures_free(this_obj_conv);
31237 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
31238 LDKAnnouncementSignatures this_ptr_conv;
31239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31240 this_ptr_conv.is_owned = false;
31241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31242 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31243 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
31247 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
31248 LDKAnnouncementSignatures this_ptr_conv;
31249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31250 this_ptr_conv.is_owned = false;
31251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31252 LDKThirtyTwoBytes val_ref;
31253 CHECK(val->arr_len == 32);
31254 memcpy(val_ref.data, val->elems, 32); FREE(val);
31255 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
31258 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
31259 LDKAnnouncementSignatures this_ptr_conv;
31260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31261 this_ptr_conv.is_owned = false;
31262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31263 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
31267 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
31268 LDKAnnouncementSignatures this_ptr_conv;
31269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31270 this_ptr_conv.is_owned = false;
31271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
31275 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
31276 LDKAnnouncementSignatures this_ptr_conv;
31277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31278 this_ptr_conv.is_owned = false;
31279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31280 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31281 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
31285 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
31286 LDKAnnouncementSignatures this_ptr_conv;
31287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31288 this_ptr_conv.is_owned = false;
31289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31290 LDKSignature val_ref;
31291 CHECK(val->arr_len == 64);
31292 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31293 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
31296 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
31297 LDKAnnouncementSignatures this_ptr_conv;
31298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31299 this_ptr_conv.is_owned = false;
31300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31301 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31302 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
31306 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
31307 LDKAnnouncementSignatures this_ptr_conv;
31308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31309 this_ptr_conv.is_owned = false;
31310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31311 LDKSignature val_ref;
31312 CHECK(val->arr_len == 64);
31313 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31314 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
31317 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) {
31318 LDKThirtyTwoBytes channel_id_arg_ref;
31319 CHECK(channel_id_arg->arr_len == 32);
31320 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31321 LDKSignature node_signature_arg_ref;
31322 CHECK(node_signature_arg->arr_len == 64);
31323 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
31324 LDKSignature bitcoin_signature_arg_ref;
31325 CHECK(bitcoin_signature_arg->arr_len == 64);
31326 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
31327 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
31328 uint32_t ret_ref = 0;
31329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31332 ret_ref = (uintptr_t)ret_var.inner;
31333 if (ret_var.is_owned) {
31339 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
31340 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
31341 uint32_t ret_ref = 0;
31342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31345 ret_ref = (uintptr_t)ret_var.inner;
31346 if (ret_var.is_owned) {
31351 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
31352 LDKAnnouncementSignatures arg_conv;
31353 arg_conv.inner = (void*)(arg & (~1));
31354 arg_conv.is_owned = false;
31355 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31356 uint32_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
31360 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
31361 LDKAnnouncementSignatures orig_conv;
31362 orig_conv.inner = (void*)(orig & (~1));
31363 orig_conv.is_owned = false;
31364 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31365 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
31366 uint32_t ret_ref = 0;
31367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31370 ret_ref = (uintptr_t)ret_var.inner;
31371 if (ret_var.is_owned) {
31377 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
31378 if ((this_ptr & 1) != 0) return;
31379 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31380 CHECK_ACCESS(this_ptr_ptr);
31381 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
31382 FREE((void*)this_ptr);
31383 NetAddress_free(this_ptr_conv);
31386 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
31387 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31388 *ret_copy = NetAddress_clone(arg);
31389 uint32_t ret_ref = (uintptr_t)ret_copy;
31392 uint32_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
31393 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
31394 uint32_t ret_conv = NetAddress_clone_ptr(arg_conv);
31398 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
31399 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
31400 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31401 *ret_copy = NetAddress_clone(orig_conv);
31402 uint32_t ret_ref = (uintptr_t)ret_copy;
31406 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
31407 LDKFourBytes addr_ref;
31408 CHECK(addr->arr_len == 4);
31409 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
31410 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31411 *ret_copy = NetAddress_ipv4(addr_ref, port);
31412 uint32_t ret_ref = (uintptr_t)ret_copy;
31416 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
31417 LDKSixteenBytes addr_ref;
31418 CHECK(addr->arr_len == 16);
31419 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
31420 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31421 *ret_copy = NetAddress_ipv6(addr_ref, port);
31422 uint32_t ret_ref = (uintptr_t)ret_copy;
31426 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
31427 LDKTwelveBytes a_ref;
31428 CHECK(a->arr_len == 12);
31429 memcpy(a_ref.data, a->elems, 12); FREE(a);
31430 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31431 *ret_copy = NetAddress_onion_v2(a_ref);
31432 uint32_t ret_ref = (uintptr_t)ret_copy;
31436 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) {
31437 LDKThirtyTwoBytes ed25519_pubkey_ref;
31438 CHECK(ed25519_pubkey->arr_len == 32);
31439 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
31440 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31441 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
31442 uint32_t ret_ref = (uintptr_t)ret_copy;
31446 uint32_t __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint32_t hostname, int16_t port) {
31447 LDKHostname hostname_conv;
31448 hostname_conv.inner = (void*)(hostname & (~1));
31449 hostname_conv.is_owned = (hostname & 1) || (hostname == 0);
31450 CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
31451 hostname_conv = Hostname_clone(&hostname_conv);
31452 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31453 *ret_copy = NetAddress_hostname(hostname_conv, port);
31454 uint32_t ret_ref = (uintptr_t)ret_copy;
31458 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
31459 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
31460 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
31461 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31462 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31463 CVec_u8Z_free(ret_var);
31467 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
31468 LDKu8slice ser_ref;
31469 ser_ref.datalen = ser->arr_len;
31470 ser_ref.data = ser->elems;
31471 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
31472 *ret_conv = NetAddress_read(ser_ref);
31474 return (uint32_t)ret_conv;
31477 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
31478 LDKUnsignedNodeAnnouncement this_obj_conv;
31479 this_obj_conv.inner = (void*)(this_obj & (~1));
31480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31482 UnsignedNodeAnnouncement_free(this_obj_conv);
31485 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
31486 LDKUnsignedNodeAnnouncement this_ptr_conv;
31487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31488 this_ptr_conv.is_owned = false;
31489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31490 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
31491 uint32_t ret_ref = 0;
31492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31495 ret_ref = (uintptr_t)ret_var.inner;
31496 if (ret_var.is_owned) {
31502 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
31503 LDKUnsignedNodeAnnouncement this_ptr_conv;
31504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31505 this_ptr_conv.is_owned = false;
31506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31507 LDKNodeFeatures val_conv;
31508 val_conv.inner = (void*)(val & (~1));
31509 val_conv.is_owned = (val & 1) || (val == 0);
31510 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31511 val_conv = NodeFeatures_clone(&val_conv);
31512 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
31515 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
31516 LDKUnsignedNodeAnnouncement this_ptr_conv;
31517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31518 this_ptr_conv.is_owned = false;
31519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31520 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
31524 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
31525 LDKUnsignedNodeAnnouncement this_ptr_conv;
31526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31527 this_ptr_conv.is_owned = false;
31528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31529 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
31532 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
31533 LDKUnsignedNodeAnnouncement this_ptr_conv;
31534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31535 this_ptr_conv.is_owned = false;
31536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31537 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31538 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
31542 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
31543 LDKUnsignedNodeAnnouncement this_ptr_conv;
31544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31545 this_ptr_conv.is_owned = false;
31546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31547 LDKPublicKey val_ref;
31548 CHECK(val->arr_len == 33);
31549 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31550 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
31553 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
31554 LDKUnsignedNodeAnnouncement this_ptr_conv;
31555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31556 this_ptr_conv.is_owned = false;
31557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31558 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
31559 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
31563 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
31564 LDKUnsignedNodeAnnouncement this_ptr_conv;
31565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31566 this_ptr_conv.is_owned = false;
31567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31568 LDKThreeBytes val_ref;
31569 CHECK(val->arr_len == 3);
31570 memcpy(val_ref.data, val->elems, 3); FREE(val);
31571 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
31574 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
31575 LDKUnsignedNodeAnnouncement this_ptr_conv;
31576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31577 this_ptr_conv.is_owned = false;
31578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31579 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31580 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
31584 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
31585 LDKUnsignedNodeAnnouncement this_ptr_conv;
31586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31587 this_ptr_conv.is_owned = false;
31588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31589 LDKThirtyTwoBytes val_ref;
31590 CHECK(val->arr_len == 32);
31591 memcpy(val_ref.data, val->elems, 32); FREE(val);
31592 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
31595 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
31596 LDKUnsignedNodeAnnouncement this_ptr_conv;
31597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31598 this_ptr_conv.is_owned = false;
31599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31600 LDKCVec_NetAddressZ val_constr;
31601 val_constr.datalen = val->arr_len;
31602 if (val_constr.datalen > 0)
31603 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
31605 val_constr.data = NULL;
31606 uint32_t* val_vals = val->elems;
31607 for (size_t m = 0; m < val_constr.datalen; m++) {
31608 uint32_t val_conv_12 = val_vals[m];
31609 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
31610 CHECK_ACCESS(val_conv_12_ptr);
31611 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
31612 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
31613 val_constr.data[m] = val_conv_12_conv;
31616 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
31619 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
31620 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
31621 uint32_t ret_ref = 0;
31622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31625 ret_ref = (uintptr_t)ret_var.inner;
31626 if (ret_var.is_owned) {
31631 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
31632 LDKUnsignedNodeAnnouncement arg_conv;
31633 arg_conv.inner = (void*)(arg & (~1));
31634 arg_conv.is_owned = false;
31635 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31636 uint32_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
31640 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
31641 LDKUnsignedNodeAnnouncement orig_conv;
31642 orig_conv.inner = (void*)(orig & (~1));
31643 orig_conv.is_owned = false;
31644 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31645 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
31646 uint32_t ret_ref = 0;
31647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31650 ret_ref = (uintptr_t)ret_var.inner;
31651 if (ret_var.is_owned) {
31657 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
31658 LDKNodeAnnouncement this_obj_conv;
31659 this_obj_conv.inner = (void*)(this_obj & (~1));
31660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31662 NodeAnnouncement_free(this_obj_conv);
31665 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
31666 LDKNodeAnnouncement this_ptr_conv;
31667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31668 this_ptr_conv.is_owned = false;
31669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31670 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31671 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
31675 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
31676 LDKNodeAnnouncement this_ptr_conv;
31677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31678 this_ptr_conv.is_owned = false;
31679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31680 LDKSignature val_ref;
31681 CHECK(val->arr_len == 64);
31682 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31683 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
31686 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
31687 LDKNodeAnnouncement this_ptr_conv;
31688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31689 this_ptr_conv.is_owned = false;
31690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31691 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
31692 uint32_t ret_ref = 0;
31693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31696 ret_ref = (uintptr_t)ret_var.inner;
31697 if (ret_var.is_owned) {
31703 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
31704 LDKNodeAnnouncement this_ptr_conv;
31705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31706 this_ptr_conv.is_owned = false;
31707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31708 LDKUnsignedNodeAnnouncement val_conv;
31709 val_conv.inner = (void*)(val & (~1));
31710 val_conv.is_owned = (val & 1) || (val == 0);
31711 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31712 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
31713 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
31716 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
31717 LDKSignature signature_arg_ref;
31718 CHECK(signature_arg->arr_len == 64);
31719 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31720 LDKUnsignedNodeAnnouncement contents_arg_conv;
31721 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31722 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31723 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31724 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
31725 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
31726 uint32_t ret_ref = 0;
31727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31730 ret_ref = (uintptr_t)ret_var.inner;
31731 if (ret_var.is_owned) {
31737 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
31738 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
31739 uint32_t ret_ref = 0;
31740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31743 ret_ref = (uintptr_t)ret_var.inner;
31744 if (ret_var.is_owned) {
31749 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
31750 LDKNodeAnnouncement arg_conv;
31751 arg_conv.inner = (void*)(arg & (~1));
31752 arg_conv.is_owned = false;
31753 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31754 uint32_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
31758 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
31759 LDKNodeAnnouncement orig_conv;
31760 orig_conv.inner = (void*)(orig & (~1));
31761 orig_conv.is_owned = false;
31762 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31763 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
31764 uint32_t ret_ref = 0;
31765 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31766 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31768 ret_ref = (uintptr_t)ret_var.inner;
31769 if (ret_var.is_owned) {
31775 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
31776 LDKUnsignedChannelAnnouncement this_obj_conv;
31777 this_obj_conv.inner = (void*)(this_obj & (~1));
31778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31780 UnsignedChannelAnnouncement_free(this_obj_conv);
31783 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
31784 LDKUnsignedChannelAnnouncement this_ptr_conv;
31785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31786 this_ptr_conv.is_owned = false;
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31788 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
31789 uint32_t ret_ref = 0;
31790 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31791 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31793 ret_ref = (uintptr_t)ret_var.inner;
31794 if (ret_var.is_owned) {
31800 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
31801 LDKUnsignedChannelAnnouncement this_ptr_conv;
31802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31803 this_ptr_conv.is_owned = false;
31804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31805 LDKChannelFeatures val_conv;
31806 val_conv.inner = (void*)(val & (~1));
31807 val_conv.is_owned = (val & 1) || (val == 0);
31808 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31809 val_conv = ChannelFeatures_clone(&val_conv);
31810 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
31813 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
31814 LDKUnsignedChannelAnnouncement this_ptr_conv;
31815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31816 this_ptr_conv.is_owned = false;
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31818 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31819 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
31823 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31824 LDKUnsignedChannelAnnouncement this_ptr_conv;
31825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31826 this_ptr_conv.is_owned = false;
31827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31828 LDKThirtyTwoBytes val_ref;
31829 CHECK(val->arr_len == 32);
31830 memcpy(val_ref.data, val->elems, 32); FREE(val);
31831 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
31834 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
31835 LDKUnsignedChannelAnnouncement this_ptr_conv;
31836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31837 this_ptr_conv.is_owned = false;
31838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31839 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
31843 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
31844 LDKUnsignedChannelAnnouncement this_ptr_conv;
31845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31846 this_ptr_conv.is_owned = false;
31847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31848 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
31851 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
31852 LDKUnsignedChannelAnnouncement this_ptr_conv;
31853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31854 this_ptr_conv.is_owned = false;
31855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31856 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31857 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
31861 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
31862 LDKUnsignedChannelAnnouncement this_ptr_conv;
31863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31864 this_ptr_conv.is_owned = false;
31865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31866 LDKPublicKey val_ref;
31867 CHECK(val->arr_len == 33);
31868 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31869 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
31872 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
31873 LDKUnsignedChannelAnnouncement this_ptr_conv;
31874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31875 this_ptr_conv.is_owned = false;
31876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31877 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31878 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
31882 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
31883 LDKUnsignedChannelAnnouncement this_ptr_conv;
31884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31885 this_ptr_conv.is_owned = false;
31886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31887 LDKPublicKey val_ref;
31888 CHECK(val->arr_len == 33);
31889 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31890 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
31893 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
31894 LDKUnsignedChannelAnnouncement this_ptr_conv;
31895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31896 this_ptr_conv.is_owned = false;
31897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31898 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31899 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
31903 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
31904 LDKUnsignedChannelAnnouncement this_ptr_conv;
31905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31906 this_ptr_conv.is_owned = false;
31907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31908 LDKPublicKey val_ref;
31909 CHECK(val->arr_len == 33);
31910 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31911 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
31914 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
31915 LDKUnsignedChannelAnnouncement this_ptr_conv;
31916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31917 this_ptr_conv.is_owned = false;
31918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31919 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31920 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
31924 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
31925 LDKUnsignedChannelAnnouncement this_ptr_conv;
31926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31927 this_ptr_conv.is_owned = false;
31928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31929 LDKPublicKey val_ref;
31930 CHECK(val->arr_len == 33);
31931 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31932 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
31935 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
31936 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
31937 uint32_t ret_ref = 0;
31938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31941 ret_ref = (uintptr_t)ret_var.inner;
31942 if (ret_var.is_owned) {
31947 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
31948 LDKUnsignedChannelAnnouncement arg_conv;
31949 arg_conv.inner = (void*)(arg & (~1));
31950 arg_conv.is_owned = false;
31951 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31952 uint32_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
31956 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
31957 LDKUnsignedChannelAnnouncement orig_conv;
31958 orig_conv.inner = (void*)(orig & (~1));
31959 orig_conv.is_owned = false;
31960 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31961 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
31962 uint32_t ret_ref = 0;
31963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31966 ret_ref = (uintptr_t)ret_var.inner;
31967 if (ret_var.is_owned) {
31973 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
31974 LDKChannelAnnouncement this_obj_conv;
31975 this_obj_conv.inner = (void*)(this_obj & (~1));
31976 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31978 ChannelAnnouncement_free(this_obj_conv);
31981 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
31982 LDKChannelAnnouncement this_ptr_conv;
31983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31984 this_ptr_conv.is_owned = false;
31985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31986 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31987 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
31991 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
31992 LDKChannelAnnouncement this_ptr_conv;
31993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31994 this_ptr_conv.is_owned = false;
31995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31996 LDKSignature val_ref;
31997 CHECK(val->arr_len == 64);
31998 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31999 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
32002 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
32003 LDKChannelAnnouncement this_ptr_conv;
32004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32005 this_ptr_conv.is_owned = false;
32006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32007 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32008 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
32012 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
32013 LDKChannelAnnouncement this_ptr_conv;
32014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32015 this_ptr_conv.is_owned = false;
32016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017 LDKSignature val_ref;
32018 CHECK(val->arr_len == 64);
32019 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32020 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
32023 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
32024 LDKChannelAnnouncement this_ptr_conv;
32025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32026 this_ptr_conv.is_owned = false;
32027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32028 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32029 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
32033 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
32034 LDKChannelAnnouncement this_ptr_conv;
32035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32036 this_ptr_conv.is_owned = false;
32037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32038 LDKSignature val_ref;
32039 CHECK(val->arr_len == 64);
32040 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32041 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
32044 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
32045 LDKChannelAnnouncement this_ptr_conv;
32046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32047 this_ptr_conv.is_owned = false;
32048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32049 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32050 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
32054 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
32055 LDKChannelAnnouncement this_ptr_conv;
32056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32057 this_ptr_conv.is_owned = false;
32058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32059 LDKSignature val_ref;
32060 CHECK(val->arr_len == 64);
32061 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32062 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
32065 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
32066 LDKChannelAnnouncement this_ptr_conv;
32067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32068 this_ptr_conv.is_owned = false;
32069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32070 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
32071 uint32_t ret_ref = 0;
32072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32075 ret_ref = (uintptr_t)ret_var.inner;
32076 if (ret_var.is_owned) {
32082 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
32083 LDKChannelAnnouncement this_ptr_conv;
32084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32085 this_ptr_conv.is_owned = false;
32086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32087 LDKUnsignedChannelAnnouncement val_conv;
32088 val_conv.inner = (void*)(val & (~1));
32089 val_conv.is_owned = (val & 1) || (val == 0);
32090 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32091 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
32092 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
32095 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) {
32096 LDKSignature node_signature_1_arg_ref;
32097 CHECK(node_signature_1_arg->arr_len == 64);
32098 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
32099 LDKSignature node_signature_2_arg_ref;
32100 CHECK(node_signature_2_arg->arr_len == 64);
32101 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
32102 LDKSignature bitcoin_signature_1_arg_ref;
32103 CHECK(bitcoin_signature_1_arg->arr_len == 64);
32104 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
32105 LDKSignature bitcoin_signature_2_arg_ref;
32106 CHECK(bitcoin_signature_2_arg->arr_len == 64);
32107 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
32108 LDKUnsignedChannelAnnouncement contents_arg_conv;
32109 contents_arg_conv.inner = (void*)(contents_arg & (~1));
32110 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
32111 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32112 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
32113 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);
32114 uint32_t ret_ref = 0;
32115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32118 ret_ref = (uintptr_t)ret_var.inner;
32119 if (ret_var.is_owned) {
32125 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
32126 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
32127 uint32_t ret_ref = 0;
32128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32131 ret_ref = (uintptr_t)ret_var.inner;
32132 if (ret_var.is_owned) {
32137 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
32138 LDKChannelAnnouncement arg_conv;
32139 arg_conv.inner = (void*)(arg & (~1));
32140 arg_conv.is_owned = false;
32141 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32142 uint32_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
32146 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
32147 LDKChannelAnnouncement orig_conv;
32148 orig_conv.inner = (void*)(orig & (~1));
32149 orig_conv.is_owned = false;
32150 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32151 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
32152 uint32_t ret_ref = 0;
32153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32156 ret_ref = (uintptr_t)ret_var.inner;
32157 if (ret_var.is_owned) {
32163 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
32164 LDKUnsignedChannelUpdate this_obj_conv;
32165 this_obj_conv.inner = (void*)(this_obj & (~1));
32166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32168 UnsignedChannelUpdate_free(this_obj_conv);
32171 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
32172 LDKUnsignedChannelUpdate this_ptr_conv;
32173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32174 this_ptr_conv.is_owned = false;
32175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32176 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32177 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
32181 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
32182 LDKUnsignedChannelUpdate this_ptr_conv;
32183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32184 this_ptr_conv.is_owned = false;
32185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32186 LDKThirtyTwoBytes val_ref;
32187 CHECK(val->arr_len == 32);
32188 memcpy(val_ref.data, val->elems, 32); FREE(val);
32189 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
32192 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
32193 LDKUnsignedChannelUpdate this_ptr_conv;
32194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32195 this_ptr_conv.is_owned = false;
32196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32197 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
32201 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
32202 LDKUnsignedChannelUpdate this_ptr_conv;
32203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32204 this_ptr_conv.is_owned = false;
32205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32206 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
32209 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
32210 LDKUnsignedChannelUpdate this_ptr_conv;
32211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32212 this_ptr_conv.is_owned = false;
32213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32214 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
32218 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
32219 LDKUnsignedChannelUpdate this_ptr_conv;
32220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32221 this_ptr_conv.is_owned = false;
32222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32223 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
32226 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
32227 LDKUnsignedChannelUpdate this_ptr_conv;
32228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32229 this_ptr_conv.is_owned = false;
32230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32231 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
32235 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
32236 LDKUnsignedChannelUpdate this_ptr_conv;
32237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32238 this_ptr_conv.is_owned = false;
32239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32240 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
32243 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
32244 LDKUnsignedChannelUpdate this_ptr_conv;
32245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32246 this_ptr_conv.is_owned = false;
32247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32248 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
32252 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
32253 LDKUnsignedChannelUpdate this_ptr_conv;
32254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32255 this_ptr_conv.is_owned = false;
32256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32257 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
32260 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
32261 LDKUnsignedChannelUpdate this_ptr_conv;
32262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32263 this_ptr_conv.is_owned = false;
32264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32265 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
32269 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
32270 LDKUnsignedChannelUpdate this_ptr_conv;
32271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32272 this_ptr_conv.is_owned = false;
32273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32274 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
32277 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint32_t this_ptr) {
32278 LDKUnsignedChannelUpdate this_ptr_conv;
32279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32280 this_ptr_conv.is_owned = false;
32281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32282 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
32286 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint32_t this_ptr, int64_t val) {
32287 LDKUnsignedChannelUpdate this_ptr_conv;
32288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32289 this_ptr_conv.is_owned = false;
32290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32291 UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
32294 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
32295 LDKUnsignedChannelUpdate this_ptr_conv;
32296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32297 this_ptr_conv.is_owned = false;
32298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32299 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
32303 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
32304 LDKUnsignedChannelUpdate this_ptr_conv;
32305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32306 this_ptr_conv.is_owned = false;
32307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32308 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
32311 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
32312 LDKUnsignedChannelUpdate this_ptr_conv;
32313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32314 this_ptr_conv.is_owned = false;
32315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32316 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
32320 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
32321 LDKUnsignedChannelUpdate this_ptr_conv;
32322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32323 this_ptr_conv.is_owned = false;
32324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32325 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
32328 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint32_t this_ptr, int8_tArray val) {
32329 LDKUnsignedChannelUpdate this_ptr_conv;
32330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32331 this_ptr_conv.is_owned = false;
32332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32333 LDKCVec_u8Z val_ref;
32334 val_ref.datalen = val->arr_len;
32335 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32336 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32337 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
32340 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_new"))) TS_UnsignedChannelUpdate_new(int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
32341 LDKThirtyTwoBytes chain_hash_arg_ref;
32342 CHECK(chain_hash_arg->arr_len == 32);
32343 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32344 LDKCVec_u8Z excess_data_arg_ref;
32345 excess_data_arg_ref.datalen = excess_data_arg->arr_len;
32346 excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32347 memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
32348 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
32349 uint32_t ret_ref = 0;
32350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32353 ret_ref = (uintptr_t)ret_var.inner;
32354 if (ret_var.is_owned) {
32360 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
32361 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
32362 uint32_t ret_ref = 0;
32363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32366 ret_ref = (uintptr_t)ret_var.inner;
32367 if (ret_var.is_owned) {
32372 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
32373 LDKUnsignedChannelUpdate arg_conv;
32374 arg_conv.inner = (void*)(arg & (~1));
32375 arg_conv.is_owned = false;
32376 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32377 uint32_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
32381 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
32382 LDKUnsignedChannelUpdate orig_conv;
32383 orig_conv.inner = (void*)(orig & (~1));
32384 orig_conv.is_owned = false;
32385 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32386 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
32387 uint32_t ret_ref = 0;
32388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32391 ret_ref = (uintptr_t)ret_var.inner;
32392 if (ret_var.is_owned) {
32398 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
32399 LDKChannelUpdate this_obj_conv;
32400 this_obj_conv.inner = (void*)(this_obj & (~1));
32401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32403 ChannelUpdate_free(this_obj_conv);
32406 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
32407 LDKChannelUpdate this_ptr_conv;
32408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32409 this_ptr_conv.is_owned = false;
32410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32411 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32412 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
32416 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
32417 LDKChannelUpdate this_ptr_conv;
32418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32419 this_ptr_conv.is_owned = false;
32420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32421 LDKSignature val_ref;
32422 CHECK(val->arr_len == 64);
32423 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32424 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
32427 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
32428 LDKChannelUpdate this_ptr_conv;
32429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32430 this_ptr_conv.is_owned = false;
32431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32432 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
32433 uint32_t ret_ref = 0;
32434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32437 ret_ref = (uintptr_t)ret_var.inner;
32438 if (ret_var.is_owned) {
32444 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
32445 LDKChannelUpdate this_ptr_conv;
32446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32447 this_ptr_conv.is_owned = false;
32448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32449 LDKUnsignedChannelUpdate val_conv;
32450 val_conv.inner = (void*)(val & (~1));
32451 val_conv.is_owned = (val & 1) || (val == 0);
32452 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32453 val_conv = UnsignedChannelUpdate_clone(&val_conv);
32454 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
32457 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
32458 LDKSignature signature_arg_ref;
32459 CHECK(signature_arg->arr_len == 64);
32460 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32461 LDKUnsignedChannelUpdate contents_arg_conv;
32462 contents_arg_conv.inner = (void*)(contents_arg & (~1));
32463 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
32464 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32465 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
32466 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
32467 uint32_t ret_ref = 0;
32468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32471 ret_ref = (uintptr_t)ret_var.inner;
32472 if (ret_var.is_owned) {
32478 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
32479 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
32480 uint32_t ret_ref = 0;
32481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32484 ret_ref = (uintptr_t)ret_var.inner;
32485 if (ret_var.is_owned) {
32490 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
32491 LDKChannelUpdate arg_conv;
32492 arg_conv.inner = (void*)(arg & (~1));
32493 arg_conv.is_owned = false;
32494 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32495 uint32_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
32499 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
32500 LDKChannelUpdate orig_conv;
32501 orig_conv.inner = (void*)(orig & (~1));
32502 orig_conv.is_owned = false;
32503 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32504 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
32505 uint32_t ret_ref = 0;
32506 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32507 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32509 ret_ref = (uintptr_t)ret_var.inner;
32510 if (ret_var.is_owned) {
32516 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
32517 LDKQueryChannelRange this_obj_conv;
32518 this_obj_conv.inner = (void*)(this_obj & (~1));
32519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32521 QueryChannelRange_free(this_obj_conv);
32524 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
32525 LDKQueryChannelRange this_ptr_conv;
32526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32527 this_ptr_conv.is_owned = false;
32528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32529 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32530 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
32534 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
32535 LDKQueryChannelRange this_ptr_conv;
32536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32537 this_ptr_conv.is_owned = false;
32538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32539 LDKThirtyTwoBytes val_ref;
32540 CHECK(val->arr_len == 32);
32541 memcpy(val_ref.data, val->elems, 32); FREE(val);
32542 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32545 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
32546 LDKQueryChannelRange this_ptr_conv;
32547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32548 this_ptr_conv.is_owned = false;
32549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32550 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
32554 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
32555 LDKQueryChannelRange this_ptr_conv;
32556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32557 this_ptr_conv.is_owned = false;
32558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32559 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
32562 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
32563 LDKQueryChannelRange this_ptr_conv;
32564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32565 this_ptr_conv.is_owned = false;
32566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32567 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
32571 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
32572 LDKQueryChannelRange this_ptr_conv;
32573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32574 this_ptr_conv.is_owned = false;
32575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32576 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32579 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) {
32580 LDKThirtyTwoBytes chain_hash_arg_ref;
32581 CHECK(chain_hash_arg->arr_len == 32);
32582 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32583 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
32584 uint32_t ret_ref = 0;
32585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32588 ret_ref = (uintptr_t)ret_var.inner;
32589 if (ret_var.is_owned) {
32595 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
32596 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
32597 uint32_t ret_ref = 0;
32598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32601 ret_ref = (uintptr_t)ret_var.inner;
32602 if (ret_var.is_owned) {
32607 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
32608 LDKQueryChannelRange arg_conv;
32609 arg_conv.inner = (void*)(arg & (~1));
32610 arg_conv.is_owned = false;
32611 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32612 uint32_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
32616 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
32617 LDKQueryChannelRange orig_conv;
32618 orig_conv.inner = (void*)(orig & (~1));
32619 orig_conv.is_owned = false;
32620 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32621 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
32622 uint32_t ret_ref = 0;
32623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32626 ret_ref = (uintptr_t)ret_var.inner;
32627 if (ret_var.is_owned) {
32633 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
32634 LDKReplyChannelRange this_obj_conv;
32635 this_obj_conv.inner = (void*)(this_obj & (~1));
32636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32638 ReplyChannelRange_free(this_obj_conv);
32641 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
32642 LDKReplyChannelRange this_ptr_conv;
32643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32644 this_ptr_conv.is_owned = false;
32645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32646 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32647 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
32651 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
32652 LDKReplyChannelRange this_ptr_conv;
32653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32654 this_ptr_conv.is_owned = false;
32655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32656 LDKThirtyTwoBytes val_ref;
32657 CHECK(val->arr_len == 32);
32658 memcpy(val_ref.data, val->elems, 32); FREE(val);
32659 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32662 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
32663 LDKReplyChannelRange this_ptr_conv;
32664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32665 this_ptr_conv.is_owned = false;
32666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32667 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
32671 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
32672 LDKReplyChannelRange this_ptr_conv;
32673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32674 this_ptr_conv.is_owned = false;
32675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32676 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
32679 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
32680 LDKReplyChannelRange this_ptr_conv;
32681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32682 this_ptr_conv.is_owned = false;
32683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32684 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
32688 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
32689 LDKReplyChannelRange this_ptr_conv;
32690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32691 this_ptr_conv.is_owned = false;
32692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32693 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32696 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
32697 LDKReplyChannelRange this_ptr_conv;
32698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32699 this_ptr_conv.is_owned = false;
32700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32701 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
32705 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
32706 LDKReplyChannelRange this_ptr_conv;
32707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32708 this_ptr_conv.is_owned = false;
32709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32710 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
32713 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
32714 LDKReplyChannelRange this_ptr_conv;
32715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32716 this_ptr_conv.is_owned = false;
32717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32718 LDKCVec_u64Z val_constr;
32719 val_constr.datalen = val->arr_len;
32720 if (val_constr.datalen > 0)
32721 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32723 val_constr.data = NULL;
32724 int64_t* val_vals = val->elems;
32725 for (size_t i = 0; i < val_constr.datalen; i++) {
32726 int64_t val_conv_8 = val_vals[i];
32727 val_constr.data[i] = val_conv_8;
32730 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
32733 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) {
32734 LDKThirtyTwoBytes chain_hash_arg_ref;
32735 CHECK(chain_hash_arg->arr_len == 32);
32736 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32737 LDKCVec_u64Z short_channel_ids_arg_constr;
32738 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32739 if (short_channel_ids_arg_constr.datalen > 0)
32740 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32742 short_channel_ids_arg_constr.data = NULL;
32743 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32744 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32745 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32746 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32748 FREE(short_channel_ids_arg);
32749 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
32750 uint32_t ret_ref = 0;
32751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32754 ret_ref = (uintptr_t)ret_var.inner;
32755 if (ret_var.is_owned) {
32761 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
32762 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
32763 uint32_t ret_ref = 0;
32764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32767 ret_ref = (uintptr_t)ret_var.inner;
32768 if (ret_var.is_owned) {
32773 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
32774 LDKReplyChannelRange arg_conv;
32775 arg_conv.inner = (void*)(arg & (~1));
32776 arg_conv.is_owned = false;
32777 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32778 uint32_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
32782 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
32783 LDKReplyChannelRange orig_conv;
32784 orig_conv.inner = (void*)(orig & (~1));
32785 orig_conv.is_owned = false;
32786 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32787 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
32788 uint32_t ret_ref = 0;
32789 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32790 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32792 ret_ref = (uintptr_t)ret_var.inner;
32793 if (ret_var.is_owned) {
32799 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
32800 LDKQueryShortChannelIds this_obj_conv;
32801 this_obj_conv.inner = (void*)(this_obj & (~1));
32802 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32804 QueryShortChannelIds_free(this_obj_conv);
32807 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
32808 LDKQueryShortChannelIds this_ptr_conv;
32809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32810 this_ptr_conv.is_owned = false;
32811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32812 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32813 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
32817 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
32818 LDKQueryShortChannelIds this_ptr_conv;
32819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32820 this_ptr_conv.is_owned = false;
32821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32822 LDKThirtyTwoBytes val_ref;
32823 CHECK(val->arr_len == 32);
32824 memcpy(val_ref.data, val->elems, 32); FREE(val);
32825 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
32828 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
32829 LDKQueryShortChannelIds this_ptr_conv;
32830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32831 this_ptr_conv.is_owned = false;
32832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32833 LDKCVec_u64Z val_constr;
32834 val_constr.datalen = val->arr_len;
32835 if (val_constr.datalen > 0)
32836 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32838 val_constr.data = NULL;
32839 int64_t* val_vals = val->elems;
32840 for (size_t i = 0; i < val_constr.datalen; i++) {
32841 int64_t val_conv_8 = val_vals[i];
32842 val_constr.data[i] = val_conv_8;
32845 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
32848 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
32849 LDKThirtyTwoBytes chain_hash_arg_ref;
32850 CHECK(chain_hash_arg->arr_len == 32);
32851 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32852 LDKCVec_u64Z short_channel_ids_arg_constr;
32853 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32854 if (short_channel_ids_arg_constr.datalen > 0)
32855 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32857 short_channel_ids_arg_constr.data = NULL;
32858 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32859 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32860 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32861 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32863 FREE(short_channel_ids_arg);
32864 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
32865 uint32_t ret_ref = 0;
32866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32869 ret_ref = (uintptr_t)ret_var.inner;
32870 if (ret_var.is_owned) {
32876 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
32877 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
32878 uint32_t ret_ref = 0;
32879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32882 ret_ref = (uintptr_t)ret_var.inner;
32883 if (ret_var.is_owned) {
32888 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
32889 LDKQueryShortChannelIds arg_conv;
32890 arg_conv.inner = (void*)(arg & (~1));
32891 arg_conv.is_owned = false;
32892 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32893 uint32_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
32897 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
32898 LDKQueryShortChannelIds orig_conv;
32899 orig_conv.inner = (void*)(orig & (~1));
32900 orig_conv.is_owned = false;
32901 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32902 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
32903 uint32_t ret_ref = 0;
32904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32907 ret_ref = (uintptr_t)ret_var.inner;
32908 if (ret_var.is_owned) {
32914 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
32915 LDKReplyShortChannelIdsEnd this_obj_conv;
32916 this_obj_conv.inner = (void*)(this_obj & (~1));
32917 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32919 ReplyShortChannelIdsEnd_free(this_obj_conv);
32922 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
32923 LDKReplyShortChannelIdsEnd this_ptr_conv;
32924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32925 this_ptr_conv.is_owned = false;
32926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32927 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32928 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
32932 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
32933 LDKReplyShortChannelIdsEnd this_ptr_conv;
32934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32935 this_ptr_conv.is_owned = false;
32936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32937 LDKThirtyTwoBytes val_ref;
32938 CHECK(val->arr_len == 32);
32939 memcpy(val_ref.data, val->elems, 32); FREE(val);
32940 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
32943 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
32944 LDKReplyShortChannelIdsEnd this_ptr_conv;
32945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32946 this_ptr_conv.is_owned = false;
32947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32948 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
32952 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
32953 LDKReplyShortChannelIdsEnd this_ptr_conv;
32954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32955 this_ptr_conv.is_owned = false;
32956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32957 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
32960 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
32961 LDKThirtyTwoBytes chain_hash_arg_ref;
32962 CHECK(chain_hash_arg->arr_len == 32);
32963 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32964 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
32965 uint32_t ret_ref = 0;
32966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32969 ret_ref = (uintptr_t)ret_var.inner;
32970 if (ret_var.is_owned) {
32976 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
32977 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
32978 uint32_t ret_ref = 0;
32979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32982 ret_ref = (uintptr_t)ret_var.inner;
32983 if (ret_var.is_owned) {
32988 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
32989 LDKReplyShortChannelIdsEnd arg_conv;
32990 arg_conv.inner = (void*)(arg & (~1));
32991 arg_conv.is_owned = false;
32992 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32993 uint32_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
32997 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
32998 LDKReplyShortChannelIdsEnd orig_conv;
32999 orig_conv.inner = (void*)(orig & (~1));
33000 orig_conv.is_owned = false;
33001 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33002 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33003 uint32_t ret_ref = 0;
33004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33007 ret_ref = (uintptr_t)ret_var.inner;
33008 if (ret_var.is_owned) {
33014 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
33015 LDKGossipTimestampFilter this_obj_conv;
33016 this_obj_conv.inner = (void*)(this_obj & (~1));
33017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33019 GossipTimestampFilter_free(this_obj_conv);
33022 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
33023 LDKGossipTimestampFilter this_ptr_conv;
33024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33025 this_ptr_conv.is_owned = false;
33026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33027 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33028 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
33032 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
33033 LDKGossipTimestampFilter this_ptr_conv;
33034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33035 this_ptr_conv.is_owned = false;
33036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33037 LDKThirtyTwoBytes val_ref;
33038 CHECK(val->arr_len == 32);
33039 memcpy(val_ref.data, val->elems, 32); FREE(val);
33040 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
33043 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
33044 LDKGossipTimestampFilter this_ptr_conv;
33045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33046 this_ptr_conv.is_owned = false;
33047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33048 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
33052 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
33053 LDKGossipTimestampFilter this_ptr_conv;
33054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33055 this_ptr_conv.is_owned = false;
33056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33057 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
33060 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
33061 LDKGossipTimestampFilter this_ptr_conv;
33062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33063 this_ptr_conv.is_owned = false;
33064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33065 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
33069 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
33070 LDKGossipTimestampFilter this_ptr_conv;
33071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33072 this_ptr_conv.is_owned = false;
33073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
33077 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) {
33078 LDKThirtyTwoBytes chain_hash_arg_ref;
33079 CHECK(chain_hash_arg->arr_len == 32);
33080 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33081 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
33082 uint32_t ret_ref = 0;
33083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33086 ret_ref = (uintptr_t)ret_var.inner;
33087 if (ret_var.is_owned) {
33093 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
33094 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
33095 uint32_t ret_ref = 0;
33096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33099 ret_ref = (uintptr_t)ret_var.inner;
33100 if (ret_var.is_owned) {
33105 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
33106 LDKGossipTimestampFilter arg_conv;
33107 arg_conv.inner = (void*)(arg & (~1));
33108 arg_conv.is_owned = false;
33109 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33110 uint32_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
33114 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
33115 LDKGossipTimestampFilter orig_conv;
33116 orig_conv.inner = (void*)(orig & (~1));
33117 orig_conv.is_owned = false;
33118 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33119 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
33120 uint32_t ret_ref = 0;
33121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33124 ret_ref = (uintptr_t)ret_var.inner;
33125 if (ret_var.is_owned) {
33131 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
33132 if ((this_ptr & 1) != 0) return;
33133 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33134 CHECK_ACCESS(this_ptr_ptr);
33135 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
33136 FREE((void*)this_ptr);
33137 ErrorAction_free(this_ptr_conv);
33140 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
33141 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33142 *ret_copy = ErrorAction_clone(arg);
33143 uint32_t ret_ref = (uintptr_t)ret_copy;
33146 uint32_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
33147 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
33148 uint32_t ret_conv = ErrorAction_clone_ptr(arg_conv);
33152 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
33153 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
33154 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33155 *ret_copy = ErrorAction_clone(orig_conv);
33156 uint32_t ret_ref = (uintptr_t)ret_copy;
33160 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
33161 LDKErrorMessage msg_conv;
33162 msg_conv.inner = (void*)(msg & (~1));
33163 msg_conv.is_owned = (msg & 1) || (msg == 0);
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33165 msg_conv = ErrorMessage_clone(&msg_conv);
33166 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33167 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
33168 uint32_t ret_ref = (uintptr_t)ret_copy;
33172 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
33173 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33174 *ret_copy = ErrorAction_ignore_error();
33175 uint32_t ret_ref = (uintptr_t)ret_copy;
33179 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
33180 LDKLevel a_conv = LDKLevel_from_js(a);
33181 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33182 *ret_copy = ErrorAction_ignore_and_log(a_conv);
33183 uint32_t ret_ref = (uintptr_t)ret_copy;
33187 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
33188 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33189 *ret_copy = ErrorAction_ignore_duplicate_gossip();
33190 uint32_t ret_ref = (uintptr_t)ret_copy;
33194 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
33195 LDKErrorMessage msg_conv;
33196 msg_conv.inner = (void*)(msg & (~1));
33197 msg_conv.is_owned = (msg & 1) || (msg == 0);
33198 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33199 msg_conv = ErrorMessage_clone(&msg_conv);
33200 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33201 *ret_copy = ErrorAction_send_error_message(msg_conv);
33202 uint32_t ret_ref = (uintptr_t)ret_copy;
33206 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
33207 LDKWarningMessage msg_conv;
33208 msg_conv.inner = (void*)(msg & (~1));
33209 msg_conv.is_owned = (msg & 1) || (msg == 0);
33210 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33211 msg_conv = WarningMessage_clone(&msg_conv);
33212 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
33213 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33214 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
33215 uint32_t ret_ref = (uintptr_t)ret_copy;
33219 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
33220 LDKLightningError this_obj_conv;
33221 this_obj_conv.inner = (void*)(this_obj & (~1));
33222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33224 LightningError_free(this_obj_conv);
33227 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
33228 LDKLightningError this_ptr_conv;
33229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33230 this_ptr_conv.is_owned = false;
33231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33232 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
33233 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
33238 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
33239 LDKLightningError this_ptr_conv;
33240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33241 this_ptr_conv.is_owned = false;
33242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33243 LDKStr val_conv = str_ref_to_owned_c(val);
33244 LightningError_set_err(&this_ptr_conv, val_conv);
33247 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
33248 LDKLightningError this_ptr_conv;
33249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33250 this_ptr_conv.is_owned = false;
33251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33252 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33253 *ret_copy = LightningError_get_action(&this_ptr_conv);
33254 uint32_t ret_ref = (uintptr_t)ret_copy;
33258 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
33259 LDKLightningError this_ptr_conv;
33260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33261 this_ptr_conv.is_owned = false;
33262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33263 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33264 CHECK_ACCESS(val_ptr);
33265 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
33266 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
33267 LightningError_set_action(&this_ptr_conv, val_conv);
33270 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
33271 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
33272 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
33273 CHECK_ACCESS(action_arg_ptr);
33274 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
33275 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
33276 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
33277 uint32_t ret_ref = 0;
33278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33281 ret_ref = (uintptr_t)ret_var.inner;
33282 if (ret_var.is_owned) {
33288 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
33289 LDKLightningError ret_var = LightningError_clone(arg);
33290 uint32_t ret_ref = 0;
33291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33294 ret_ref = (uintptr_t)ret_var.inner;
33295 if (ret_var.is_owned) {
33300 uint32_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
33301 LDKLightningError arg_conv;
33302 arg_conv.inner = (void*)(arg & (~1));
33303 arg_conv.is_owned = false;
33304 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33305 uint32_t ret_conv = LightningError_clone_ptr(&arg_conv);
33309 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
33310 LDKLightningError orig_conv;
33311 orig_conv.inner = (void*)(orig & (~1));
33312 orig_conv.is_owned = false;
33313 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33314 LDKLightningError ret_var = LightningError_clone(&orig_conv);
33315 uint32_t ret_ref = 0;
33316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33319 ret_ref = (uintptr_t)ret_var.inner;
33320 if (ret_var.is_owned) {
33326 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
33327 LDKCommitmentUpdate this_obj_conv;
33328 this_obj_conv.inner = (void*)(this_obj & (~1));
33329 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33331 CommitmentUpdate_free(this_obj_conv);
33334 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
33335 LDKCommitmentUpdate this_ptr_conv;
33336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33337 this_ptr_conv.is_owned = false;
33338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33339 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
33340 uint32_tArray ret_arr = NULL;
33341 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
33342 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
33343 for (size_t p = 0; p < ret_var.datalen; p++) {
33344 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
33345 uint32_t ret_conv_15_ref = 0;
33346 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33347 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
33349 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
33350 if (ret_conv_15_var.is_owned) {
33351 ret_conv_15_ref |= 1;
33353 ret_arr_ptr[p] = ret_conv_15_ref;
33356 FREE(ret_var.data);
33360 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
33361 LDKCommitmentUpdate this_ptr_conv;
33362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33363 this_ptr_conv.is_owned = false;
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33365 LDKCVec_UpdateAddHTLCZ val_constr;
33366 val_constr.datalen = val->arr_len;
33367 if (val_constr.datalen > 0)
33368 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33370 val_constr.data = NULL;
33371 uint32_t* val_vals = val->elems;
33372 for (size_t p = 0; p < val_constr.datalen; p++) {
33373 uint32_t val_conv_15 = val_vals[p];
33374 LDKUpdateAddHTLC val_conv_15_conv;
33375 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
33376 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
33377 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
33378 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
33379 val_constr.data[p] = val_conv_15_conv;
33382 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
33385 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
33386 LDKCommitmentUpdate this_ptr_conv;
33387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33388 this_ptr_conv.is_owned = false;
33389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33390 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
33391 uint32_tArray ret_arr = NULL;
33392 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
33393 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
33394 for (size_t t = 0; t < ret_var.datalen; t++) {
33395 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
33396 uint32_t ret_conv_19_ref = 0;
33397 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33398 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
33400 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
33401 if (ret_conv_19_var.is_owned) {
33402 ret_conv_19_ref |= 1;
33404 ret_arr_ptr[t] = ret_conv_19_ref;
33407 FREE(ret_var.data);
33411 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
33412 LDKCommitmentUpdate this_ptr_conv;
33413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33414 this_ptr_conv.is_owned = false;
33415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33416 LDKCVec_UpdateFulfillHTLCZ val_constr;
33417 val_constr.datalen = val->arr_len;
33418 if (val_constr.datalen > 0)
33419 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33421 val_constr.data = NULL;
33422 uint32_t* val_vals = val->elems;
33423 for (size_t t = 0; t < val_constr.datalen; t++) {
33424 uint32_t val_conv_19 = val_vals[t];
33425 LDKUpdateFulfillHTLC val_conv_19_conv;
33426 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
33427 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
33428 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
33429 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
33430 val_constr.data[t] = val_conv_19_conv;
33433 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
33436 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
33437 LDKCommitmentUpdate this_ptr_conv;
33438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33439 this_ptr_conv.is_owned = false;
33440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33441 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
33442 uint32_tArray ret_arr = NULL;
33443 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
33444 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
33445 for (size_t q = 0; q < ret_var.datalen; q++) {
33446 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
33447 uint32_t ret_conv_16_ref = 0;
33448 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33449 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
33451 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
33452 if (ret_conv_16_var.is_owned) {
33453 ret_conv_16_ref |= 1;
33455 ret_arr_ptr[q] = ret_conv_16_ref;
33458 FREE(ret_var.data);
33462 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
33463 LDKCommitmentUpdate this_ptr_conv;
33464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33465 this_ptr_conv.is_owned = false;
33466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33467 LDKCVec_UpdateFailHTLCZ val_constr;
33468 val_constr.datalen = val->arr_len;
33469 if (val_constr.datalen > 0)
33470 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33472 val_constr.data = NULL;
33473 uint32_t* val_vals = val->elems;
33474 for (size_t q = 0; q < val_constr.datalen; q++) {
33475 uint32_t val_conv_16 = val_vals[q];
33476 LDKUpdateFailHTLC val_conv_16_conv;
33477 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
33478 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
33479 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
33480 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
33481 val_constr.data[q] = val_conv_16_conv;
33484 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
33487 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
33488 LDKCommitmentUpdate this_ptr_conv;
33489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33490 this_ptr_conv.is_owned = false;
33491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33492 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
33493 uint32_tArray ret_arr = NULL;
33494 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
33495 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
33496 for (size_t z = 0; z < ret_var.datalen; z++) {
33497 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
33498 uint32_t ret_conv_25_ref = 0;
33499 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33500 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
33502 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
33503 if (ret_conv_25_var.is_owned) {
33504 ret_conv_25_ref |= 1;
33506 ret_arr_ptr[z] = ret_conv_25_ref;
33509 FREE(ret_var.data);
33513 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) {
33514 LDKCommitmentUpdate this_ptr_conv;
33515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33516 this_ptr_conv.is_owned = false;
33517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33518 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
33519 val_constr.datalen = val->arr_len;
33520 if (val_constr.datalen > 0)
33521 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33523 val_constr.data = NULL;
33524 uint32_t* val_vals = val->elems;
33525 for (size_t z = 0; z < val_constr.datalen; z++) {
33526 uint32_t val_conv_25 = val_vals[z];
33527 LDKUpdateFailMalformedHTLC val_conv_25_conv;
33528 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
33529 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
33530 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
33531 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
33532 val_constr.data[z] = val_conv_25_conv;
33535 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
33538 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
33539 LDKCommitmentUpdate this_ptr_conv;
33540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33541 this_ptr_conv.is_owned = false;
33542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33543 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
33544 uint32_t ret_ref = 0;
33545 if ((uintptr_t)ret_var.inner > 4096) {
33546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33549 ret_ref = (uintptr_t)ret_var.inner;
33550 if (ret_var.is_owned) {
33557 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
33558 LDKCommitmentUpdate 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 LDKUpdateFee val_conv;
33563 val_conv.inner = (void*)(val & (~1));
33564 val_conv.is_owned = (val & 1) || (val == 0);
33565 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33566 val_conv = UpdateFee_clone(&val_conv);
33567 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
33570 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
33571 LDKCommitmentUpdate this_ptr_conv;
33572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33573 this_ptr_conv.is_owned = false;
33574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33575 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
33576 uint32_t ret_ref = 0;
33577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33580 ret_ref = (uintptr_t)ret_var.inner;
33581 if (ret_var.is_owned) {
33587 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
33588 LDKCommitmentUpdate this_ptr_conv;
33589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33590 this_ptr_conv.is_owned = false;
33591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33592 LDKCommitmentSigned val_conv;
33593 val_conv.inner = (void*)(val & (~1));
33594 val_conv.is_owned = (val & 1) || (val == 0);
33595 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33596 val_conv = CommitmentSigned_clone(&val_conv);
33597 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
33600 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) {
33601 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
33602 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
33603 if (update_add_htlcs_arg_constr.datalen > 0)
33604 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33606 update_add_htlcs_arg_constr.data = NULL;
33607 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
33608 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
33609 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
33610 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
33611 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
33612 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
33613 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
33614 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
33615 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
33617 FREE(update_add_htlcs_arg);
33618 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
33619 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
33620 if (update_fulfill_htlcs_arg_constr.datalen > 0)
33621 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33623 update_fulfill_htlcs_arg_constr.data = NULL;
33624 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
33625 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
33626 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
33627 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
33628 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
33629 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
33630 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
33631 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
33632 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
33634 FREE(update_fulfill_htlcs_arg);
33635 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
33636 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
33637 if (update_fail_htlcs_arg_constr.datalen > 0)
33638 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33640 update_fail_htlcs_arg_constr.data = NULL;
33641 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
33642 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
33643 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
33644 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
33645 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
33646 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
33647 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
33648 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
33649 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
33651 FREE(update_fail_htlcs_arg);
33652 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
33653 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
33654 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
33655 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33657 update_fail_malformed_htlcs_arg_constr.data = NULL;
33658 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
33659 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
33660 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
33661 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
33662 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
33663 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);
33664 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
33665 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
33666 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
33668 FREE(update_fail_malformed_htlcs_arg);
33669 LDKUpdateFee update_fee_arg_conv;
33670 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
33671 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
33672 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
33673 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
33674 LDKCommitmentSigned commitment_signed_arg_conv;
33675 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
33676 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
33677 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
33678 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
33679 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);
33680 uint32_t ret_ref = 0;
33681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33684 ret_ref = (uintptr_t)ret_var.inner;
33685 if (ret_var.is_owned) {
33691 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
33692 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
33693 uint32_t ret_ref = 0;
33694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33697 ret_ref = (uintptr_t)ret_var.inner;
33698 if (ret_var.is_owned) {
33703 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
33704 LDKCommitmentUpdate arg_conv;
33705 arg_conv.inner = (void*)(arg & (~1));
33706 arg_conv.is_owned = false;
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33708 uint32_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
33712 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
33713 LDKCommitmentUpdate orig_conv;
33714 orig_conv.inner = (void*)(orig & (~1));
33715 orig_conv.is_owned = false;
33716 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33717 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
33718 uint32_t ret_ref = 0;
33719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33722 ret_ref = (uintptr_t)ret_var.inner;
33723 if (ret_var.is_owned) {
33729 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
33730 if ((this_ptr & 1) != 0) return;
33731 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33732 CHECK_ACCESS(this_ptr_ptr);
33733 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
33734 FREE((void*)this_ptr);
33735 ChannelMessageHandler_free(this_ptr_conv);
33738 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
33739 if ((this_ptr & 1) != 0) return;
33740 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33741 CHECK_ACCESS(this_ptr_ptr);
33742 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
33743 FREE((void*)this_ptr);
33744 RoutingMessageHandler_free(this_ptr_conv);
33747 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
33748 LDKAcceptChannel obj_conv;
33749 obj_conv.inner = (void*)(obj & (~1));
33750 obj_conv.is_owned = false;
33751 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33752 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
33753 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33754 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33755 CVec_u8Z_free(ret_var);
33759 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
33760 LDKu8slice ser_ref;
33761 ser_ref.datalen = ser->arr_len;
33762 ser_ref.data = ser->elems;
33763 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33764 *ret_conv = AcceptChannel_read(ser_ref);
33766 return (uint32_t)ret_conv;
33769 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
33770 LDKAnnouncementSignatures obj_conv;
33771 obj_conv.inner = (void*)(obj & (~1));
33772 obj_conv.is_owned = false;
33773 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33774 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
33775 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33776 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33777 CVec_u8Z_free(ret_var);
33781 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
33782 LDKu8slice ser_ref;
33783 ser_ref.datalen = ser->arr_len;
33784 ser_ref.data = ser->elems;
33785 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
33786 *ret_conv = AnnouncementSignatures_read(ser_ref);
33788 return (uint32_t)ret_conv;
33791 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
33792 LDKChannelReestablish obj_conv;
33793 obj_conv.inner = (void*)(obj & (~1));
33794 obj_conv.is_owned = false;
33795 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33796 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
33797 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33798 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33799 CVec_u8Z_free(ret_var);
33803 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
33804 LDKu8slice ser_ref;
33805 ser_ref.datalen = ser->arr_len;
33806 ser_ref.data = ser->elems;
33807 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
33808 *ret_conv = ChannelReestablish_read(ser_ref);
33810 return (uint32_t)ret_conv;
33813 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
33814 LDKClosingSigned obj_conv;
33815 obj_conv.inner = (void*)(obj & (~1));
33816 obj_conv.is_owned = false;
33817 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33818 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
33819 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33820 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33821 CVec_u8Z_free(ret_var);
33825 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
33826 LDKu8slice ser_ref;
33827 ser_ref.datalen = ser->arr_len;
33828 ser_ref.data = ser->elems;
33829 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
33830 *ret_conv = ClosingSigned_read(ser_ref);
33832 return (uint32_t)ret_conv;
33835 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
33836 LDKClosingSignedFeeRange obj_conv;
33837 obj_conv.inner = (void*)(obj & (~1));
33838 obj_conv.is_owned = false;
33839 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33840 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
33841 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33842 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33843 CVec_u8Z_free(ret_var);
33847 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
33848 LDKu8slice ser_ref;
33849 ser_ref.datalen = ser->arr_len;
33850 ser_ref.data = ser->elems;
33851 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
33852 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
33854 return (uint32_t)ret_conv;
33857 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
33858 LDKCommitmentSigned obj_conv;
33859 obj_conv.inner = (void*)(obj & (~1));
33860 obj_conv.is_owned = false;
33861 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33862 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
33863 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33864 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33865 CVec_u8Z_free(ret_var);
33869 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
33870 LDKu8slice ser_ref;
33871 ser_ref.datalen = ser->arr_len;
33872 ser_ref.data = ser->elems;
33873 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
33874 *ret_conv = CommitmentSigned_read(ser_ref);
33876 return (uint32_t)ret_conv;
33879 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
33880 LDKFundingCreated obj_conv;
33881 obj_conv.inner = (void*)(obj & (~1));
33882 obj_conv.is_owned = false;
33883 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33884 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
33885 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33886 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33887 CVec_u8Z_free(ret_var);
33891 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
33892 LDKu8slice ser_ref;
33893 ser_ref.datalen = ser->arr_len;
33894 ser_ref.data = ser->elems;
33895 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
33896 *ret_conv = FundingCreated_read(ser_ref);
33898 return (uint32_t)ret_conv;
33901 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
33902 LDKFundingSigned obj_conv;
33903 obj_conv.inner = (void*)(obj & (~1));
33904 obj_conv.is_owned = false;
33905 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33906 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
33907 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33908 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33909 CVec_u8Z_free(ret_var);
33913 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
33914 LDKu8slice ser_ref;
33915 ser_ref.datalen = ser->arr_len;
33916 ser_ref.data = ser->elems;
33917 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
33918 *ret_conv = FundingSigned_read(ser_ref);
33920 return (uint32_t)ret_conv;
33923 int8_tArray __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint32_t obj) {
33924 LDKChannelReady obj_conv;
33925 obj_conv.inner = (void*)(obj & (~1));
33926 obj_conv.is_owned = false;
33927 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33928 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
33929 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33930 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33931 CVec_u8Z_free(ret_var);
33935 uint32_t __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
33936 LDKu8slice ser_ref;
33937 ser_ref.datalen = ser->arr_len;
33938 ser_ref.data = ser->elems;
33939 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
33940 *ret_conv = ChannelReady_read(ser_ref);
33942 return (uint32_t)ret_conv;
33945 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
33947 obj_conv.inner = (void*)(obj & (~1));
33948 obj_conv.is_owned = false;
33949 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33950 LDKCVec_u8Z ret_var = Init_write(&obj_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 CVec_u8Z_free(ret_var);
33957 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
33958 LDKu8slice ser_ref;
33959 ser_ref.datalen = ser->arr_len;
33960 ser_ref.data = ser->elems;
33961 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
33962 *ret_conv = Init_read(ser_ref);
33964 return (uint32_t)ret_conv;
33967 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
33968 LDKOpenChannel obj_conv;
33969 obj_conv.inner = (void*)(obj & (~1));
33970 obj_conv.is_owned = false;
33971 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33972 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
33973 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33974 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33975 CVec_u8Z_free(ret_var);
33979 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
33980 LDKu8slice ser_ref;
33981 ser_ref.datalen = ser->arr_len;
33982 ser_ref.data = ser->elems;
33983 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
33984 *ret_conv = OpenChannel_read(ser_ref);
33986 return (uint32_t)ret_conv;
33989 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
33990 LDKRevokeAndACK obj_conv;
33991 obj_conv.inner = (void*)(obj & (~1));
33992 obj_conv.is_owned = false;
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33994 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
33995 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33996 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33997 CVec_u8Z_free(ret_var);
34001 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
34002 LDKu8slice ser_ref;
34003 ser_ref.datalen = ser->arr_len;
34004 ser_ref.data = ser->elems;
34005 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34006 *ret_conv = RevokeAndACK_read(ser_ref);
34008 return (uint32_t)ret_conv;
34011 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
34012 LDKShutdown obj_conv;
34013 obj_conv.inner = (void*)(obj & (~1));
34014 obj_conv.is_owned = false;
34015 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34016 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34017 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34018 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34019 CVec_u8Z_free(ret_var);
34023 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
34024 LDKu8slice ser_ref;
34025 ser_ref.datalen = ser->arr_len;
34026 ser_ref.data = ser->elems;
34027 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34028 *ret_conv = Shutdown_read(ser_ref);
34030 return (uint32_t)ret_conv;
34033 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
34034 LDKUpdateFailHTLC obj_conv;
34035 obj_conv.inner = (void*)(obj & (~1));
34036 obj_conv.is_owned = false;
34037 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34038 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
34039 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34040 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34041 CVec_u8Z_free(ret_var);
34045 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
34046 LDKu8slice ser_ref;
34047 ser_ref.datalen = ser->arr_len;
34048 ser_ref.data = ser->elems;
34049 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
34050 *ret_conv = UpdateFailHTLC_read(ser_ref);
34052 return (uint32_t)ret_conv;
34055 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
34056 LDKUpdateFailMalformedHTLC obj_conv;
34057 obj_conv.inner = (void*)(obj & (~1));
34058 obj_conv.is_owned = false;
34059 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34060 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
34061 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34062 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34063 CVec_u8Z_free(ret_var);
34067 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
34068 LDKu8slice ser_ref;
34069 ser_ref.datalen = ser->arr_len;
34070 ser_ref.data = ser->elems;
34071 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
34072 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
34074 return (uint32_t)ret_conv;
34077 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
34078 LDKUpdateFee obj_conv;
34079 obj_conv.inner = (void*)(obj & (~1));
34080 obj_conv.is_owned = false;
34081 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34082 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
34083 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34084 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34085 CVec_u8Z_free(ret_var);
34089 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
34090 LDKu8slice ser_ref;
34091 ser_ref.datalen = ser->arr_len;
34092 ser_ref.data = ser->elems;
34093 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
34094 *ret_conv = UpdateFee_read(ser_ref);
34096 return (uint32_t)ret_conv;
34099 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
34100 LDKUpdateFulfillHTLC obj_conv;
34101 obj_conv.inner = (void*)(obj & (~1));
34102 obj_conv.is_owned = false;
34103 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34104 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
34105 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34106 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34107 CVec_u8Z_free(ret_var);
34111 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
34112 LDKu8slice ser_ref;
34113 ser_ref.datalen = ser->arr_len;
34114 ser_ref.data = ser->elems;
34115 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
34116 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
34118 return (uint32_t)ret_conv;
34121 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
34122 LDKUpdateAddHTLC obj_conv;
34123 obj_conv.inner = (void*)(obj & (~1));
34124 obj_conv.is_owned = false;
34125 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34126 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
34127 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34128 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34129 CVec_u8Z_free(ret_var);
34133 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
34134 LDKu8slice ser_ref;
34135 ser_ref.datalen = ser->arr_len;
34136 ser_ref.data = ser->elems;
34137 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
34138 *ret_conv = UpdateAddHTLC_read(ser_ref);
34140 return (uint32_t)ret_conv;
34143 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
34145 obj_conv.inner = (void*)(obj & (~1));
34146 obj_conv.is_owned = false;
34147 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34148 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
34149 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34150 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34151 CVec_u8Z_free(ret_var);
34155 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
34156 LDKu8slice ser_ref;
34157 ser_ref.datalen = ser->arr_len;
34158 ser_ref.data = ser->elems;
34159 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
34160 *ret_conv = Ping_read(ser_ref);
34162 return (uint32_t)ret_conv;
34165 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
34167 obj_conv.inner = (void*)(obj & (~1));
34168 obj_conv.is_owned = false;
34169 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34170 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
34171 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34172 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34173 CVec_u8Z_free(ret_var);
34177 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
34178 LDKu8slice ser_ref;
34179 ser_ref.datalen = ser->arr_len;
34180 ser_ref.data = ser->elems;
34181 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
34182 *ret_conv = Pong_read(ser_ref);
34184 return (uint32_t)ret_conv;
34187 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
34188 LDKUnsignedChannelAnnouncement obj_conv;
34189 obj_conv.inner = (void*)(obj & (~1));
34190 obj_conv.is_owned = false;
34191 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34192 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
34193 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34194 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34195 CVec_u8Z_free(ret_var);
34199 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
34200 LDKu8slice ser_ref;
34201 ser_ref.datalen = ser->arr_len;
34202 ser_ref.data = ser->elems;
34203 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
34204 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
34206 return (uint32_t)ret_conv;
34209 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
34210 LDKChannelAnnouncement obj_conv;
34211 obj_conv.inner = (void*)(obj & (~1));
34212 obj_conv.is_owned = false;
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34214 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
34215 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34216 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34217 CVec_u8Z_free(ret_var);
34221 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
34222 LDKu8slice ser_ref;
34223 ser_ref.datalen = ser->arr_len;
34224 ser_ref.data = ser->elems;
34225 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
34226 *ret_conv = ChannelAnnouncement_read(ser_ref);
34228 return (uint32_t)ret_conv;
34231 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
34232 LDKUnsignedChannelUpdate obj_conv;
34233 obj_conv.inner = (void*)(obj & (~1));
34234 obj_conv.is_owned = false;
34235 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34236 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
34237 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34238 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34239 CVec_u8Z_free(ret_var);
34243 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
34244 LDKu8slice ser_ref;
34245 ser_ref.datalen = ser->arr_len;
34246 ser_ref.data = ser->elems;
34247 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
34248 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
34250 return (uint32_t)ret_conv;
34253 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
34254 LDKChannelUpdate obj_conv;
34255 obj_conv.inner = (void*)(obj & (~1));
34256 obj_conv.is_owned = false;
34257 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34258 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
34259 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34260 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34261 CVec_u8Z_free(ret_var);
34265 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
34266 LDKu8slice ser_ref;
34267 ser_ref.datalen = ser->arr_len;
34268 ser_ref.data = ser->elems;
34269 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
34270 *ret_conv = ChannelUpdate_read(ser_ref);
34272 return (uint32_t)ret_conv;
34275 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
34276 LDKErrorMessage obj_conv;
34277 obj_conv.inner = (void*)(obj & (~1));
34278 obj_conv.is_owned = false;
34279 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34280 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
34281 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34282 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34283 CVec_u8Z_free(ret_var);
34287 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
34288 LDKu8slice ser_ref;
34289 ser_ref.datalen = ser->arr_len;
34290 ser_ref.data = ser->elems;
34291 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
34292 *ret_conv = ErrorMessage_read(ser_ref);
34294 return (uint32_t)ret_conv;
34297 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
34298 LDKWarningMessage obj_conv;
34299 obj_conv.inner = (void*)(obj & (~1));
34300 obj_conv.is_owned = false;
34301 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34302 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
34303 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34304 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34305 CVec_u8Z_free(ret_var);
34309 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
34310 LDKu8slice ser_ref;
34311 ser_ref.datalen = ser->arr_len;
34312 ser_ref.data = ser->elems;
34313 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
34314 *ret_conv = WarningMessage_read(ser_ref);
34316 return (uint32_t)ret_conv;
34319 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
34320 LDKUnsignedNodeAnnouncement obj_conv;
34321 obj_conv.inner = (void*)(obj & (~1));
34322 obj_conv.is_owned = false;
34323 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34324 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
34325 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34326 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34327 CVec_u8Z_free(ret_var);
34331 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
34332 LDKu8slice ser_ref;
34333 ser_ref.datalen = ser->arr_len;
34334 ser_ref.data = ser->elems;
34335 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
34336 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
34338 return (uint32_t)ret_conv;
34341 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
34342 LDKNodeAnnouncement obj_conv;
34343 obj_conv.inner = (void*)(obj & (~1));
34344 obj_conv.is_owned = false;
34345 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34346 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
34347 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34348 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34349 CVec_u8Z_free(ret_var);
34353 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
34354 LDKu8slice ser_ref;
34355 ser_ref.datalen = ser->arr_len;
34356 ser_ref.data = ser->elems;
34357 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
34358 *ret_conv = NodeAnnouncement_read(ser_ref);
34360 return (uint32_t)ret_conv;
34363 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
34364 LDKu8slice ser_ref;
34365 ser_ref.datalen = ser->arr_len;
34366 ser_ref.data = ser->elems;
34367 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
34368 *ret_conv = QueryShortChannelIds_read(ser_ref);
34370 return (uint32_t)ret_conv;
34373 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
34374 LDKQueryShortChannelIds obj_conv;
34375 obj_conv.inner = (void*)(obj & (~1));
34376 obj_conv.is_owned = false;
34377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34378 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
34379 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34380 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34381 CVec_u8Z_free(ret_var);
34385 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
34386 LDKReplyShortChannelIdsEnd obj_conv;
34387 obj_conv.inner = (void*)(obj & (~1));
34388 obj_conv.is_owned = false;
34389 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34390 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
34391 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34392 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34393 CVec_u8Z_free(ret_var);
34397 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
34398 LDKu8slice ser_ref;
34399 ser_ref.datalen = ser->arr_len;
34400 ser_ref.data = ser->elems;
34401 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
34402 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
34404 return (uint32_t)ret_conv;
34407 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
34408 LDKQueryChannelRange this_arg_conv;
34409 this_arg_conv.inner = (void*)(this_arg & (~1));
34410 this_arg_conv.is_owned = false;
34411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34412 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
34416 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
34417 LDKQueryChannelRange obj_conv;
34418 obj_conv.inner = (void*)(obj & (~1));
34419 obj_conv.is_owned = false;
34420 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34421 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
34422 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34423 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34424 CVec_u8Z_free(ret_var);
34428 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
34429 LDKu8slice ser_ref;
34430 ser_ref.datalen = ser->arr_len;
34431 ser_ref.data = ser->elems;
34432 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
34433 *ret_conv = QueryChannelRange_read(ser_ref);
34435 return (uint32_t)ret_conv;
34438 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
34439 LDKu8slice ser_ref;
34440 ser_ref.datalen = ser->arr_len;
34441 ser_ref.data = ser->elems;
34442 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
34443 *ret_conv = ReplyChannelRange_read(ser_ref);
34445 return (uint32_t)ret_conv;
34448 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
34449 LDKReplyChannelRange obj_conv;
34450 obj_conv.inner = (void*)(obj & (~1));
34451 obj_conv.is_owned = false;
34452 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34453 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
34454 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34455 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34456 CVec_u8Z_free(ret_var);
34460 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
34461 LDKGossipTimestampFilter obj_conv;
34462 obj_conv.inner = (void*)(obj & (~1));
34463 obj_conv.is_owned = false;
34464 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34465 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
34466 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34467 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34468 CVec_u8Z_free(ret_var);
34472 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
34473 LDKu8slice ser_ref;
34474 ser_ref.datalen = ser->arr_len;
34475 ser_ref.data = ser->elems;
34476 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
34477 *ret_conv = GossipTimestampFilter_read(ser_ref);
34479 return (uint32_t)ret_conv;
34482 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
34483 if ((this_ptr & 1) != 0) return;
34484 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34485 CHECK_ACCESS(this_ptr_ptr);
34486 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
34487 FREE((void*)this_ptr);
34488 CustomMessageHandler_free(this_ptr_conv);
34491 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
34492 LDKIgnoringMessageHandler this_obj_conv;
34493 this_obj_conv.inner = (void*)(this_obj & (~1));
34494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34496 IgnoringMessageHandler_free(this_obj_conv);
34499 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
34500 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
34501 uint32_t ret_ref = 0;
34502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34505 ret_ref = (uintptr_t)ret_var.inner;
34506 if (ret_var.is_owned) {
34512 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
34513 LDKIgnoringMessageHandler this_arg_conv;
34514 this_arg_conv.inner = (void*)(this_arg & (~1));
34515 this_arg_conv.is_owned = false;
34516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34517 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34518 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34519 return (uint32_t)ret_ret;
34522 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
34523 LDKIgnoringMessageHandler this_arg_conv;
34524 this_arg_conv.inner = (void*)(this_arg & (~1));
34525 this_arg_conv.is_owned = false;
34526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34527 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
34528 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
34529 return (uint32_t)ret_ret;
34532 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
34533 LDKIgnoringMessageHandler this_arg_conv;
34534 this_arg_conv.inner = (void*)(this_arg & (~1));
34535 this_arg_conv.is_owned = false;
34536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34537 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
34538 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
34539 return (uint32_t)ret_ret;
34542 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
34543 LDKIgnoringMessageHandler this_arg_conv;
34544 this_arg_conv.inner = (void*)(this_arg & (~1));
34545 this_arg_conv.is_owned = false;
34546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34547 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
34548 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
34549 return (uint32_t)ret_ret;
34552 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
34553 LDKErroringMessageHandler this_obj_conv;
34554 this_obj_conv.inner = (void*)(this_obj & (~1));
34555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34557 ErroringMessageHandler_free(this_obj_conv);
34560 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
34561 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
34562 uint32_t ret_ref = 0;
34563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34566 ret_ref = (uintptr_t)ret_var.inner;
34567 if (ret_var.is_owned) {
34573 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
34574 LDKErroringMessageHandler this_arg_conv;
34575 this_arg_conv.inner = (void*)(this_arg & (~1));
34576 this_arg_conv.is_owned = false;
34577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34578 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34579 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34580 return (uint32_t)ret_ret;
34583 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
34584 LDKErroringMessageHandler this_arg_conv;
34585 this_arg_conv.inner = (void*)(this_arg & (~1));
34586 this_arg_conv.is_owned = false;
34587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34588 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
34589 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
34590 return (uint32_t)ret_ret;
34593 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
34594 LDKMessageHandler this_obj_conv;
34595 this_obj_conv.inner = (void*)(this_obj & (~1));
34596 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34598 MessageHandler_free(this_obj_conv);
34601 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
34602 LDKMessageHandler this_ptr_conv;
34603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34604 this_ptr_conv.is_owned = false;
34605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34606 // WARNING: This object doesn't live past this scope, needs clone!
34607 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
34611 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
34612 LDKMessageHandler this_ptr_conv;
34613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34614 this_ptr_conv.is_owned = false;
34615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34616 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34617 CHECK_ACCESS(val_ptr);
34618 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
34619 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
34620 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34621 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
34623 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
34626 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
34627 LDKMessageHandler 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 // WARNING: This object doesn't live past this scope, needs clone!
34632 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
34636 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
34637 LDKMessageHandler this_ptr_conv;
34638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34639 this_ptr_conv.is_owned = false;
34640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34641 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34642 CHECK_ACCESS(val_ptr);
34643 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
34644 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34645 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34646 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
34648 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
34651 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
34652 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
34653 CHECK_ACCESS(chan_handler_arg_ptr);
34654 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
34655 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
34656 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34657 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
34659 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
34660 CHECK_ACCESS(route_handler_arg_ptr);
34661 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
34662 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34663 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34664 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
34666 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
34667 uint32_t ret_ref = 0;
34668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34671 ret_ref = (uintptr_t)ret_var.inner;
34672 if (ret_var.is_owned) {
34678 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
34679 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34680 *ret_ret = SocketDescriptor_clone(arg);
34681 return (uint32_t)ret_ret;
34683 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
34684 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
34685 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
34686 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
34687 uint32_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
34691 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
34692 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
34693 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
34694 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
34695 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34696 *ret_ret = SocketDescriptor_clone(orig_conv);
34697 return (uint32_t)ret_ret;
34700 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
34701 if ((this_ptr & 1) != 0) return;
34702 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34703 CHECK_ACCESS(this_ptr_ptr);
34704 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
34705 FREE((void*)this_ptr);
34706 SocketDescriptor_free(this_ptr_conv);
34709 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
34710 LDKPeerHandleError this_obj_conv;
34711 this_obj_conv.inner = (void*)(this_obj & (~1));
34712 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34714 PeerHandleError_free(this_obj_conv);
34717 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
34718 LDKPeerHandleError this_ptr_conv;
34719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34720 this_ptr_conv.is_owned = false;
34721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34722 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
34726 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
34727 LDKPeerHandleError this_ptr_conv;
34728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34729 this_ptr_conv.is_owned = false;
34730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34731 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
34734 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
34735 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
34736 uint32_t ret_ref = 0;
34737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34740 ret_ref = (uintptr_t)ret_var.inner;
34741 if (ret_var.is_owned) {
34747 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
34748 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
34749 uint32_t ret_ref = 0;
34750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34753 ret_ref = (uintptr_t)ret_var.inner;
34754 if (ret_var.is_owned) {
34759 uint32_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
34760 LDKPeerHandleError arg_conv;
34761 arg_conv.inner = (void*)(arg & (~1));
34762 arg_conv.is_owned = false;
34763 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34764 uint32_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
34768 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
34769 LDKPeerHandleError orig_conv;
34770 orig_conv.inner = (void*)(orig & (~1));
34771 orig_conv.is_owned = false;
34772 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34773 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
34774 uint32_t ret_ref = 0;
34775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34778 ret_ref = (uintptr_t)ret_var.inner;
34779 if (ret_var.is_owned) {
34785 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
34786 LDKPeerManager this_obj_conv;
34787 this_obj_conv.inner = (void*)(this_obj & (~1));
34788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34790 PeerManager_free(this_obj_conv);
34793 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) {
34794 LDKMessageHandler message_handler_conv;
34795 message_handler_conv.inner = (void*)(message_handler & (~1));
34796 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
34797 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
34798 // WARNING: we need a move here but no clone is available for LDKMessageHandler
34799 LDKSecretKey our_node_secret_ref;
34800 CHECK(our_node_secret->arr_len == 32);
34801 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
34802 unsigned char ephemeral_random_data_arr[32];
34803 CHECK(ephemeral_random_data->arr_len == 32);
34804 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
34805 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
34806 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
34807 CHECK_ACCESS(logger_ptr);
34808 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34809 if (logger_conv.free == LDKLogger_JCalls_free) {
34810 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34811 LDKLogger_JCalls_cloned(&logger_conv);
34813 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
34814 CHECK_ACCESS(custom_message_handler_ptr);
34815 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
34816 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
34817 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34818 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
34820 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
34821 uint32_t ret_ref = 0;
34822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34825 ret_ref = (uintptr_t)ret_var.inner;
34826 if (ret_var.is_owned) {
34832 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
34833 LDKPeerManager this_arg_conv;
34834 this_arg_conv.inner = (void*)(this_arg & (~1));
34835 this_arg_conv.is_owned = false;
34836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34837 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
34838 ptrArray ret_arr = NULL;
34839 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
34840 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
34841 for (size_t m = 0; m < ret_var.datalen; m++) {
34842 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
34843 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
34844 ret_arr_ptr[m] = ret_conv_12_arr;
34847 FREE(ret_var.data);
34851 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) {
34852 LDKPeerManager this_arg_conv;
34853 this_arg_conv.inner = (void*)(this_arg & (~1));
34854 this_arg_conv.is_owned = false;
34855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34856 LDKPublicKey their_node_id_ref;
34857 CHECK(their_node_id->arr_len == 33);
34858 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
34859 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34860 CHECK_ACCESS(descriptor_ptr);
34861 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34862 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34863 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34864 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34866 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
34867 CHECK_ACCESS(remote_network_address_ptr);
34868 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34869 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
34870 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
34871 return (uint32_t)ret_conv;
34874 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) {
34875 LDKPeerManager this_arg_conv;
34876 this_arg_conv.inner = (void*)(this_arg & (~1));
34877 this_arg_conv.is_owned = false;
34878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34879 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34880 CHECK_ACCESS(descriptor_ptr);
34881 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34882 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34883 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34884 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34886 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
34887 CHECK_ACCESS(remote_network_address_ptr);
34888 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34889 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34890 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
34891 return (uint32_t)ret_conv;
34894 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
34895 LDKPeerManager this_arg_conv;
34896 this_arg_conv.inner = (void*)(this_arg & (~1));
34897 this_arg_conv.is_owned = false;
34898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34899 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34900 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
34901 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34902 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34903 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
34904 return (uint32_t)ret_conv;
34907 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
34908 LDKPeerManager this_arg_conv;
34909 this_arg_conv.inner = (void*)(this_arg & (~1));
34910 this_arg_conv.is_owned = false;
34911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34912 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
34913 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
34914 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
34915 LDKu8slice data_ref;
34916 data_ref.datalen = data->arr_len;
34917 data_ref.data = data->elems;
34918 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
34919 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
34921 return (uint32_t)ret_conv;
34924 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
34925 LDKPeerManager this_arg_conv;
34926 this_arg_conv.inner = (void*)(this_arg & (~1));
34927 this_arg_conv.is_owned = false;
34928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34929 PeerManager_process_events(&this_arg_conv);
34932 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
34933 LDKPeerManager this_arg_conv;
34934 this_arg_conv.inner = (void*)(this_arg & (~1));
34935 this_arg_conv.is_owned = false;
34936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34937 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34938 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
34939 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34940 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
34943 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) {
34944 LDKPeerManager this_arg_conv;
34945 this_arg_conv.inner = (void*)(this_arg & (~1));
34946 this_arg_conv.is_owned = false;
34947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34948 LDKPublicKey node_id_ref;
34949 CHECK(node_id->arr_len == 33);
34950 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
34951 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
34954 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
34955 LDKPeerManager this_arg_conv;
34956 this_arg_conv.inner = (void*)(this_arg & (~1));
34957 this_arg_conv.is_owned = false;
34958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34959 PeerManager_disconnect_all_peers(&this_arg_conv);
34962 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
34963 LDKPeerManager this_arg_conv;
34964 this_arg_conv.inner = (void*)(this_arg & (~1));
34965 this_arg_conv.is_owned = false;
34966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34967 PeerManager_timer_tick_occurred(&this_arg_conv);
34970 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
34971 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
34975 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
34976 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
34980 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
34981 unsigned char commitment_seed_arr[32];
34982 CHECK(commitment_seed->arr_len == 32);
34983 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
34984 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
34985 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34986 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
34990 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) {
34991 LDKCVec_u8Z to_holder_script_ref;
34992 to_holder_script_ref.datalen = to_holder_script->arr_len;
34993 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
34994 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
34995 LDKCVec_u8Z to_counterparty_script_ref;
34996 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
34997 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
34998 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
34999 LDKOutPoint funding_outpoint_conv;
35000 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35001 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35002 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35003 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35004 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);
35005 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35006 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35007 Transaction_free(ret_var);
35011 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
35012 LDKCounterpartyCommitmentSecrets this_obj_conv;
35013 this_obj_conv.inner = (void*)(this_obj & (~1));
35014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35016 CounterpartyCommitmentSecrets_free(this_obj_conv);
35019 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
35020 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
35021 uint32_t ret_ref = 0;
35022 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35023 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35025 ret_ref = (uintptr_t)ret_var.inner;
35026 if (ret_var.is_owned) {
35031 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
35032 LDKCounterpartyCommitmentSecrets arg_conv;
35033 arg_conv.inner = (void*)(arg & (~1));
35034 arg_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35036 uint32_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
35040 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
35041 LDKCounterpartyCommitmentSecrets orig_conv;
35042 orig_conv.inner = (void*)(orig & (~1));
35043 orig_conv.is_owned = false;
35044 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35045 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
35046 uint32_t ret_ref = 0;
35047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35050 ret_ref = (uintptr_t)ret_var.inner;
35051 if (ret_var.is_owned) {
35057 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
35058 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
35059 uint32_t ret_ref = 0;
35060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35063 ret_ref = (uintptr_t)ret_var.inner;
35064 if (ret_var.is_owned) {
35070 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
35071 LDKCounterpartyCommitmentSecrets this_arg_conv;
35072 this_arg_conv.inner = (void*)(this_arg & (~1));
35073 this_arg_conv.is_owned = false;
35074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35075 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
35079 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
35080 LDKCounterpartyCommitmentSecrets this_arg_conv;
35081 this_arg_conv.inner = (void*)(this_arg & (~1));
35082 this_arg_conv.is_owned = false;
35083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35084 LDKThirtyTwoBytes secret_ref;
35085 CHECK(secret->arr_len == 32);
35086 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
35087 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35088 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
35089 return (uint32_t)ret_conv;
35092 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
35093 LDKCounterpartyCommitmentSecrets this_arg_conv;
35094 this_arg_conv.inner = (void*)(this_arg & (~1));
35095 this_arg_conv.is_owned = false;
35096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35097 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35098 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
35102 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
35103 LDKCounterpartyCommitmentSecrets obj_conv;
35104 obj_conv.inner = (void*)(obj & (~1));
35105 obj_conv.is_owned = false;
35106 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35107 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
35108 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35109 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35110 CVec_u8Z_free(ret_var);
35114 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
35115 LDKu8slice ser_ref;
35116 ser_ref.datalen = ser->arr_len;
35117 ser_ref.data = ser->elems;
35118 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
35119 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
35121 return (uint32_t)ret_conv;
35124 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
35125 LDKPublicKey per_commitment_point_ref;
35126 CHECK(per_commitment_point->arr_len == 33);
35127 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35128 unsigned char base_secret_arr[32];
35129 CHECK(base_secret->arr_len == 32);
35130 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
35131 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
35132 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35133 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
35134 return (uint32_t)ret_conv;
35137 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
35138 LDKPublicKey per_commitment_point_ref;
35139 CHECK(per_commitment_point->arr_len == 33);
35140 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35141 LDKPublicKey base_point_ref;
35142 CHECK(base_point->arr_len == 33);
35143 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
35144 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35145 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
35146 return (uint32_t)ret_conv;
35149 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) {
35150 unsigned char per_commitment_secret_arr[32];
35151 CHECK(per_commitment_secret->arr_len == 32);
35152 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
35153 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
35154 unsigned char countersignatory_revocation_base_secret_arr[32];
35155 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
35156 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
35157 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
35158 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35159 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
35160 return (uint32_t)ret_conv;
35163 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) {
35164 LDKPublicKey per_commitment_point_ref;
35165 CHECK(per_commitment_point->arr_len == 33);
35166 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35167 LDKPublicKey countersignatory_revocation_base_point_ref;
35168 CHECK(countersignatory_revocation_base_point->arr_len == 33);
35169 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
35170 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35171 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
35172 return (uint32_t)ret_conv;
35175 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
35176 LDKTxCreationKeys this_obj_conv;
35177 this_obj_conv.inner = (void*)(this_obj & (~1));
35178 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35180 TxCreationKeys_free(this_obj_conv);
35183 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
35184 LDKTxCreationKeys this_ptr_conv;
35185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35186 this_ptr_conv.is_owned = false;
35187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35188 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35189 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35193 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
35194 LDKTxCreationKeys this_ptr_conv;
35195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35196 this_ptr_conv.is_owned = false;
35197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35198 LDKPublicKey val_ref;
35199 CHECK(val->arr_len == 33);
35200 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35201 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
35204 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
35205 LDKTxCreationKeys this_ptr_conv;
35206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35207 this_ptr_conv.is_owned = false;
35208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35209 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35210 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
35214 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
35215 LDKTxCreationKeys this_ptr_conv;
35216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35217 this_ptr_conv.is_owned = false;
35218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35219 LDKPublicKey val_ref;
35220 CHECK(val->arr_len == 33);
35221 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35222 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
35225 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
35226 LDKTxCreationKeys this_ptr_conv;
35227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35228 this_ptr_conv.is_owned = false;
35229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35230 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35231 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
35235 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
35236 LDKTxCreationKeys this_ptr_conv;
35237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35238 this_ptr_conv.is_owned = false;
35239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35240 LDKPublicKey val_ref;
35241 CHECK(val->arr_len == 33);
35242 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35243 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
35246 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
35247 LDKTxCreationKeys this_ptr_conv;
35248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35249 this_ptr_conv.is_owned = false;
35250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35251 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35252 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
35256 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
35257 LDKTxCreationKeys this_ptr_conv;
35258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35259 this_ptr_conv.is_owned = false;
35260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35261 LDKPublicKey val_ref;
35262 CHECK(val->arr_len == 33);
35263 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35264 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
35267 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
35268 LDKTxCreationKeys this_ptr_conv;
35269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35270 this_ptr_conv.is_owned = false;
35271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35272 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35273 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
35277 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) {
35278 LDKTxCreationKeys this_ptr_conv;
35279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35280 this_ptr_conv.is_owned = false;
35281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35282 LDKPublicKey val_ref;
35283 CHECK(val->arr_len == 33);
35284 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35285 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
35288 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) {
35289 LDKPublicKey per_commitment_point_arg_ref;
35290 CHECK(per_commitment_point_arg->arr_len == 33);
35291 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
35292 LDKPublicKey revocation_key_arg_ref;
35293 CHECK(revocation_key_arg->arr_len == 33);
35294 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
35295 LDKPublicKey broadcaster_htlc_key_arg_ref;
35296 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
35297 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
35298 LDKPublicKey countersignatory_htlc_key_arg_ref;
35299 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
35300 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
35301 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
35302 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
35303 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
35304 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);
35305 uint32_t ret_ref = 0;
35306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35309 ret_ref = (uintptr_t)ret_var.inner;
35310 if (ret_var.is_owned) {
35316 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
35317 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
35318 uint32_t ret_ref = 0;
35319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35322 ret_ref = (uintptr_t)ret_var.inner;
35323 if (ret_var.is_owned) {
35328 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
35329 LDKTxCreationKeys arg_conv;
35330 arg_conv.inner = (void*)(arg & (~1));
35331 arg_conv.is_owned = false;
35332 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35333 uint32_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
35337 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
35338 LDKTxCreationKeys orig_conv;
35339 orig_conv.inner = (void*)(orig & (~1));
35340 orig_conv.is_owned = false;
35341 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35342 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
35343 uint32_t ret_ref = 0;
35344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35347 ret_ref = (uintptr_t)ret_var.inner;
35348 if (ret_var.is_owned) {
35354 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
35355 LDKTxCreationKeys obj_conv;
35356 obj_conv.inner = (void*)(obj & (~1));
35357 obj_conv.is_owned = false;
35358 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35359 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
35360 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35361 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35362 CVec_u8Z_free(ret_var);
35366 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
35367 LDKu8slice ser_ref;
35368 ser_ref.datalen = ser->arr_len;
35369 ser_ref.data = ser->elems;
35370 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
35371 *ret_conv = TxCreationKeys_read(ser_ref);
35373 return (uint32_t)ret_conv;
35376 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
35377 LDKChannelPublicKeys this_obj_conv;
35378 this_obj_conv.inner = (void*)(this_obj & (~1));
35379 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35381 ChannelPublicKeys_free(this_obj_conv);
35384 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
35385 LDKChannelPublicKeys this_ptr_conv;
35386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35387 this_ptr_conv.is_owned = false;
35388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35389 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35390 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35394 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
35395 LDKChannelPublicKeys this_ptr_conv;
35396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35397 this_ptr_conv.is_owned = false;
35398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35399 LDKPublicKey val_ref;
35400 CHECK(val->arr_len == 33);
35401 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35402 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
35405 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
35406 LDKChannelPublicKeys this_ptr_conv;
35407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35408 this_ptr_conv.is_owned = false;
35409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35410 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35411 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35415 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
35416 LDKChannelPublicKeys this_ptr_conv;
35417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35418 this_ptr_conv.is_owned = false;
35419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35420 LDKPublicKey val_ref;
35421 CHECK(val->arr_len == 33);
35422 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35423 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
35426 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
35427 LDKChannelPublicKeys this_ptr_conv;
35428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35429 this_ptr_conv.is_owned = false;
35430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35431 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35432 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
35436 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
35437 LDKChannelPublicKeys this_ptr_conv;
35438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35439 this_ptr_conv.is_owned = false;
35440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35441 LDKPublicKey val_ref;
35442 CHECK(val->arr_len == 33);
35443 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35444 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
35447 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
35448 LDKChannelPublicKeys this_ptr_conv;
35449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35450 this_ptr_conv.is_owned = false;
35451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35452 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35453 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35457 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
35458 LDKChannelPublicKeys this_ptr_conv;
35459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35460 this_ptr_conv.is_owned = false;
35461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35462 LDKPublicKey val_ref;
35463 CHECK(val->arr_len == 33);
35464 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35465 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35468 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
35469 LDKChannelPublicKeys this_ptr_conv;
35470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35471 this_ptr_conv.is_owned = false;
35472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35473 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35474 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35478 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
35479 LDKChannelPublicKeys this_ptr_conv;
35480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35481 this_ptr_conv.is_owned = false;
35482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35483 LDKPublicKey val_ref;
35484 CHECK(val->arr_len == 33);
35485 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35486 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
35489 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) {
35490 LDKPublicKey funding_pubkey_arg_ref;
35491 CHECK(funding_pubkey_arg->arr_len == 33);
35492 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35493 LDKPublicKey revocation_basepoint_arg_ref;
35494 CHECK(revocation_basepoint_arg->arr_len == 33);
35495 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35496 LDKPublicKey payment_point_arg_ref;
35497 CHECK(payment_point_arg->arr_len == 33);
35498 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
35499 LDKPublicKey delayed_payment_basepoint_arg_ref;
35500 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35501 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35502 LDKPublicKey htlc_basepoint_arg_ref;
35503 CHECK(htlc_basepoint_arg->arr_len == 33);
35504 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35505 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);
35506 uint32_t ret_ref = 0;
35507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35510 ret_ref = (uintptr_t)ret_var.inner;
35511 if (ret_var.is_owned) {
35517 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
35518 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
35519 uint32_t ret_ref = 0;
35520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35523 ret_ref = (uintptr_t)ret_var.inner;
35524 if (ret_var.is_owned) {
35529 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
35530 LDKChannelPublicKeys arg_conv;
35531 arg_conv.inner = (void*)(arg & (~1));
35532 arg_conv.is_owned = false;
35533 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35534 uint32_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
35538 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
35539 LDKChannelPublicKeys orig_conv;
35540 orig_conv.inner = (void*)(orig & (~1));
35541 orig_conv.is_owned = false;
35542 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35543 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
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 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
35556 LDKChannelPublicKeys obj_conv;
35557 obj_conv.inner = (void*)(obj & (~1));
35558 obj_conv.is_owned = false;
35559 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35560 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
35561 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35562 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35563 CVec_u8Z_free(ret_var);
35567 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
35568 LDKu8slice ser_ref;
35569 ser_ref.datalen = ser->arr_len;
35570 ser_ref.data = ser->elems;
35571 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
35572 *ret_conv = ChannelPublicKeys_read(ser_ref);
35574 return (uint32_t)ret_conv;
35577 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) {
35578 LDKPublicKey per_commitment_point_ref;
35579 CHECK(per_commitment_point->arr_len == 33);
35580 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35581 LDKPublicKey broadcaster_delayed_payment_base_ref;
35582 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
35583 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
35584 LDKPublicKey broadcaster_htlc_base_ref;
35585 CHECK(broadcaster_htlc_base->arr_len == 33);
35586 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
35587 LDKPublicKey countersignatory_revocation_base_ref;
35588 CHECK(countersignatory_revocation_base->arr_len == 33);
35589 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
35590 LDKPublicKey countersignatory_htlc_base_ref;
35591 CHECK(countersignatory_htlc_base->arr_len == 33);
35592 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
35593 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35594 *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);
35595 return (uint32_t)ret_conv;
35598 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) {
35599 LDKPublicKey per_commitment_point_ref;
35600 CHECK(per_commitment_point->arr_len == 33);
35601 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35602 LDKChannelPublicKeys broadcaster_keys_conv;
35603 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
35604 broadcaster_keys_conv.is_owned = false;
35605 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35606 LDKChannelPublicKeys countersignatory_keys_conv;
35607 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
35608 countersignatory_keys_conv.is_owned = false;
35609 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35610 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35611 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
35612 return (uint32_t)ret_conv;
35615 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) {
35616 LDKPublicKey revocation_key_ref;
35617 CHECK(revocation_key->arr_len == 33);
35618 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35619 LDKPublicKey broadcaster_delayed_payment_key_ref;
35620 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35621 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35622 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
35623 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35624 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35625 CVec_u8Z_free(ret_var);
35629 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
35630 LDKHTLCOutputInCommitment this_obj_conv;
35631 this_obj_conv.inner = (void*)(this_obj & (~1));
35632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35634 HTLCOutputInCommitment_free(this_obj_conv);
35637 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
35638 LDKHTLCOutputInCommitment this_ptr_conv;
35639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35640 this_ptr_conv.is_owned = false;
35641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35642 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
35646 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
35647 LDKHTLCOutputInCommitment this_ptr_conv;
35648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35649 this_ptr_conv.is_owned = false;
35650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35651 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
35654 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
35655 LDKHTLCOutputInCommitment this_ptr_conv;
35656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35657 this_ptr_conv.is_owned = false;
35658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35659 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
35663 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
35664 LDKHTLCOutputInCommitment this_ptr_conv;
35665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35666 this_ptr_conv.is_owned = false;
35667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35668 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
35671 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
35672 LDKHTLCOutputInCommitment this_ptr_conv;
35673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35674 this_ptr_conv.is_owned = false;
35675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35676 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
35680 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
35681 LDKHTLCOutputInCommitment this_ptr_conv;
35682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35683 this_ptr_conv.is_owned = false;
35684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35685 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
35688 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
35689 LDKHTLCOutputInCommitment this_ptr_conv;
35690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35691 this_ptr_conv.is_owned = false;
35692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35693 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35694 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
35698 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
35699 LDKHTLCOutputInCommitment this_ptr_conv;
35700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35701 this_ptr_conv.is_owned = false;
35702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35703 LDKThirtyTwoBytes val_ref;
35704 CHECK(val->arr_len == 32);
35705 memcpy(val_ref.data, val->elems, 32); FREE(val);
35706 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
35709 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
35710 LDKHTLCOutputInCommitment this_ptr_conv;
35711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35712 this_ptr_conv.is_owned = false;
35713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35714 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
35715 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
35716 uint32_t ret_ref = (uintptr_t)ret_copy;
35720 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
35721 LDKHTLCOutputInCommitment this_ptr_conv;
35722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35723 this_ptr_conv.is_owned = false;
35724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35725 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35726 CHECK_ACCESS(val_ptr);
35727 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
35728 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
35729 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
35732 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) {
35733 LDKThirtyTwoBytes payment_hash_arg_ref;
35734 CHECK(payment_hash_arg->arr_len == 32);
35735 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
35736 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
35737 CHECK_ACCESS(transaction_output_index_arg_ptr);
35738 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
35739 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
35740 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
35741 uint32_t ret_ref = 0;
35742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35745 ret_ref = (uintptr_t)ret_var.inner;
35746 if (ret_var.is_owned) {
35752 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
35753 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
35754 uint32_t ret_ref = 0;
35755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35758 ret_ref = (uintptr_t)ret_var.inner;
35759 if (ret_var.is_owned) {
35764 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
35765 LDKHTLCOutputInCommitment arg_conv;
35766 arg_conv.inner = (void*)(arg & (~1));
35767 arg_conv.is_owned = false;
35768 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35769 uint32_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
35773 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
35774 LDKHTLCOutputInCommitment orig_conv;
35775 orig_conv.inner = (void*)(orig & (~1));
35776 orig_conv.is_owned = false;
35777 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35778 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
35779 uint32_t ret_ref = 0;
35780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35783 ret_ref = (uintptr_t)ret_var.inner;
35784 if (ret_var.is_owned) {
35790 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
35791 LDKHTLCOutputInCommitment obj_conv;
35792 obj_conv.inner = (void*)(obj & (~1));
35793 obj_conv.is_owned = false;
35794 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35795 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
35796 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35797 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35798 CVec_u8Z_free(ret_var);
35802 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
35803 LDKu8slice ser_ref;
35804 ser_ref.datalen = ser->arr_len;
35805 ser_ref.data = ser->elems;
35806 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
35807 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
35809 return (uint32_t)ret_conv;
35812 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
35813 LDKHTLCOutputInCommitment htlc_conv;
35814 htlc_conv.inner = (void*)(htlc & (~1));
35815 htlc_conv.is_owned = false;
35816 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35817 LDKTxCreationKeys keys_conv;
35818 keys_conv.inner = (void*)(keys & (~1));
35819 keys_conv.is_owned = false;
35820 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
35821 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
35822 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35823 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35824 CVec_u8Z_free(ret_var);
35828 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
35829 LDKPublicKey broadcaster_ref;
35830 CHECK(broadcaster->arr_len == 33);
35831 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
35832 LDKPublicKey countersignatory_ref;
35833 CHECK(countersignatory->arr_len == 33);
35834 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
35835 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
35836 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35837 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35838 CVec_u8Z_free(ret_var);
35842 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) {
35843 unsigned char commitment_txid_arr[32];
35844 CHECK(commitment_txid->arr_len == 32);
35845 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
35846 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
35847 LDKHTLCOutputInCommitment htlc_conv;
35848 htlc_conv.inner = (void*)(htlc & (~1));
35849 htlc_conv.is_owned = false;
35850 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35851 LDKPublicKey broadcaster_delayed_payment_key_ref;
35852 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35853 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35854 LDKPublicKey revocation_key_ref;
35855 CHECK(revocation_key->arr_len == 33);
35856 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35857 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);
35858 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35859 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35860 Transaction_free(ret_var);
35864 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
35865 LDKPublicKey funding_pubkey_ref;
35866 CHECK(funding_pubkey->arr_len == 33);
35867 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
35868 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
35869 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35870 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35871 CVec_u8Z_free(ret_var);
35875 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
35876 LDKChannelTransactionParameters this_obj_conv;
35877 this_obj_conv.inner = (void*)(this_obj & (~1));
35878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35880 ChannelTransactionParameters_free(this_obj_conv);
35883 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
35884 LDKChannelTransactionParameters this_ptr_conv;
35885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35886 this_ptr_conv.is_owned = false;
35887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35888 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
35889 uint32_t ret_ref = 0;
35890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35893 ret_ref = (uintptr_t)ret_var.inner;
35894 if (ret_var.is_owned) {
35900 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
35901 LDKChannelTransactionParameters this_ptr_conv;
35902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35903 this_ptr_conv.is_owned = false;
35904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35905 LDKChannelPublicKeys val_conv;
35906 val_conv.inner = (void*)(val & (~1));
35907 val_conv.is_owned = (val & 1) || (val == 0);
35908 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35909 val_conv = ChannelPublicKeys_clone(&val_conv);
35910 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
35913 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
35914 LDKChannelTransactionParameters this_ptr_conv;
35915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35916 this_ptr_conv.is_owned = false;
35917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35918 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
35922 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) {
35923 LDKChannelTransactionParameters this_ptr_conv;
35924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35925 this_ptr_conv.is_owned = false;
35926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35927 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
35930 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
35931 LDKChannelTransactionParameters this_ptr_conv;
35932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35933 this_ptr_conv.is_owned = false;
35934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35935 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
35939 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
35940 LDKChannelTransactionParameters this_ptr_conv;
35941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35942 this_ptr_conv.is_owned = false;
35943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35944 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
35947 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
35948 LDKChannelTransactionParameters this_ptr_conv;
35949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35950 this_ptr_conv.is_owned = false;
35951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35952 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
35953 uint32_t ret_ref = 0;
35954 if ((uintptr_t)ret_var.inner > 4096) {
35955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35958 ret_ref = (uintptr_t)ret_var.inner;
35959 if (ret_var.is_owned) {
35966 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
35967 LDKChannelTransactionParameters this_ptr_conv;
35968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35969 this_ptr_conv.is_owned = false;
35970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35971 LDKCounterpartyChannelTransactionParameters val_conv;
35972 val_conv.inner = (void*)(val & (~1));
35973 val_conv.is_owned = (val & 1) || (val == 0);
35974 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35975 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
35976 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
35979 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
35980 LDKChannelTransactionParameters this_ptr_conv;
35981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35982 this_ptr_conv.is_owned = false;
35983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35984 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
35985 uint32_t ret_ref = 0;
35986 if ((uintptr_t)ret_var.inner > 4096) {
35987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35990 ret_ref = (uintptr_t)ret_var.inner;
35991 if (ret_var.is_owned) {
35998 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
35999 LDKChannelTransactionParameters this_ptr_conv;
36000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36001 this_ptr_conv.is_owned = false;
36002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36003 LDKOutPoint val_conv;
36004 val_conv.inner = (void*)(val & (~1));
36005 val_conv.is_owned = (val & 1) || (val == 0);
36006 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36007 val_conv = OutPoint_clone(&val_conv);
36008 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
36011 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
36012 LDKChannelTransactionParameters this_ptr_conv;
36013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36014 this_ptr_conv.is_owned = false;
36015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36016 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
36020 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
36021 LDKChannelTransactionParameters this_ptr_conv;
36022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36023 this_ptr_conv.is_owned = false;
36024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36025 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
36026 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
36029 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) {
36030 LDKChannelPublicKeys holder_pubkeys_arg_conv;
36031 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
36032 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
36033 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
36034 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
36035 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
36036 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
36037 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
36038 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
36039 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
36040 LDKOutPoint funding_outpoint_arg_conv;
36041 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
36042 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
36043 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
36044 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
36045 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
36046 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);
36047 uint32_t ret_ref = 0;
36048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36051 ret_ref = (uintptr_t)ret_var.inner;
36052 if (ret_var.is_owned) {
36058 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
36059 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
36060 uint32_t ret_ref = 0;
36061 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36062 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36064 ret_ref = (uintptr_t)ret_var.inner;
36065 if (ret_var.is_owned) {
36070 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
36071 LDKChannelTransactionParameters arg_conv;
36072 arg_conv.inner = (void*)(arg & (~1));
36073 arg_conv.is_owned = false;
36074 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36075 uint32_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
36079 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
36080 LDKChannelTransactionParameters orig_conv;
36081 orig_conv.inner = (void*)(orig & (~1));
36082 orig_conv.is_owned = false;
36083 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36084 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
36085 uint32_t ret_ref = 0;
36086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36089 ret_ref = (uintptr_t)ret_var.inner;
36090 if (ret_var.is_owned) {
36096 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
36097 LDKCounterpartyChannelTransactionParameters this_obj_conv;
36098 this_obj_conv.inner = (void*)(this_obj & (~1));
36099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36101 CounterpartyChannelTransactionParameters_free(this_obj_conv);
36104 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
36105 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36107 this_ptr_conv.is_owned = false;
36108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36109 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
36110 uint32_t ret_ref = 0;
36111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36114 ret_ref = (uintptr_t)ret_var.inner;
36115 if (ret_var.is_owned) {
36121 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
36122 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36124 this_ptr_conv.is_owned = false;
36125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36126 LDKChannelPublicKeys val_conv;
36127 val_conv.inner = (void*)(val & (~1));
36128 val_conv.is_owned = (val & 1) || (val == 0);
36129 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36130 val_conv = ChannelPublicKeys_clone(&val_conv);
36131 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
36134 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
36135 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36137 this_ptr_conv.is_owned = false;
36138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36139 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
36143 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
36144 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36146 this_ptr_conv.is_owned = false;
36147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36148 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
36151 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
36152 LDKChannelPublicKeys pubkeys_arg_conv;
36153 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
36154 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
36155 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
36156 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
36157 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
36158 uint32_t ret_ref = 0;
36159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36162 ret_ref = (uintptr_t)ret_var.inner;
36163 if (ret_var.is_owned) {
36169 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
36170 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
36171 uint32_t ret_ref = 0;
36172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36175 ret_ref = (uintptr_t)ret_var.inner;
36176 if (ret_var.is_owned) {
36181 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
36182 LDKCounterpartyChannelTransactionParameters arg_conv;
36183 arg_conv.inner = (void*)(arg & (~1));
36184 arg_conv.is_owned = false;
36185 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36186 uint32_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
36190 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
36191 LDKCounterpartyChannelTransactionParameters orig_conv;
36192 orig_conv.inner = (void*)(orig & (~1));
36193 orig_conv.is_owned = false;
36194 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36195 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
36196 uint32_t ret_ref = 0;
36197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36200 ret_ref = (uintptr_t)ret_var.inner;
36201 if (ret_var.is_owned) {
36207 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
36208 LDKChannelTransactionParameters this_arg_conv;
36209 this_arg_conv.inner = (void*)(this_arg & (~1));
36210 this_arg_conv.is_owned = false;
36211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36212 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
36216 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
36217 LDKChannelTransactionParameters this_arg_conv;
36218 this_arg_conv.inner = (void*)(this_arg & (~1));
36219 this_arg_conv.is_owned = false;
36220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36221 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
36222 uint32_t ret_ref = 0;
36223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36226 ret_ref = (uintptr_t)ret_var.inner;
36227 if (ret_var.is_owned) {
36233 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
36234 LDKChannelTransactionParameters this_arg_conv;
36235 this_arg_conv.inner = (void*)(this_arg & (~1));
36236 this_arg_conv.is_owned = false;
36237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36238 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
36239 uint32_t ret_ref = 0;
36240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36243 ret_ref = (uintptr_t)ret_var.inner;
36244 if (ret_var.is_owned) {
36250 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
36251 LDKCounterpartyChannelTransactionParameters obj_conv;
36252 obj_conv.inner = (void*)(obj & (~1));
36253 obj_conv.is_owned = false;
36254 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36255 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
36256 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36257 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36258 CVec_u8Z_free(ret_var);
36262 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
36263 LDKu8slice ser_ref;
36264 ser_ref.datalen = ser->arr_len;
36265 ser_ref.data = ser->elems;
36266 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36267 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
36269 return (uint32_t)ret_conv;
36272 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
36273 LDKChannelTransactionParameters obj_conv;
36274 obj_conv.inner = (void*)(obj & (~1));
36275 obj_conv.is_owned = false;
36276 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36277 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
36278 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36279 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36280 CVec_u8Z_free(ret_var);
36284 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
36285 LDKu8slice ser_ref;
36286 ser_ref.datalen = ser->arr_len;
36287 ser_ref.data = ser->elems;
36288 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36289 *ret_conv = ChannelTransactionParameters_read(ser_ref);
36291 return (uint32_t)ret_conv;
36294 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
36295 LDKDirectedChannelTransactionParameters this_obj_conv;
36296 this_obj_conv.inner = (void*)(this_obj & (~1));
36297 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36299 DirectedChannelTransactionParameters_free(this_obj_conv);
36302 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
36303 LDKDirectedChannelTransactionParameters this_arg_conv;
36304 this_arg_conv.inner = (void*)(this_arg & (~1));
36305 this_arg_conv.is_owned = false;
36306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36307 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
36308 uint32_t ret_ref = 0;
36309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36312 ret_ref = (uintptr_t)ret_var.inner;
36313 if (ret_var.is_owned) {
36319 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
36320 LDKDirectedChannelTransactionParameters this_arg_conv;
36321 this_arg_conv.inner = (void*)(this_arg & (~1));
36322 this_arg_conv.is_owned = false;
36323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36324 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
36325 uint32_t ret_ref = 0;
36326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36329 ret_ref = (uintptr_t)ret_var.inner;
36330 if (ret_var.is_owned) {
36336 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
36337 LDKDirectedChannelTransactionParameters this_arg_conv;
36338 this_arg_conv.inner = (void*)(this_arg & (~1));
36339 this_arg_conv.is_owned = false;
36340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36341 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
36345 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
36346 LDKDirectedChannelTransactionParameters this_arg_conv;
36347 this_arg_conv.inner = (void*)(this_arg & (~1));
36348 this_arg_conv.is_owned = false;
36349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36350 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
36354 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
36355 LDKDirectedChannelTransactionParameters this_arg_conv;
36356 this_arg_conv.inner = (void*)(this_arg & (~1));
36357 this_arg_conv.is_owned = false;
36358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36359 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
36360 uint32_t ret_ref = 0;
36361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36364 ret_ref = (uintptr_t)ret_var.inner;
36365 if (ret_var.is_owned) {
36371 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
36372 LDKDirectedChannelTransactionParameters this_arg_conv;
36373 this_arg_conv.inner = (void*)(this_arg & (~1));
36374 this_arg_conv.is_owned = false;
36375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36376 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
36380 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
36381 LDKHolderCommitmentTransaction this_obj_conv;
36382 this_obj_conv.inner = (void*)(this_obj & (~1));
36383 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36385 HolderCommitmentTransaction_free(this_obj_conv);
36388 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
36389 LDKHolderCommitmentTransaction this_ptr_conv;
36390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36391 this_ptr_conv.is_owned = false;
36392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36393 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36394 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
36398 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
36399 LDKHolderCommitmentTransaction this_ptr_conv;
36400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36401 this_ptr_conv.is_owned = false;
36402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36403 LDKSignature val_ref;
36404 CHECK(val->arr_len == 64);
36405 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
36406 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
36409 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
36410 LDKHolderCommitmentTransaction this_ptr_conv;
36411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36412 this_ptr_conv.is_owned = false;
36413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36414 LDKCVec_SignatureZ val_constr;
36415 val_constr.datalen = val->arr_len;
36416 if (val_constr.datalen > 0)
36417 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36419 val_constr.data = NULL;
36420 int8_tArray* val_vals = (void*) val->elems;
36421 for (size_t m = 0; m < val_constr.datalen; m++) {
36422 int8_tArray val_conv_12 = val_vals[m];
36423 LDKSignature val_conv_12_ref;
36424 CHECK(val_conv_12->arr_len == 64);
36425 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
36426 val_constr.data[m] = val_conv_12_ref;
36429 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
36432 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
36433 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
36434 uint32_t ret_ref = 0;
36435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36438 ret_ref = (uintptr_t)ret_var.inner;
36439 if (ret_var.is_owned) {
36444 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
36445 LDKHolderCommitmentTransaction arg_conv;
36446 arg_conv.inner = (void*)(arg & (~1));
36447 arg_conv.is_owned = false;
36448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36449 uint32_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
36453 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
36454 LDKHolderCommitmentTransaction orig_conv;
36455 orig_conv.inner = (void*)(orig & (~1));
36456 orig_conv.is_owned = false;
36457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36458 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
36459 uint32_t ret_ref = 0;
36460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36463 ret_ref = (uintptr_t)ret_var.inner;
36464 if (ret_var.is_owned) {
36470 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
36471 LDKHolderCommitmentTransaction obj_conv;
36472 obj_conv.inner = (void*)(obj & (~1));
36473 obj_conv.is_owned = false;
36474 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36475 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
36476 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36477 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36478 CVec_u8Z_free(ret_var);
36482 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
36483 LDKu8slice ser_ref;
36484 ser_ref.datalen = ser->arr_len;
36485 ser_ref.data = ser->elems;
36486 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36487 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
36489 return (uint32_t)ret_conv;
36492 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) {
36493 LDKCommitmentTransaction commitment_tx_conv;
36494 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
36495 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
36496 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
36497 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
36498 LDKSignature counterparty_sig_ref;
36499 CHECK(counterparty_sig->arr_len == 64);
36500 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
36501 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
36502 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
36503 if (counterparty_htlc_sigs_constr.datalen > 0)
36504 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36506 counterparty_htlc_sigs_constr.data = NULL;
36507 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
36508 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
36509 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
36510 LDKSignature counterparty_htlc_sigs_conv_12_ref;
36511 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
36512 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
36513 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
36515 FREE(counterparty_htlc_sigs);
36516 LDKPublicKey holder_funding_key_ref;
36517 CHECK(holder_funding_key->arr_len == 33);
36518 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
36519 LDKPublicKey counterparty_funding_key_ref;
36520 CHECK(counterparty_funding_key->arr_len == 33);
36521 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
36522 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
36523 uint32_t ret_ref = 0;
36524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36527 ret_ref = (uintptr_t)ret_var.inner;
36528 if (ret_var.is_owned) {
36534 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
36535 LDKBuiltCommitmentTransaction this_obj_conv;
36536 this_obj_conv.inner = (void*)(this_obj & (~1));
36537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36539 BuiltCommitmentTransaction_free(this_obj_conv);
36542 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
36543 LDKBuiltCommitmentTransaction this_ptr_conv;
36544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36545 this_ptr_conv.is_owned = false;
36546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36547 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
36548 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36549 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36550 Transaction_free(ret_var);
36554 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
36555 LDKBuiltCommitmentTransaction this_ptr_conv;
36556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36557 this_ptr_conv.is_owned = false;
36558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36559 LDKTransaction val_ref;
36560 val_ref.datalen = val->arr_len;
36561 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
36562 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
36563 val_ref.data_is_owned = true;
36564 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
36567 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
36568 LDKBuiltCommitmentTransaction this_ptr_conv;
36569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36570 this_ptr_conv.is_owned = false;
36571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36572 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36573 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
36577 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
36578 LDKBuiltCommitmentTransaction this_ptr_conv;
36579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36580 this_ptr_conv.is_owned = false;
36581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36582 LDKThirtyTwoBytes val_ref;
36583 CHECK(val->arr_len == 32);
36584 memcpy(val_ref.data, val->elems, 32); FREE(val);
36585 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
36588 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
36589 LDKTransaction transaction_arg_ref;
36590 transaction_arg_ref.datalen = transaction_arg->arr_len;
36591 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
36592 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
36593 transaction_arg_ref.data_is_owned = true;
36594 LDKThirtyTwoBytes txid_arg_ref;
36595 CHECK(txid_arg->arr_len == 32);
36596 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
36597 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
36598 uint32_t ret_ref = 0;
36599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36602 ret_ref = (uintptr_t)ret_var.inner;
36603 if (ret_var.is_owned) {
36609 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
36610 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
36611 uint32_t ret_ref = 0;
36612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36615 ret_ref = (uintptr_t)ret_var.inner;
36616 if (ret_var.is_owned) {
36621 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
36622 LDKBuiltCommitmentTransaction arg_conv;
36623 arg_conv.inner = (void*)(arg & (~1));
36624 arg_conv.is_owned = false;
36625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36626 uint32_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
36630 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
36631 LDKBuiltCommitmentTransaction orig_conv;
36632 orig_conv.inner = (void*)(orig & (~1));
36633 orig_conv.is_owned = false;
36634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36635 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
36636 uint32_t ret_ref = 0;
36637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36640 ret_ref = (uintptr_t)ret_var.inner;
36641 if (ret_var.is_owned) {
36647 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
36648 LDKBuiltCommitmentTransaction obj_conv;
36649 obj_conv.inner = (void*)(obj & (~1));
36650 obj_conv.is_owned = false;
36651 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36652 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
36653 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36654 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36655 CVec_u8Z_free(ret_var);
36659 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
36660 LDKu8slice ser_ref;
36661 ser_ref.datalen = ser->arr_len;
36662 ser_ref.data = ser->elems;
36663 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36664 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
36666 return (uint32_t)ret_conv;
36669 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) {
36670 LDKBuiltCommitmentTransaction this_arg_conv;
36671 this_arg_conv.inner = (void*)(this_arg & (~1));
36672 this_arg_conv.is_owned = false;
36673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36674 LDKu8slice funding_redeemscript_ref;
36675 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36676 funding_redeemscript_ref.data = funding_redeemscript->elems;
36677 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36678 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36679 FREE(funding_redeemscript);
36683 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) {
36684 LDKBuiltCommitmentTransaction this_arg_conv;
36685 this_arg_conv.inner = (void*)(this_arg & (~1));
36686 this_arg_conv.is_owned = false;
36687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36688 unsigned char funding_key_arr[32];
36689 CHECK(funding_key->arr_len == 32);
36690 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36691 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36692 LDKu8slice funding_redeemscript_ref;
36693 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36694 funding_redeemscript_ref.data = funding_redeemscript->elems;
36695 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36696 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36697 FREE(funding_redeemscript);
36701 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
36702 LDKClosingTransaction this_obj_conv;
36703 this_obj_conv.inner = (void*)(this_obj & (~1));
36704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36706 ClosingTransaction_free(this_obj_conv);
36709 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
36710 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
36711 uint32_t ret_ref = 0;
36712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36715 ret_ref = (uintptr_t)ret_var.inner;
36716 if (ret_var.is_owned) {
36721 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
36722 LDKClosingTransaction arg_conv;
36723 arg_conv.inner = (void*)(arg & (~1));
36724 arg_conv.is_owned = false;
36725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36726 uint32_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
36730 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
36731 LDKClosingTransaction orig_conv;
36732 orig_conv.inner = (void*)(orig & (~1));
36733 orig_conv.is_owned = false;
36734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36735 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
36736 uint32_t ret_ref = 0;
36737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36740 ret_ref = (uintptr_t)ret_var.inner;
36741 if (ret_var.is_owned) {
36747 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
36748 LDKClosingTransaction o_conv;
36749 o_conv.inner = (void*)(o & (~1));
36750 o_conv.is_owned = false;
36751 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36752 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
36756 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) {
36757 LDKCVec_u8Z to_holder_script_ref;
36758 to_holder_script_ref.datalen = to_holder_script->arr_len;
36759 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36760 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
36761 LDKCVec_u8Z to_counterparty_script_ref;
36762 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
36763 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36764 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
36765 LDKOutPoint funding_outpoint_conv;
36766 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
36767 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
36768 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36769 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36770 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
36771 uint32_t ret_ref = 0;
36772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36775 ret_ref = (uintptr_t)ret_var.inner;
36776 if (ret_var.is_owned) {
36782 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
36783 LDKClosingTransaction this_arg_conv;
36784 this_arg_conv.inner = (void*)(this_arg & (~1));
36785 this_arg_conv.is_owned = false;
36786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36787 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
36788 uint32_t ret_ref = 0;
36789 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36790 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36792 ret_ref = (uintptr_t)ret_var.inner;
36793 if (ret_var.is_owned) {
36799 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
36800 LDKClosingTransaction 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 LDKOutPoint funding_outpoint_conv;
36805 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
36806 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
36807 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36808 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36809 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36810 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
36811 return (uint32_t)ret_conv;
36814 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
36815 LDKClosingTransaction this_arg_conv;
36816 this_arg_conv.inner = (void*)(this_arg & (~1));
36817 this_arg_conv.is_owned = false;
36818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36819 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
36823 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
36824 LDKClosingTransaction this_arg_conv;
36825 this_arg_conv.inner = (void*)(this_arg & (~1));
36826 this_arg_conv.is_owned = false;
36827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36828 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
36832 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
36833 LDKClosingTransaction this_arg_conv;
36834 this_arg_conv.inner = (void*)(this_arg & (~1));
36835 this_arg_conv.is_owned = false;
36836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36837 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
36838 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36839 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36843 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
36844 LDKClosingTransaction this_arg_conv;
36845 this_arg_conv.inner = (void*)(this_arg & (~1));
36846 this_arg_conv.is_owned = false;
36847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36848 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
36849 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36850 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36854 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
36855 LDKTrustedClosingTransaction this_obj_conv;
36856 this_obj_conv.inner = (void*)(this_obj & (~1));
36857 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36859 TrustedClosingTransaction_free(this_obj_conv);
36862 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
36863 LDKTrustedClosingTransaction this_arg_conv;
36864 this_arg_conv.inner = (void*)(this_arg & (~1));
36865 this_arg_conv.is_owned = false;
36866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36867 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
36868 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36869 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36870 Transaction_free(ret_var);
36874 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) {
36875 LDKTrustedClosingTransaction this_arg_conv;
36876 this_arg_conv.inner = (void*)(this_arg & (~1));
36877 this_arg_conv.is_owned = false;
36878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36879 LDKu8slice funding_redeemscript_ref;
36880 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36881 funding_redeemscript_ref.data = funding_redeemscript->elems;
36882 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36883 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36884 FREE(funding_redeemscript);
36888 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) {
36889 LDKTrustedClosingTransaction this_arg_conv;
36890 this_arg_conv.inner = (void*)(this_arg & (~1));
36891 this_arg_conv.is_owned = false;
36892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36893 unsigned char funding_key_arr[32];
36894 CHECK(funding_key->arr_len == 32);
36895 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36896 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36897 LDKu8slice funding_redeemscript_ref;
36898 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36899 funding_redeemscript_ref.data = funding_redeemscript->elems;
36900 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36901 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36902 FREE(funding_redeemscript);
36906 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
36907 LDKCommitmentTransaction this_obj_conv;
36908 this_obj_conv.inner = (void*)(this_obj & (~1));
36909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36911 CommitmentTransaction_free(this_obj_conv);
36914 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
36915 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
36916 uint32_t ret_ref = 0;
36917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36920 ret_ref = (uintptr_t)ret_var.inner;
36921 if (ret_var.is_owned) {
36926 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
36927 LDKCommitmentTransaction arg_conv;
36928 arg_conv.inner = (void*)(arg & (~1));
36929 arg_conv.is_owned = false;
36930 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36931 uint32_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
36935 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
36936 LDKCommitmentTransaction orig_conv;
36937 orig_conv.inner = (void*)(orig & (~1));
36938 orig_conv.is_owned = false;
36939 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36940 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
36941 uint32_t ret_ref = 0;
36942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36945 ret_ref = (uintptr_t)ret_var.inner;
36946 if (ret_var.is_owned) {
36952 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
36953 LDKCommitmentTransaction obj_conv;
36954 obj_conv.inner = (void*)(obj & (~1));
36955 obj_conv.is_owned = false;
36956 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36957 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
36958 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36959 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36960 CVec_u8Z_free(ret_var);
36964 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
36965 LDKu8slice ser_ref;
36966 ser_ref.datalen = ser->arr_len;
36967 ser_ref.data = ser->elems;
36968 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36969 *ret_conv = CommitmentTransaction_read(ser_ref);
36971 return (uint32_t)ret_conv;
36974 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
36975 LDKCommitmentTransaction this_arg_conv;
36976 this_arg_conv.inner = (void*)(this_arg & (~1));
36977 this_arg_conv.is_owned = false;
36978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36979 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
36983 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
36984 LDKCommitmentTransaction this_arg_conv;
36985 this_arg_conv.inner = (void*)(this_arg & (~1));
36986 this_arg_conv.is_owned = false;
36987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36988 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
36992 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
36993 LDKCommitmentTransaction this_arg_conv;
36994 this_arg_conv.inner = (void*)(this_arg & (~1));
36995 this_arg_conv.is_owned = false;
36996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36997 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37001 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
37002 LDKCommitmentTransaction this_arg_conv;
37003 this_arg_conv.inner = (void*)(this_arg & (~1));
37004 this_arg_conv.is_owned = false;
37005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37006 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
37010 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
37011 LDKCommitmentTransaction this_arg_conv;
37012 this_arg_conv.inner = (void*)(this_arg & (~1));
37013 this_arg_conv.is_owned = false;
37014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37015 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
37016 uint32_t ret_ref = 0;
37017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37020 ret_ref = (uintptr_t)ret_var.inner;
37021 if (ret_var.is_owned) {
37027 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) {
37028 LDKCommitmentTransaction this_arg_conv;
37029 this_arg_conv.inner = (void*)(this_arg & (~1));
37030 this_arg_conv.is_owned = false;
37031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37032 LDKDirectedChannelTransactionParameters channel_parameters_conv;
37033 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
37034 channel_parameters_conv.is_owned = false;
37035 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37036 LDKChannelPublicKeys broadcaster_keys_conv;
37037 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
37038 broadcaster_keys_conv.is_owned = false;
37039 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37040 LDKChannelPublicKeys countersignatory_keys_conv;
37041 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
37042 countersignatory_keys_conv.is_owned = false;
37043 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37044 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37045 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
37046 return (uint32_t)ret_conv;
37049 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
37050 LDKTrustedCommitmentTransaction this_obj_conv;
37051 this_obj_conv.inner = (void*)(this_obj & (~1));
37052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37054 TrustedCommitmentTransaction_free(this_obj_conv);
37057 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
37058 LDKTrustedCommitmentTransaction this_arg_conv;
37059 this_arg_conv.inner = (void*)(this_arg & (~1));
37060 this_arg_conv.is_owned = false;
37061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37062 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37063 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
37067 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
37068 LDKTrustedCommitmentTransaction this_arg_conv;
37069 this_arg_conv.inner = (void*)(this_arg & (~1));
37070 this_arg_conv.is_owned = false;
37071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37072 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
37073 uint32_t ret_ref = 0;
37074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37077 ret_ref = (uintptr_t)ret_var.inner;
37078 if (ret_var.is_owned) {
37084 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
37085 LDKTrustedCommitmentTransaction this_arg_conv;
37086 this_arg_conv.inner = (void*)(this_arg & (~1));
37087 this_arg_conv.is_owned = false;
37088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37089 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
37090 uint32_t ret_ref = 0;
37091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37094 ret_ref = (uintptr_t)ret_var.inner;
37095 if (ret_var.is_owned) {
37101 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
37102 LDKTrustedCommitmentTransaction this_arg_conv;
37103 this_arg_conv.inner = (void*)(this_arg & (~1));
37104 this_arg_conv.is_owned = false;
37105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37106 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
37110 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) {
37111 LDKTrustedCommitmentTransaction this_arg_conv;
37112 this_arg_conv.inner = (void*)(this_arg & (~1));
37113 this_arg_conv.is_owned = false;
37114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37115 unsigned char htlc_base_key_arr[32];
37116 CHECK(htlc_base_key->arr_len == 32);
37117 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
37118 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
37119 LDKDirectedChannelTransactionParameters channel_parameters_conv;
37120 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
37121 channel_parameters_conv.is_owned = false;
37122 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37123 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
37124 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
37125 return (uint32_t)ret_conv;
37128 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) {
37129 LDKPublicKey broadcaster_payment_basepoint_ref;
37130 CHECK(broadcaster_payment_basepoint->arr_len == 33);
37131 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
37132 LDKPublicKey countersignatory_payment_basepoint_ref;
37133 CHECK(countersignatory_payment_basepoint->arr_len == 33);
37134 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
37135 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
37139 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
37140 LDKInitFeatures a_conv;
37141 a_conv.inner = (void*)(a & (~1));
37142 a_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37144 LDKInitFeatures b_conv;
37145 b_conv.inner = (void*)(b & (~1));
37146 b_conv.is_owned = false;
37147 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37148 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
37152 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
37153 LDKNodeFeatures a_conv;
37154 a_conv.inner = (void*)(a & (~1));
37155 a_conv.is_owned = false;
37156 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37157 LDKNodeFeatures b_conv;
37158 b_conv.inner = (void*)(b & (~1));
37159 b_conv.is_owned = false;
37160 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37161 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
37165 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
37166 LDKChannelFeatures a_conv;
37167 a_conv.inner = (void*)(a & (~1));
37168 a_conv.is_owned = false;
37169 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37170 LDKChannelFeatures b_conv;
37171 b_conv.inner = (void*)(b & (~1));
37172 b_conv.is_owned = false;
37173 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37174 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
37178 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
37179 LDKInvoiceFeatures a_conv;
37180 a_conv.inner = (void*)(a & (~1));
37181 a_conv.is_owned = false;
37182 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37183 LDKInvoiceFeatures b_conv;
37184 b_conv.inner = (void*)(b & (~1));
37185 b_conv.is_owned = false;
37186 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37187 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
37191 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
37192 LDKChannelTypeFeatures a_conv;
37193 a_conv.inner = (void*)(a & (~1));
37194 a_conv.is_owned = false;
37195 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37196 LDKChannelTypeFeatures b_conv;
37197 b_conv.inner = (void*)(b & (~1));
37198 b_conv.is_owned = false;
37199 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37200 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
37204 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
37205 LDKInitFeatures ret_var = InitFeatures_clone(arg);
37206 uint32_t ret_ref = 0;
37207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37210 ret_ref = (uintptr_t)ret_var.inner;
37211 if (ret_var.is_owned) {
37216 uint32_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
37217 LDKInitFeatures arg_conv;
37218 arg_conv.inner = (void*)(arg & (~1));
37219 arg_conv.is_owned = false;
37220 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37221 uint32_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
37225 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
37226 LDKInitFeatures orig_conv;
37227 orig_conv.inner = (void*)(orig & (~1));
37228 orig_conv.is_owned = false;
37229 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37230 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
37231 uint32_t ret_ref = 0;
37232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37235 ret_ref = (uintptr_t)ret_var.inner;
37236 if (ret_var.is_owned) {
37242 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
37243 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
37244 uint32_t ret_ref = 0;
37245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37248 ret_ref = (uintptr_t)ret_var.inner;
37249 if (ret_var.is_owned) {
37254 uint32_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
37255 LDKNodeFeatures arg_conv;
37256 arg_conv.inner = (void*)(arg & (~1));
37257 arg_conv.is_owned = false;
37258 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37259 uint32_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
37263 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
37264 LDKNodeFeatures orig_conv;
37265 orig_conv.inner = (void*)(orig & (~1));
37266 orig_conv.is_owned = false;
37267 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37268 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
37269 uint32_t ret_ref = 0;
37270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37273 ret_ref = (uintptr_t)ret_var.inner;
37274 if (ret_var.is_owned) {
37280 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
37281 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
37282 uint32_t ret_ref = 0;
37283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37286 ret_ref = (uintptr_t)ret_var.inner;
37287 if (ret_var.is_owned) {
37292 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
37293 LDKChannelFeatures arg_conv;
37294 arg_conv.inner = (void*)(arg & (~1));
37295 arg_conv.is_owned = false;
37296 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37297 uint32_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
37301 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
37302 LDKChannelFeatures orig_conv;
37303 orig_conv.inner = (void*)(orig & (~1));
37304 orig_conv.is_owned = false;
37305 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37306 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
37307 uint32_t ret_ref = 0;
37308 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37309 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37311 ret_ref = (uintptr_t)ret_var.inner;
37312 if (ret_var.is_owned) {
37318 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
37319 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
37320 uint32_t ret_ref = 0;
37321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37324 ret_ref = (uintptr_t)ret_var.inner;
37325 if (ret_var.is_owned) {
37330 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
37331 LDKInvoiceFeatures arg_conv;
37332 arg_conv.inner = (void*)(arg & (~1));
37333 arg_conv.is_owned = false;
37334 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37335 uint32_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
37339 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
37340 LDKInvoiceFeatures orig_conv;
37341 orig_conv.inner = (void*)(orig & (~1));
37342 orig_conv.is_owned = false;
37343 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37344 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
37345 uint32_t ret_ref = 0;
37346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37349 ret_ref = (uintptr_t)ret_var.inner;
37350 if (ret_var.is_owned) {
37356 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
37357 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
37358 uint32_t ret_ref = 0;
37359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37362 ret_ref = (uintptr_t)ret_var.inner;
37363 if (ret_var.is_owned) {
37368 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
37369 LDKChannelTypeFeatures arg_conv;
37370 arg_conv.inner = (void*)(arg & (~1));
37371 arg_conv.is_owned = false;
37372 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37373 uint32_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
37377 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
37378 LDKChannelTypeFeatures orig_conv;
37379 orig_conv.inner = (void*)(orig & (~1));
37380 orig_conv.is_owned = false;
37381 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37382 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
37383 uint32_t ret_ref = 0;
37384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37387 ret_ref = (uintptr_t)ret_var.inner;
37388 if (ret_var.is_owned) {
37394 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
37395 LDKInitFeatures this_obj_conv;
37396 this_obj_conv.inner = (void*)(this_obj & (~1));
37397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37399 InitFeatures_free(this_obj_conv);
37402 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
37403 LDKNodeFeatures this_obj_conv;
37404 this_obj_conv.inner = (void*)(this_obj & (~1));
37405 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37407 NodeFeatures_free(this_obj_conv);
37410 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
37411 LDKChannelFeatures this_obj_conv;
37412 this_obj_conv.inner = (void*)(this_obj & (~1));
37413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37415 ChannelFeatures_free(this_obj_conv);
37418 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
37419 LDKInvoiceFeatures this_obj_conv;
37420 this_obj_conv.inner = (void*)(this_obj & (~1));
37421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37423 InvoiceFeatures_free(this_obj_conv);
37426 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
37427 LDKChannelTypeFeatures this_obj_conv;
37428 this_obj_conv.inner = (void*)(this_obj & (~1));
37429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37431 ChannelTypeFeatures_free(this_obj_conv);
37434 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
37435 LDKInitFeatures ret_var = InitFeatures_empty();
37436 uint32_t ret_ref = 0;
37437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37440 ret_ref = (uintptr_t)ret_var.inner;
37441 if (ret_var.is_owned) {
37447 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
37448 LDKInitFeatures ret_var = InitFeatures_known();
37449 uint32_t ret_ref = 0;
37450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37453 ret_ref = (uintptr_t)ret_var.inner;
37454 if (ret_var.is_owned) {
37460 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
37461 LDKInitFeatures this_arg_conv;
37462 this_arg_conv.inner = (void*)(this_arg & (~1));
37463 this_arg_conv.is_owned = false;
37464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37465 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
37469 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
37470 LDKNodeFeatures ret_var = NodeFeatures_empty();
37471 uint32_t ret_ref = 0;
37472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37475 ret_ref = (uintptr_t)ret_var.inner;
37476 if (ret_var.is_owned) {
37482 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
37483 LDKNodeFeatures ret_var = NodeFeatures_known();
37484 uint32_t ret_ref = 0;
37485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37488 ret_ref = (uintptr_t)ret_var.inner;
37489 if (ret_var.is_owned) {
37495 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
37496 LDKNodeFeatures this_arg_conv;
37497 this_arg_conv.inner = (void*)(this_arg & (~1));
37498 this_arg_conv.is_owned = false;
37499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37500 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
37504 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
37505 LDKChannelFeatures ret_var = ChannelFeatures_empty();
37506 uint32_t ret_ref = 0;
37507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37510 ret_ref = (uintptr_t)ret_var.inner;
37511 if (ret_var.is_owned) {
37517 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
37518 LDKChannelFeatures ret_var = ChannelFeatures_known();
37519 uint32_t ret_ref = 0;
37520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37523 ret_ref = (uintptr_t)ret_var.inner;
37524 if (ret_var.is_owned) {
37530 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
37531 LDKChannelFeatures this_arg_conv;
37532 this_arg_conv.inner = (void*)(this_arg & (~1));
37533 this_arg_conv.is_owned = false;
37534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37535 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
37539 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
37540 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
37541 uint32_t ret_ref = 0;
37542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37545 ret_ref = (uintptr_t)ret_var.inner;
37546 if (ret_var.is_owned) {
37552 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
37553 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
37554 uint32_t ret_ref = 0;
37555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37558 ret_ref = (uintptr_t)ret_var.inner;
37559 if (ret_var.is_owned) {
37565 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
37566 LDKInvoiceFeatures this_arg_conv;
37567 this_arg_conv.inner = (void*)(this_arg & (~1));
37568 this_arg_conv.is_owned = false;
37569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37570 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
37574 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
37575 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
37576 uint32_t ret_ref = 0;
37577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37580 ret_ref = (uintptr_t)ret_var.inner;
37581 if (ret_var.is_owned) {
37587 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
37588 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
37589 uint32_t ret_ref = 0;
37590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37593 ret_ref = (uintptr_t)ret_var.inner;
37594 if (ret_var.is_owned) {
37600 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
37601 LDKChannelTypeFeatures this_arg_conv;
37602 this_arg_conv.inner = (void*)(this_arg & (~1));
37603 this_arg_conv.is_owned = false;
37604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37605 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
37609 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
37610 LDKInitFeatures obj_conv;
37611 obj_conv.inner = (void*)(obj & (~1));
37612 obj_conv.is_owned = false;
37613 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37614 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
37615 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37616 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37617 CVec_u8Z_free(ret_var);
37621 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
37622 LDKu8slice ser_ref;
37623 ser_ref.datalen = ser->arr_len;
37624 ser_ref.data = ser->elems;
37625 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
37626 *ret_conv = InitFeatures_read(ser_ref);
37628 return (uint32_t)ret_conv;
37631 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
37632 LDKChannelFeatures obj_conv;
37633 obj_conv.inner = (void*)(obj & (~1));
37634 obj_conv.is_owned = false;
37635 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37636 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
37637 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37638 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37639 CVec_u8Z_free(ret_var);
37643 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
37644 LDKu8slice ser_ref;
37645 ser_ref.datalen = ser->arr_len;
37646 ser_ref.data = ser->elems;
37647 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
37648 *ret_conv = ChannelFeatures_read(ser_ref);
37650 return (uint32_t)ret_conv;
37653 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
37654 LDKNodeFeatures obj_conv;
37655 obj_conv.inner = (void*)(obj & (~1));
37656 obj_conv.is_owned = false;
37657 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37658 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
37659 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37660 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37661 CVec_u8Z_free(ret_var);
37665 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
37666 LDKu8slice ser_ref;
37667 ser_ref.datalen = ser->arr_len;
37668 ser_ref.data = ser->elems;
37669 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
37670 *ret_conv = NodeFeatures_read(ser_ref);
37672 return (uint32_t)ret_conv;
37675 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
37676 LDKInvoiceFeatures obj_conv;
37677 obj_conv.inner = (void*)(obj & (~1));
37678 obj_conv.is_owned = false;
37679 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37680 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
37681 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37682 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37683 CVec_u8Z_free(ret_var);
37687 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
37688 LDKu8slice ser_ref;
37689 ser_ref.datalen = ser->arr_len;
37690 ser_ref.data = ser->elems;
37691 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
37692 *ret_conv = InvoiceFeatures_read(ser_ref);
37694 return (uint32_t)ret_conv;
37697 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
37698 LDKChannelTypeFeatures obj_conv;
37699 obj_conv.inner = (void*)(obj & (~1));
37700 obj_conv.is_owned = false;
37701 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37702 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
37703 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37704 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37705 CVec_u8Z_free(ret_var);
37709 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
37710 LDKu8slice ser_ref;
37711 ser_ref.datalen = ser->arr_len;
37712 ser_ref.data = ser->elems;
37713 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
37714 *ret_conv = ChannelTypeFeatures_read(ser_ref);
37716 return (uint32_t)ret_conv;
37719 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
37720 LDKInitFeatures this_arg_conv;
37721 this_arg_conv.inner = (void*)(this_arg & (~1));
37722 this_arg_conv.is_owned = false;
37723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37724 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
37727 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint32_t this_arg) {
37728 LDKInitFeatures this_arg_conv;
37729 this_arg_conv.inner = (void*)(this_arg & (~1));
37730 this_arg_conv.is_owned = false;
37731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37732 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
37735 jboolean __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint32_t this_arg) {
37736 LDKInitFeatures 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 = InitFeatures_supports_data_loss_protect(&this_arg_conv);
37744 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
37745 LDKNodeFeatures this_arg_conv;
37746 this_arg_conv.inner = (void*)(this_arg & (~1));
37747 this_arg_conv.is_owned = false;
37748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37749 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
37752 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint32_t this_arg) {
37753 LDKNodeFeatures this_arg_conv;
37754 this_arg_conv.inner = (void*)(this_arg & (~1));
37755 this_arg_conv.is_owned = false;
37756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37757 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
37760 jboolean __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint32_t this_arg) {
37761 LDKNodeFeatures this_arg_conv;
37762 this_arg_conv.inner = (void*)(this_arg & (~1));
37763 this_arg_conv.is_owned = false;
37764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37765 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
37769 jboolean __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint32_t this_arg) {
37770 LDKInitFeatures this_arg_conv;
37771 this_arg_conv.inner = (void*)(this_arg & (~1));
37772 this_arg_conv.is_owned = false;
37773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37774 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
37778 jboolean __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint32_t this_arg) {
37779 LDKNodeFeatures this_arg_conv;
37780 this_arg_conv.inner = (void*)(this_arg & (~1));
37781 this_arg_conv.is_owned = false;
37782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37783 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
37787 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint32_t this_arg) {
37788 LDKInitFeatures this_arg_conv;
37789 this_arg_conv.inner = (void*)(this_arg & (~1));
37790 this_arg_conv.is_owned = false;
37791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37792 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
37795 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint32_t this_arg) {
37796 LDKInitFeatures this_arg_conv;
37797 this_arg_conv.inner = (void*)(this_arg & (~1));
37798 this_arg_conv.is_owned = false;
37799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37800 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
37803 jboolean __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint32_t this_arg) {
37804 LDKInitFeatures this_arg_conv;
37805 this_arg_conv.inner = (void*)(this_arg & (~1));
37806 this_arg_conv.is_owned = false;
37807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37808 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
37812 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
37813 LDKInitFeatures this_arg_conv;
37814 this_arg_conv.inner = (void*)(this_arg & (~1));
37815 this_arg_conv.is_owned = false;
37816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37817 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37820 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
37821 LDKInitFeatures this_arg_conv;
37822 this_arg_conv.inner = (void*)(this_arg & (~1));
37823 this_arg_conv.is_owned = false;
37824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37825 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37828 jboolean __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
37829 LDKInitFeatures this_arg_conv;
37830 this_arg_conv.inner = (void*)(this_arg & (~1));
37831 this_arg_conv.is_owned = false;
37832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37833 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37837 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
37838 LDKNodeFeatures this_arg_conv;
37839 this_arg_conv.inner = (void*)(this_arg & (~1));
37840 this_arg_conv.is_owned = false;
37841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37842 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37845 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
37846 LDKNodeFeatures this_arg_conv;
37847 this_arg_conv.inner = (void*)(this_arg & (~1));
37848 this_arg_conv.is_owned = false;
37849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37850 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37853 jboolean __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
37854 LDKNodeFeatures this_arg_conv;
37855 this_arg_conv.inner = (void*)(this_arg & (~1));
37856 this_arg_conv.is_owned = false;
37857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37858 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37862 jboolean __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
37863 LDKInitFeatures this_arg_conv;
37864 this_arg_conv.inner = (void*)(this_arg & (~1));
37865 this_arg_conv.is_owned = false;
37866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37867 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37871 jboolean __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
37872 LDKNodeFeatures this_arg_conv;
37873 this_arg_conv.inner = (void*)(this_arg & (~1));
37874 this_arg_conv.is_owned = false;
37875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37876 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37880 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint32_t this_arg) {
37881 LDKInitFeatures this_arg_conv;
37882 this_arg_conv.inner = (void*)(this_arg & (~1));
37883 this_arg_conv.is_owned = false;
37884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37885 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
37888 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint32_t this_arg) {
37889 LDKInitFeatures this_arg_conv;
37890 this_arg_conv.inner = (void*)(this_arg & (~1));
37891 this_arg_conv.is_owned = false;
37892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37893 InitFeatures_set_gossip_queries_required(&this_arg_conv);
37896 jboolean __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint32_t this_arg) {
37897 LDKInitFeatures this_arg_conv;
37898 this_arg_conv.inner = (void*)(this_arg & (~1));
37899 this_arg_conv.is_owned = false;
37900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37901 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
37905 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint32_t this_arg) {
37906 LDKNodeFeatures this_arg_conv;
37907 this_arg_conv.inner = (void*)(this_arg & (~1));
37908 this_arg_conv.is_owned = false;
37909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37910 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
37913 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint32_t this_arg) {
37914 LDKNodeFeatures this_arg_conv;
37915 this_arg_conv.inner = (void*)(this_arg & (~1));
37916 this_arg_conv.is_owned = false;
37917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37918 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
37921 jboolean __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint32_t this_arg) {
37922 LDKNodeFeatures this_arg_conv;
37923 this_arg_conv.inner = (void*)(this_arg & (~1));
37924 this_arg_conv.is_owned = false;
37925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37926 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
37930 jboolean __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint32_t this_arg) {
37931 LDKInitFeatures this_arg_conv;
37932 this_arg_conv.inner = (void*)(this_arg & (~1));
37933 this_arg_conv.is_owned = false;
37934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37935 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
37939 jboolean __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint32_t this_arg) {
37940 LDKNodeFeatures this_arg_conv;
37941 this_arg_conv.inner = (void*)(this_arg & (~1));
37942 this_arg_conv.is_owned = false;
37943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37944 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
37948 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
37949 LDKInitFeatures this_arg_conv;
37950 this_arg_conv.inner = (void*)(this_arg & (~1));
37951 this_arg_conv.is_owned = false;
37952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37953 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
37956 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint32_t this_arg) {
37957 LDKInitFeatures 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 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
37964 jboolean __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint32_t this_arg) {
37965 LDKInitFeatures this_arg_conv;
37966 this_arg_conv.inner = (void*)(this_arg & (~1));
37967 this_arg_conv.is_owned = false;
37968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37969 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
37973 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
37974 LDKNodeFeatures this_arg_conv;
37975 this_arg_conv.inner = (void*)(this_arg & (~1));
37976 this_arg_conv.is_owned = false;
37977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37978 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
37981 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint32_t this_arg) {
37982 LDKNodeFeatures this_arg_conv;
37983 this_arg_conv.inner = (void*)(this_arg & (~1));
37984 this_arg_conv.is_owned = false;
37985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37986 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
37989 jboolean __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint32_t this_arg) {
37990 LDKNodeFeatures this_arg_conv;
37991 this_arg_conv.inner = (void*)(this_arg & (~1));
37992 this_arg_conv.is_owned = false;
37993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37994 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
37998 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
37999 LDKInvoiceFeatures this_arg_conv;
38000 this_arg_conv.inner = (void*)(this_arg & (~1));
38001 this_arg_conv.is_owned = false;
38002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38003 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
38006 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint32_t this_arg) {
38007 LDKInvoiceFeatures this_arg_conv;
38008 this_arg_conv.inner = (void*)(this_arg & (~1));
38009 this_arg_conv.is_owned = false;
38010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38011 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
38014 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint32_t this_arg) {
38015 LDKInvoiceFeatures this_arg_conv;
38016 this_arg_conv.inner = (void*)(this_arg & (~1));
38017 this_arg_conv.is_owned = false;
38018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38019 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
38023 jboolean __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint32_t this_arg) {
38024 LDKInitFeatures this_arg_conv;
38025 this_arg_conv.inner = (void*)(this_arg & (~1));
38026 this_arg_conv.is_owned = false;
38027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38028 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
38032 jboolean __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint32_t this_arg) {
38033 LDKNodeFeatures this_arg_conv;
38034 this_arg_conv.inner = (void*)(this_arg & (~1));
38035 this_arg_conv.is_owned = false;
38036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38037 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
38041 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint32_t this_arg) {
38042 LDKInvoiceFeatures this_arg_conv;
38043 this_arg_conv.inner = (void*)(this_arg & (~1));
38044 this_arg_conv.is_owned = false;
38045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38046 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
38050 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint32_t this_arg) {
38051 LDKInitFeatures this_arg_conv;
38052 this_arg_conv.inner = (void*)(this_arg & (~1));
38053 this_arg_conv.is_owned = false;
38054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38055 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
38058 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint32_t this_arg) {
38059 LDKInitFeatures this_arg_conv;
38060 this_arg_conv.inner = (void*)(this_arg & (~1));
38061 this_arg_conv.is_owned = false;
38062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38063 InitFeatures_set_static_remote_key_required(&this_arg_conv);
38066 jboolean __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint32_t this_arg) {
38067 LDKInitFeatures this_arg_conv;
38068 this_arg_conv.inner = (void*)(this_arg & (~1));
38069 this_arg_conv.is_owned = false;
38070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38071 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
38075 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
38076 LDKNodeFeatures this_arg_conv;
38077 this_arg_conv.inner = (void*)(this_arg & (~1));
38078 this_arg_conv.is_owned = false;
38079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38080 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
38083 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint32_t this_arg) {
38084 LDKNodeFeatures this_arg_conv;
38085 this_arg_conv.inner = (void*)(this_arg & (~1));
38086 this_arg_conv.is_owned = false;
38087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38088 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
38091 jboolean __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint32_t this_arg) {
38092 LDKNodeFeatures this_arg_conv;
38093 this_arg_conv.inner = (void*)(this_arg & (~1));
38094 this_arg_conv.is_owned = false;
38095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38096 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
38100 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
38101 LDKChannelTypeFeatures this_arg_conv;
38102 this_arg_conv.inner = (void*)(this_arg & (~1));
38103 this_arg_conv.is_owned = false;
38104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38105 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
38108 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint32_t this_arg) {
38109 LDKChannelTypeFeatures this_arg_conv;
38110 this_arg_conv.inner = (void*)(this_arg & (~1));
38111 this_arg_conv.is_owned = false;
38112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38113 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
38116 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint32_t this_arg) {
38117 LDKChannelTypeFeatures this_arg_conv;
38118 this_arg_conv.inner = (void*)(this_arg & (~1));
38119 this_arg_conv.is_owned = false;
38120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38121 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
38125 jboolean __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint32_t this_arg) {
38126 LDKInitFeatures this_arg_conv;
38127 this_arg_conv.inner = (void*)(this_arg & (~1));
38128 this_arg_conv.is_owned = false;
38129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38130 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
38134 jboolean __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint32_t this_arg) {
38135 LDKNodeFeatures this_arg_conv;
38136 this_arg_conv.inner = (void*)(this_arg & (~1));
38137 this_arg_conv.is_owned = false;
38138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38139 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
38143 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint32_t this_arg) {
38144 LDKChannelTypeFeatures this_arg_conv;
38145 this_arg_conv.inner = (void*)(this_arg & (~1));
38146 this_arg_conv.is_owned = false;
38147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38148 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
38152 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint32_t this_arg) {
38153 LDKInitFeatures this_arg_conv;
38154 this_arg_conv.inner = (void*)(this_arg & (~1));
38155 this_arg_conv.is_owned = false;
38156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38157 InitFeatures_set_payment_secret_optional(&this_arg_conv);
38160 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint32_t this_arg) {
38161 LDKInitFeatures this_arg_conv;
38162 this_arg_conv.inner = (void*)(this_arg & (~1));
38163 this_arg_conv.is_owned = false;
38164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38165 InitFeatures_set_payment_secret_required(&this_arg_conv);
38168 jboolean __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
38169 LDKInitFeatures this_arg_conv;
38170 this_arg_conv.inner = (void*)(this_arg & (~1));
38171 this_arg_conv.is_owned = false;
38172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38173 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
38177 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint32_t this_arg) {
38178 LDKNodeFeatures this_arg_conv;
38179 this_arg_conv.inner = (void*)(this_arg & (~1));
38180 this_arg_conv.is_owned = false;
38181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38182 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
38185 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint32_t this_arg) {
38186 LDKNodeFeatures this_arg_conv;
38187 this_arg_conv.inner = (void*)(this_arg & (~1));
38188 this_arg_conv.is_owned = false;
38189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38190 NodeFeatures_set_payment_secret_required(&this_arg_conv);
38193 jboolean __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
38194 LDKNodeFeatures this_arg_conv;
38195 this_arg_conv.inner = (void*)(this_arg & (~1));
38196 this_arg_conv.is_owned = false;
38197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38198 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
38202 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint32_t this_arg) {
38203 LDKInvoiceFeatures this_arg_conv;
38204 this_arg_conv.inner = (void*)(this_arg & (~1));
38205 this_arg_conv.is_owned = false;
38206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38207 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
38210 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint32_t this_arg) {
38211 LDKInvoiceFeatures this_arg_conv;
38212 this_arg_conv.inner = (void*)(this_arg & (~1));
38213 this_arg_conv.is_owned = false;
38214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38215 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
38218 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
38219 LDKInvoiceFeatures this_arg_conv;
38220 this_arg_conv.inner = (void*)(this_arg & (~1));
38221 this_arg_conv.is_owned = false;
38222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38223 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
38227 jboolean __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint32_t this_arg) {
38228 LDKInitFeatures this_arg_conv;
38229 this_arg_conv.inner = (void*)(this_arg & (~1));
38230 this_arg_conv.is_owned = false;
38231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38232 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
38236 jboolean __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint32_t this_arg) {
38237 LDKNodeFeatures this_arg_conv;
38238 this_arg_conv.inner = (void*)(this_arg & (~1));
38239 this_arg_conv.is_owned = false;
38240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38241 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
38245 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint32_t this_arg) {
38246 LDKInvoiceFeatures this_arg_conv;
38247 this_arg_conv.inner = (void*)(this_arg & (~1));
38248 this_arg_conv.is_owned = false;
38249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38250 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
38254 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint32_t this_arg) {
38255 LDKInitFeatures this_arg_conv;
38256 this_arg_conv.inner = (void*)(this_arg & (~1));
38257 this_arg_conv.is_owned = false;
38258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38259 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
38262 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint32_t this_arg) {
38263 LDKInitFeatures this_arg_conv;
38264 this_arg_conv.inner = (void*)(this_arg & (~1));
38265 this_arg_conv.is_owned = false;
38266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38267 InitFeatures_set_basic_mpp_required(&this_arg_conv);
38270 jboolean __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint32_t this_arg) {
38271 LDKInitFeatures this_arg_conv;
38272 this_arg_conv.inner = (void*)(this_arg & (~1));
38273 this_arg_conv.is_owned = false;
38274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38275 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
38279 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint32_t this_arg) {
38280 LDKNodeFeatures this_arg_conv;
38281 this_arg_conv.inner = (void*)(this_arg & (~1));
38282 this_arg_conv.is_owned = false;
38283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38284 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
38287 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint32_t this_arg) {
38288 LDKNodeFeatures this_arg_conv;
38289 this_arg_conv.inner = (void*)(this_arg & (~1));
38290 this_arg_conv.is_owned = false;
38291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38292 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
38295 jboolean __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint32_t this_arg) {
38296 LDKNodeFeatures this_arg_conv;
38297 this_arg_conv.inner = (void*)(this_arg & (~1));
38298 this_arg_conv.is_owned = false;
38299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38300 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
38304 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint32_t this_arg) {
38305 LDKInvoiceFeatures this_arg_conv;
38306 this_arg_conv.inner = (void*)(this_arg & (~1));
38307 this_arg_conv.is_owned = false;
38308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38309 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
38312 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint32_t this_arg) {
38313 LDKInvoiceFeatures this_arg_conv;
38314 this_arg_conv.inner = (void*)(this_arg & (~1));
38315 this_arg_conv.is_owned = false;
38316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38317 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
38320 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint32_t this_arg) {
38321 LDKInvoiceFeatures this_arg_conv;
38322 this_arg_conv.inner = (void*)(this_arg & (~1));
38323 this_arg_conv.is_owned = false;
38324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38325 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
38329 jboolean __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint32_t this_arg) {
38330 LDKInitFeatures this_arg_conv;
38331 this_arg_conv.inner = (void*)(this_arg & (~1));
38332 this_arg_conv.is_owned = false;
38333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38334 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
38338 jboolean __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint32_t this_arg) {
38339 LDKNodeFeatures this_arg_conv;
38340 this_arg_conv.inner = (void*)(this_arg & (~1));
38341 this_arg_conv.is_owned = false;
38342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38343 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
38347 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint32_t this_arg) {
38348 LDKInvoiceFeatures this_arg_conv;
38349 this_arg_conv.inner = (void*)(this_arg & (~1));
38350 this_arg_conv.is_owned = false;
38351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38352 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
38356 void __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint32_t this_arg) {
38357 LDKInitFeatures this_arg_conv;
38358 this_arg_conv.inner = (void*)(this_arg & (~1));
38359 this_arg_conv.is_owned = false;
38360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38361 InitFeatures_set_wumbo_optional(&this_arg_conv);
38364 void __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint32_t this_arg) {
38365 LDKInitFeatures this_arg_conv;
38366 this_arg_conv.inner = (void*)(this_arg & (~1));
38367 this_arg_conv.is_owned = false;
38368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38369 InitFeatures_set_wumbo_required(&this_arg_conv);
38372 jboolean __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint32_t this_arg) {
38373 LDKInitFeatures this_arg_conv;
38374 this_arg_conv.inner = (void*)(this_arg & (~1));
38375 this_arg_conv.is_owned = false;
38376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38377 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
38381 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint32_t this_arg) {
38382 LDKNodeFeatures this_arg_conv;
38383 this_arg_conv.inner = (void*)(this_arg & (~1));
38384 this_arg_conv.is_owned = false;
38385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38386 NodeFeatures_set_wumbo_optional(&this_arg_conv);
38389 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint32_t this_arg) {
38390 LDKNodeFeatures this_arg_conv;
38391 this_arg_conv.inner = (void*)(this_arg & (~1));
38392 this_arg_conv.is_owned = false;
38393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38394 NodeFeatures_set_wumbo_required(&this_arg_conv);
38397 jboolean __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint32_t this_arg) {
38398 LDKNodeFeatures this_arg_conv;
38399 this_arg_conv.inner = (void*)(this_arg & (~1));
38400 this_arg_conv.is_owned = false;
38401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38402 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
38406 jboolean __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint32_t this_arg) {
38407 LDKInitFeatures this_arg_conv;
38408 this_arg_conv.inner = (void*)(this_arg & (~1));
38409 this_arg_conv.is_owned = false;
38410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38411 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
38415 jboolean __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint32_t this_arg) {
38416 LDKNodeFeatures this_arg_conv;
38417 this_arg_conv.inner = (void*)(this_arg & (~1));
38418 this_arg_conv.is_owned = false;
38419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38420 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
38424 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
38425 LDKInitFeatures this_arg_conv;
38426 this_arg_conv.inner = (void*)(this_arg & (~1));
38427 this_arg_conv.is_owned = false;
38428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38429 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38432 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
38433 LDKInitFeatures this_arg_conv;
38434 this_arg_conv.inner = (void*)(this_arg & (~1));
38435 this_arg_conv.is_owned = false;
38436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38437 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38440 jboolean __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
38441 LDKInitFeatures this_arg_conv;
38442 this_arg_conv.inner = (void*)(this_arg & (~1));
38443 this_arg_conv.is_owned = false;
38444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38445 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38449 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
38450 LDKNodeFeatures this_arg_conv;
38451 this_arg_conv.inner = (void*)(this_arg & (~1));
38452 this_arg_conv.is_owned = false;
38453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38454 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38457 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
38458 LDKNodeFeatures this_arg_conv;
38459 this_arg_conv.inner = (void*)(this_arg & (~1));
38460 this_arg_conv.is_owned = false;
38461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38462 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38465 jboolean __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
38466 LDKNodeFeatures this_arg_conv;
38467 this_arg_conv.inner = (void*)(this_arg & (~1));
38468 this_arg_conv.is_owned = false;
38469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38470 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38474 jboolean __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
38475 LDKInitFeatures this_arg_conv;
38476 this_arg_conv.inner = (void*)(this_arg & (~1));
38477 this_arg_conv.is_owned = false;
38478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38479 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38483 jboolean __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
38484 LDKNodeFeatures this_arg_conv;
38485 this_arg_conv.inner = (void*)(this_arg & (~1));
38486 this_arg_conv.is_owned = false;
38487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38488 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38492 void __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint32_t this_arg) {
38493 LDKInitFeatures this_arg_conv;
38494 this_arg_conv.inner = (void*)(this_arg & (~1));
38495 this_arg_conv.is_owned = false;
38496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38497 InitFeatures_set_channel_type_optional(&this_arg_conv);
38500 void __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint32_t this_arg) {
38501 LDKInitFeatures this_arg_conv;
38502 this_arg_conv.inner = (void*)(this_arg & (~1));
38503 this_arg_conv.is_owned = false;
38504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38505 InitFeatures_set_channel_type_required(&this_arg_conv);
38508 jboolean __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint32_t this_arg) {
38509 LDKInitFeatures this_arg_conv;
38510 this_arg_conv.inner = (void*)(this_arg & (~1));
38511 this_arg_conv.is_owned = false;
38512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38513 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
38517 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint32_t this_arg) {
38518 LDKNodeFeatures this_arg_conv;
38519 this_arg_conv.inner = (void*)(this_arg & (~1));
38520 this_arg_conv.is_owned = false;
38521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38522 NodeFeatures_set_channel_type_optional(&this_arg_conv);
38525 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint32_t this_arg) {
38526 LDKNodeFeatures this_arg_conv;
38527 this_arg_conv.inner = (void*)(this_arg & (~1));
38528 this_arg_conv.is_owned = false;
38529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38530 NodeFeatures_set_channel_type_required(&this_arg_conv);
38533 jboolean __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint32_t this_arg) {
38534 LDKNodeFeatures this_arg_conv;
38535 this_arg_conv.inner = (void*)(this_arg & (~1));
38536 this_arg_conv.is_owned = false;
38537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38538 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
38542 jboolean __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint32_t this_arg) {
38543 LDKInitFeatures this_arg_conv;
38544 this_arg_conv.inner = (void*)(this_arg & (~1));
38545 this_arg_conv.is_owned = false;
38546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38547 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
38551 jboolean __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint32_t this_arg) {
38552 LDKNodeFeatures this_arg_conv;
38553 this_arg_conv.inner = (void*)(this_arg & (~1));
38554 this_arg_conv.is_owned = false;
38555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38556 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
38560 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint32_t this_arg) {
38561 LDKInitFeatures this_arg_conv;
38562 this_arg_conv.inner = (void*)(this_arg & (~1));
38563 this_arg_conv.is_owned = false;
38564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38565 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
38568 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint32_t this_arg) {
38569 LDKInitFeatures this_arg_conv;
38570 this_arg_conv.inner = (void*)(this_arg & (~1));
38571 this_arg_conv.is_owned = false;
38572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38573 InitFeatures_set_scid_privacy_required(&this_arg_conv);
38576 jboolean __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint32_t this_arg) {
38577 LDKInitFeatures this_arg_conv;
38578 this_arg_conv.inner = (void*)(this_arg & (~1));
38579 this_arg_conv.is_owned = false;
38580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38581 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
38585 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
38586 LDKNodeFeatures this_arg_conv;
38587 this_arg_conv.inner = (void*)(this_arg & (~1));
38588 this_arg_conv.is_owned = false;
38589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38590 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
38593 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint32_t this_arg) {
38594 LDKNodeFeatures this_arg_conv;
38595 this_arg_conv.inner = (void*)(this_arg & (~1));
38596 this_arg_conv.is_owned = false;
38597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38598 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
38601 jboolean __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint32_t this_arg) {
38602 LDKNodeFeatures this_arg_conv;
38603 this_arg_conv.inner = (void*)(this_arg & (~1));
38604 this_arg_conv.is_owned = false;
38605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38606 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
38610 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
38611 LDKChannelTypeFeatures this_arg_conv;
38612 this_arg_conv.inner = (void*)(this_arg & (~1));
38613 this_arg_conv.is_owned = false;
38614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38615 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
38618 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint32_t this_arg) {
38619 LDKChannelTypeFeatures this_arg_conv;
38620 this_arg_conv.inner = (void*)(this_arg & (~1));
38621 this_arg_conv.is_owned = false;
38622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38623 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
38626 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint32_t this_arg) {
38627 LDKChannelTypeFeatures this_arg_conv;
38628 this_arg_conv.inner = (void*)(this_arg & (~1));
38629 this_arg_conv.is_owned = false;
38630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38631 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
38635 jboolean __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint32_t this_arg) {
38636 LDKInitFeatures this_arg_conv;
38637 this_arg_conv.inner = (void*)(this_arg & (~1));
38638 this_arg_conv.is_owned = false;
38639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38640 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
38644 jboolean __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint32_t this_arg) {
38645 LDKNodeFeatures this_arg_conv;
38646 this_arg_conv.inner = (void*)(this_arg & (~1));
38647 this_arg_conv.is_owned = false;
38648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38649 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
38653 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint32_t this_arg) {
38654 LDKChannelTypeFeatures this_arg_conv;
38655 this_arg_conv.inner = (void*)(this_arg & (~1));
38656 this_arg_conv.is_owned = false;
38657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38658 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
38662 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint32_t this_arg) {
38663 LDKInitFeatures this_arg_conv;
38664 this_arg_conv.inner = (void*)(this_arg & (~1));
38665 this_arg_conv.is_owned = false;
38666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38667 InitFeatures_set_zero_conf_optional(&this_arg_conv);
38670 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint32_t this_arg) {
38671 LDKInitFeatures this_arg_conv;
38672 this_arg_conv.inner = (void*)(this_arg & (~1));
38673 this_arg_conv.is_owned = false;
38674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38675 InitFeatures_set_zero_conf_required(&this_arg_conv);
38678 jboolean __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint32_t this_arg) {
38679 LDKInitFeatures this_arg_conv;
38680 this_arg_conv.inner = (void*)(this_arg & (~1));
38681 this_arg_conv.is_owned = false;
38682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38683 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
38687 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint32_t this_arg) {
38688 LDKNodeFeatures this_arg_conv;
38689 this_arg_conv.inner = (void*)(this_arg & (~1));
38690 this_arg_conv.is_owned = false;
38691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38692 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
38695 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint32_t this_arg) {
38696 LDKNodeFeatures this_arg_conv;
38697 this_arg_conv.inner = (void*)(this_arg & (~1));
38698 this_arg_conv.is_owned = false;
38699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38700 NodeFeatures_set_zero_conf_required(&this_arg_conv);
38703 jboolean __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint32_t this_arg) {
38704 LDKNodeFeatures this_arg_conv;
38705 this_arg_conv.inner = (void*)(this_arg & (~1));
38706 this_arg_conv.is_owned = false;
38707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38708 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
38712 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint32_t this_arg) {
38713 LDKChannelTypeFeatures this_arg_conv;
38714 this_arg_conv.inner = (void*)(this_arg & (~1));
38715 this_arg_conv.is_owned = false;
38716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38717 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
38720 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint32_t this_arg) {
38721 LDKChannelTypeFeatures this_arg_conv;
38722 this_arg_conv.inner = (void*)(this_arg & (~1));
38723 this_arg_conv.is_owned = false;
38724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38725 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
38728 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint32_t this_arg) {
38729 LDKChannelTypeFeatures this_arg_conv;
38730 this_arg_conv.inner = (void*)(this_arg & (~1));
38731 this_arg_conv.is_owned = false;
38732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38733 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
38737 jboolean __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint32_t this_arg) {
38738 LDKInitFeatures this_arg_conv;
38739 this_arg_conv.inner = (void*)(this_arg & (~1));
38740 this_arg_conv.is_owned = false;
38741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38742 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
38746 jboolean __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint32_t this_arg) {
38747 LDKNodeFeatures this_arg_conv;
38748 this_arg_conv.inner = (void*)(this_arg & (~1));
38749 this_arg_conv.is_owned = false;
38750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38751 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
38755 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint32_t this_arg) {
38756 LDKChannelTypeFeatures this_arg_conv;
38757 this_arg_conv.inner = (void*)(this_arg & (~1));
38758 this_arg_conv.is_owned = false;
38759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38760 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
38764 void __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint32_t this_arg) {
38765 LDKNodeFeatures this_arg_conv;
38766 this_arg_conv.inner = (void*)(this_arg & (~1));
38767 this_arg_conv.is_owned = false;
38768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38769 NodeFeatures_set_keysend_optional(&this_arg_conv);
38772 void __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint32_t this_arg) {
38773 LDKNodeFeatures this_arg_conv;
38774 this_arg_conv.inner = (void*)(this_arg & (~1));
38775 this_arg_conv.is_owned = false;
38776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38777 NodeFeatures_set_keysend_required(&this_arg_conv);
38780 jboolean __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint32_t this_arg) {
38781 LDKNodeFeatures this_arg_conv;
38782 this_arg_conv.inner = (void*)(this_arg & (~1));
38783 this_arg_conv.is_owned = false;
38784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38785 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
38789 jboolean __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint32_t this_arg) {
38790 LDKNodeFeatures this_arg_conv;
38791 this_arg_conv.inner = (void*)(this_arg & (~1));
38792 this_arg_conv.is_owned = false;
38793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38794 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
38798 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
38799 LDKShutdownScript this_obj_conv;
38800 this_obj_conv.inner = (void*)(this_obj & (~1));
38801 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38803 ShutdownScript_free(this_obj_conv);
38806 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
38807 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
38808 uint32_t ret_ref = 0;
38809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38812 ret_ref = (uintptr_t)ret_var.inner;
38813 if (ret_var.is_owned) {
38818 uint32_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
38819 LDKShutdownScript arg_conv;
38820 arg_conv.inner = (void*)(arg & (~1));
38821 arg_conv.is_owned = false;
38822 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38823 uint32_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
38827 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
38828 LDKShutdownScript orig_conv;
38829 orig_conv.inner = (void*)(orig & (~1));
38830 orig_conv.is_owned = false;
38831 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38832 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
38833 uint32_t ret_ref = 0;
38834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38837 ret_ref = (uintptr_t)ret_var.inner;
38838 if (ret_var.is_owned) {
38844 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
38845 LDKInvalidShutdownScript this_obj_conv;
38846 this_obj_conv.inner = (void*)(this_obj & (~1));
38847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38849 InvalidShutdownScript_free(this_obj_conv);
38852 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
38853 LDKInvalidShutdownScript this_ptr_conv;
38854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38855 this_ptr_conv.is_owned = false;
38856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38857 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
38858 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38859 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38863 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
38864 LDKInvalidShutdownScript this_ptr_conv;
38865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38866 this_ptr_conv.is_owned = false;
38867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38868 LDKCVec_u8Z val_ref;
38869 val_ref.datalen = val->arr_len;
38870 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38871 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38872 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
38875 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
38876 LDKCVec_u8Z script_arg_ref;
38877 script_arg_ref.datalen = script_arg->arr_len;
38878 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38879 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
38880 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
38881 uint32_t ret_ref = 0;
38882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38885 ret_ref = (uintptr_t)ret_var.inner;
38886 if (ret_var.is_owned) {
38892 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
38893 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
38894 uint32_t ret_ref = 0;
38895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38898 ret_ref = (uintptr_t)ret_var.inner;
38899 if (ret_var.is_owned) {
38904 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
38905 LDKInvalidShutdownScript arg_conv;
38906 arg_conv.inner = (void*)(arg & (~1));
38907 arg_conv.is_owned = false;
38908 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38909 uint32_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
38913 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
38914 LDKInvalidShutdownScript orig_conv;
38915 orig_conv.inner = (void*)(orig & (~1));
38916 orig_conv.is_owned = false;
38917 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38918 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
38919 uint32_t ret_ref = 0;
38920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38923 ret_ref = (uintptr_t)ret_var.inner;
38924 if (ret_var.is_owned) {
38930 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
38931 LDKShutdownScript obj_conv;
38932 obj_conv.inner = (void*)(obj & (~1));
38933 obj_conv.is_owned = false;
38934 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38935 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
38936 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38937 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38938 CVec_u8Z_free(ret_var);
38942 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
38943 LDKu8slice ser_ref;
38944 ser_ref.datalen = ser->arr_len;
38945 ser_ref.data = ser->elems;
38946 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
38947 *ret_conv = ShutdownScript_read(ser_ref);
38949 return (uint32_t)ret_conv;
38952 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
38953 unsigned char pubkey_hash_arr[20];
38954 CHECK(pubkey_hash->arr_len == 20);
38955 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
38956 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
38957 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
38958 uint32_t ret_ref = 0;
38959 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38960 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38962 ret_ref = (uintptr_t)ret_var.inner;
38963 if (ret_var.is_owned) {
38969 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
38970 unsigned char script_hash_arr[32];
38971 CHECK(script_hash->arr_len == 32);
38972 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
38973 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
38974 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
38975 uint32_t ret_ref = 0;
38976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38979 ret_ref = (uintptr_t)ret_var.inner;
38980 if (ret_var.is_owned) {
38986 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
38988 LDKu8slice program_ref;
38989 program_ref.datalen = program->arr_len;
38990 program_ref.data = program->elems;
38991 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
38992 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
38994 return (uint32_t)ret_conv;
38997 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
38998 LDKShutdownScript this_arg_conv;
38999 this_arg_conv.inner = (void*)(this_arg & (~1));
39000 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
39001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39002 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39003 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39004 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39005 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39006 CVec_u8Z_free(ret_var);
39010 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
39011 LDKShutdownScript this_arg_conv;
39012 this_arg_conv.inner = (void*)(this_arg & (~1));
39013 this_arg_conv.is_owned = false;
39014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39015 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39016 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
39020 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
39021 LDKShutdownScript this_arg_conv;
39022 this_arg_conv.inner = (void*)(this_arg & (~1));
39023 this_arg_conv.is_owned = false;
39024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39025 LDKInitFeatures features_conv;
39026 features_conv.inner = (void*)(features & (~1));
39027 features_conv.is_owned = false;
39028 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39029 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39033 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
39034 if ((this_ptr & 1) != 0) return;
39035 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39036 CHECK_ACCESS(this_ptr_ptr);
39037 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39038 FREE((void*)this_ptr);
39039 CustomMessageReader_free(this_ptr_conv);
39042 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39043 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39044 *ret_ret = Type_clone(arg);
39045 return (uint32_t)ret_ret;
39047 uint32_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
39048 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39049 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
39050 LDKType* arg_conv = (LDKType*)arg_ptr;
39051 uint32_t ret_conv = Type_clone_ptr(arg_conv);
39055 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
39056 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
39057 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
39058 LDKType* orig_conv = (LDKType*)orig_ptr;
39059 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39060 *ret_ret = Type_clone(orig_conv);
39061 return (uint32_t)ret_ret;
39064 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
39065 if ((this_ptr & 1) != 0) return;
39066 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39067 CHECK_ACCESS(this_ptr_ptr);
39068 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39069 FREE((void*)this_ptr);
39070 Type_free(this_ptr_conv);
39073 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
39074 LDKNodeId this_obj_conv;
39075 this_obj_conv.inner = (void*)(this_obj & (~1));
39076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39078 NodeId_free(this_obj_conv);
39081 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39082 LDKNodeId ret_var = NodeId_clone(arg);
39083 uint32_t ret_ref = 0;
39084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39087 ret_ref = (uintptr_t)ret_var.inner;
39088 if (ret_var.is_owned) {
39093 uint32_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
39094 LDKNodeId arg_conv;
39095 arg_conv.inner = (void*)(arg & (~1));
39096 arg_conv.is_owned = false;
39097 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39098 uint32_t ret_conv = NodeId_clone_ptr(&arg_conv);
39102 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
39103 LDKNodeId orig_conv;
39104 orig_conv.inner = (void*)(orig & (~1));
39105 orig_conv.is_owned = false;
39106 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39107 LDKNodeId ret_var = NodeId_clone(&orig_conv);
39108 uint32_t ret_ref = 0;
39109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39112 ret_ref = (uintptr_t)ret_var.inner;
39113 if (ret_var.is_owned) {
39119 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
39120 LDKPublicKey pubkey_ref;
39121 CHECK(pubkey->arr_len == 33);
39122 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39123 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39124 uint32_t ret_ref = 0;
39125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39128 ret_ref = (uintptr_t)ret_var.inner;
39129 if (ret_var.is_owned) {
39135 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
39136 LDKNodeId this_arg_conv;
39137 this_arg_conv.inner = (void*)(this_arg & (~1));
39138 this_arg_conv.is_owned = false;
39139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39140 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39141 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39142 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39146 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
39148 o_conv.inner = (void*)(o & (~1));
39149 o_conv.is_owned = false;
39150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39151 int64_t ret_conv = NodeId_hash(&o_conv);
39155 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
39156 LDKNodeId obj_conv;
39157 obj_conv.inner = (void*)(obj & (~1));
39158 obj_conv.is_owned = false;
39159 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39160 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39161 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39162 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39163 CVec_u8Z_free(ret_var);
39167 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
39168 LDKu8slice ser_ref;
39169 ser_ref.datalen = ser->arr_len;
39170 ser_ref.data = ser->elems;
39171 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39172 *ret_conv = NodeId_read(ser_ref);
39174 return (uint32_t)ret_conv;
39177 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
39178 LDKNetworkGraph this_obj_conv;
39179 this_obj_conv.inner = (void*)(this_obj & (~1));
39180 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39182 NetworkGraph_free(this_obj_conv);
39185 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
39186 LDKReadOnlyNetworkGraph this_obj_conv;
39187 this_obj_conv.inner = (void*)(this_obj & (~1));
39188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39190 ReadOnlyNetworkGraph_free(this_obj_conv);
39193 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
39194 if ((this_ptr & 1) != 0) return;
39195 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39196 CHECK_ACCESS(this_ptr_ptr);
39197 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39198 FREE((void*)this_ptr);
39199 NetworkUpdate_free(this_ptr_conv);
39202 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39203 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39204 *ret_copy = NetworkUpdate_clone(arg);
39205 uint32_t ret_ref = (uintptr_t)ret_copy;
39208 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
39209 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
39210 uint32_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
39214 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
39215 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
39216 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39217 *ret_copy = NetworkUpdate_clone(orig_conv);
39218 uint32_t ret_ref = (uintptr_t)ret_copy;
39222 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
39223 LDKChannelUpdate msg_conv;
39224 msg_conv.inner = (void*)(msg & (~1));
39225 msg_conv.is_owned = (msg & 1) || (msg == 0);
39226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39227 msg_conv = ChannelUpdate_clone(&msg_conv);
39228 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39229 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39230 uint32_t ret_ref = (uintptr_t)ret_copy;
39234 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
39235 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39236 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
39237 uint32_t ret_ref = (uintptr_t)ret_copy;
39241 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
39242 LDKPublicKey node_id_ref;
39243 CHECK(node_id->arr_len == 33);
39244 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
39245 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39246 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39247 uint32_t ret_ref = (uintptr_t)ret_copy;
39251 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
39252 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
39253 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39254 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39255 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39256 CVec_u8Z_free(ret_var);
39260 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
39261 LDKu8slice ser_ref;
39262 ser_ref.datalen = ser->arr_len;
39263 ser_ref.data = ser->elems;
39264 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39265 *ret_conv = NetworkUpdate_read(ser_ref);
39267 return (uint32_t)ret_conv;
39270 void __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint32_t this_obj) {
39271 LDKP2PGossipSync this_obj_conv;
39272 this_obj_conv.inner = (void*)(this_obj & (~1));
39273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39275 P2PGossipSync_free(this_obj_conv);
39278 uint32_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
39279 LDKNetworkGraph network_graph_conv;
39280 network_graph_conv.inner = (void*)(network_graph & (~1));
39281 network_graph_conv.is_owned = false;
39282 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39283 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39284 CHECK_ACCESS(chain_access_ptr);
39285 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39286 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39287 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39288 // Manually implement clone for Java trait instances
39289 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39291 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39294 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39295 CHECK_ACCESS(logger_ptr);
39296 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39297 if (logger_conv.free == LDKLogger_JCalls_free) {
39298 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39299 LDKLogger_JCalls_cloned(&logger_conv);
39301 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
39302 uint32_t ret_ref = 0;
39303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39306 ret_ref = (uintptr_t)ret_var.inner;
39307 if (ret_var.is_owned) {
39313 void __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
39314 LDKP2PGossipSync this_arg_conv;
39315 this_arg_conv.inner = (void*)(this_arg & (~1));
39316 this_arg_conv.is_owned = false;
39317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39318 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39319 CHECK_ACCESS(chain_access_ptr);
39320 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39321 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39322 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39323 // Manually implement clone for Java trait instances
39324 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39326 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39329 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
39332 uint32_t __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint32_t this_arg) {
39333 LDKNetworkGraph this_arg_conv;
39334 this_arg_conv.inner = (void*)(this_arg & (~1));
39335 this_arg_conv.is_owned = false;
39336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39337 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39338 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
39339 return (uint32_t)ret_ret;
39342 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint32_t this_arg) {
39343 LDKP2PGossipSync this_arg_conv;
39344 this_arg_conv.inner = (void*)(this_arg & (~1));
39345 this_arg_conv.is_owned = false;
39346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39347 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39348 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
39349 return (uint32_t)ret_ret;
39352 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint32_t this_arg) {
39353 LDKP2PGossipSync this_arg_conv;
39354 this_arg_conv.inner = (void*)(this_arg & (~1));
39355 this_arg_conv.is_owned = false;
39356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39357 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39358 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
39359 return (uint32_t)ret_ret;
39362 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
39363 LDKChannelUpdateInfo this_obj_conv;
39364 this_obj_conv.inner = (void*)(this_obj & (~1));
39365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39367 ChannelUpdateInfo_free(this_obj_conv);
39370 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
39371 LDKChannelUpdateInfo this_ptr_conv;
39372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39373 this_ptr_conv.is_owned = false;
39374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39375 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39379 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
39380 LDKChannelUpdateInfo this_ptr_conv;
39381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39382 this_ptr_conv.is_owned = false;
39383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39384 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39387 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
39388 LDKChannelUpdateInfo this_ptr_conv;
39389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39390 this_ptr_conv.is_owned = false;
39391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39392 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39396 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
39397 LDKChannelUpdateInfo this_ptr_conv;
39398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39399 this_ptr_conv.is_owned = false;
39400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39401 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39404 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
39405 LDKChannelUpdateInfo this_ptr_conv;
39406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39407 this_ptr_conv.is_owned = false;
39408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39409 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39413 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
39414 LDKChannelUpdateInfo this_ptr_conv;
39415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39416 this_ptr_conv.is_owned = false;
39417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39418 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39421 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
39422 LDKChannelUpdateInfo this_ptr_conv;
39423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39424 this_ptr_conv.is_owned = false;
39425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39426 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39430 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
39431 LDKChannelUpdateInfo this_ptr_conv;
39432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39433 this_ptr_conv.is_owned = false;
39434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39435 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
39438 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
39439 LDKChannelUpdateInfo this_ptr_conv;
39440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39441 this_ptr_conv.is_owned = false;
39442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39443 int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
39447 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, int64_t val) {
39448 LDKChannelUpdateInfo this_ptr_conv;
39449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39450 this_ptr_conv.is_owned = false;
39451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39452 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
39455 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
39456 LDKChannelUpdateInfo this_ptr_conv;
39457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39458 this_ptr_conv.is_owned = false;
39459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39460 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
39461 uint32_t ret_ref = 0;
39462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39465 ret_ref = (uintptr_t)ret_var.inner;
39466 if (ret_var.is_owned) {
39472 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
39473 LDKChannelUpdateInfo this_ptr_conv;
39474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39475 this_ptr_conv.is_owned = false;
39476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39477 LDKRoutingFees val_conv;
39478 val_conv.inner = (void*)(val & (~1));
39479 val_conv.is_owned = (val & 1) || (val == 0);
39480 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39481 val_conv = RoutingFees_clone(&val_conv);
39482 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
39485 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
39486 LDKChannelUpdateInfo this_ptr_conv;
39487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39488 this_ptr_conv.is_owned = false;
39489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39490 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
39491 uint32_t ret_ref = 0;
39492 if ((uintptr_t)ret_var.inner > 4096) {
39493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39496 ret_ref = (uintptr_t)ret_var.inner;
39497 if (ret_var.is_owned) {
39504 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
39505 LDKChannelUpdateInfo this_ptr_conv;
39506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39507 this_ptr_conv.is_owned = false;
39508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39509 LDKChannelUpdate val_conv;
39510 val_conv.inner = (void*)(val & (~1));
39511 val_conv.is_owned = (val & 1) || (val == 0);
39512 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39513 val_conv = ChannelUpdate_clone(&val_conv);
39514 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
39517 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, int64_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
39518 LDKRoutingFees fees_arg_conv;
39519 fees_arg_conv.inner = (void*)(fees_arg & (~1));
39520 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
39521 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39522 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39523 LDKChannelUpdate last_update_message_arg_conv;
39524 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
39525 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
39526 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
39527 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
39528 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
39529 uint32_t ret_ref = 0;
39530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39533 ret_ref = (uintptr_t)ret_var.inner;
39534 if (ret_var.is_owned) {
39540 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
39541 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
39542 uint32_t ret_ref = 0;
39543 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39544 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39546 ret_ref = (uintptr_t)ret_var.inner;
39547 if (ret_var.is_owned) {
39552 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
39553 LDKChannelUpdateInfo arg_conv;
39554 arg_conv.inner = (void*)(arg & (~1));
39555 arg_conv.is_owned = false;
39556 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39557 uint32_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
39561 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
39562 LDKChannelUpdateInfo orig_conv;
39563 orig_conv.inner = (void*)(orig & (~1));
39564 orig_conv.is_owned = false;
39565 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39566 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
39567 uint32_t ret_ref = 0;
39568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39571 ret_ref = (uintptr_t)ret_var.inner;
39572 if (ret_var.is_owned) {
39578 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
39579 LDKChannelUpdateInfo obj_conv;
39580 obj_conv.inner = (void*)(obj & (~1));
39581 obj_conv.is_owned = false;
39582 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39583 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
39584 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39585 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39586 CVec_u8Z_free(ret_var);
39590 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
39591 LDKu8slice ser_ref;
39592 ser_ref.datalen = ser->arr_len;
39593 ser_ref.data = ser->elems;
39594 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
39595 *ret_conv = ChannelUpdateInfo_read(ser_ref);
39597 return (uint32_t)ret_conv;
39600 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
39601 LDKChannelInfo this_obj_conv;
39602 this_obj_conv.inner = (void*)(this_obj & (~1));
39603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39605 ChannelInfo_free(this_obj_conv);
39608 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
39609 LDKChannelInfo this_ptr_conv;
39610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39611 this_ptr_conv.is_owned = false;
39612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39613 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
39614 uint32_t ret_ref = 0;
39615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39618 ret_ref = (uintptr_t)ret_var.inner;
39619 if (ret_var.is_owned) {
39625 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
39626 LDKChannelInfo this_ptr_conv;
39627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39628 this_ptr_conv.is_owned = false;
39629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39630 LDKChannelFeatures val_conv;
39631 val_conv.inner = (void*)(val & (~1));
39632 val_conv.is_owned = (val & 1) || (val == 0);
39633 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39634 val_conv = ChannelFeatures_clone(&val_conv);
39635 ChannelInfo_set_features(&this_ptr_conv, val_conv);
39638 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
39639 LDKChannelInfo this_ptr_conv;
39640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39641 this_ptr_conv.is_owned = false;
39642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39643 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
39644 uint32_t ret_ref = 0;
39645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39648 ret_ref = (uintptr_t)ret_var.inner;
39649 if (ret_var.is_owned) {
39655 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
39656 LDKChannelInfo this_ptr_conv;
39657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39658 this_ptr_conv.is_owned = false;
39659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39660 LDKNodeId val_conv;
39661 val_conv.inner = (void*)(val & (~1));
39662 val_conv.is_owned = (val & 1) || (val == 0);
39663 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39664 val_conv = NodeId_clone(&val_conv);
39665 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
39668 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
39669 LDKChannelInfo this_ptr_conv;
39670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39671 this_ptr_conv.is_owned = false;
39672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39673 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
39674 uint32_t ret_ref = 0;
39675 if ((uintptr_t)ret_var.inner > 4096) {
39676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39679 ret_ref = (uintptr_t)ret_var.inner;
39680 if (ret_var.is_owned) {
39687 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
39688 LDKChannelInfo this_ptr_conv;
39689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39690 this_ptr_conv.is_owned = false;
39691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39692 LDKChannelUpdateInfo val_conv;
39693 val_conv.inner = (void*)(val & (~1));
39694 val_conv.is_owned = (val & 1) || (val == 0);
39695 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39696 val_conv = ChannelUpdateInfo_clone(&val_conv);
39697 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
39700 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
39701 LDKChannelInfo this_ptr_conv;
39702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39703 this_ptr_conv.is_owned = false;
39704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39705 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
39706 uint32_t ret_ref = 0;
39707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39710 ret_ref = (uintptr_t)ret_var.inner;
39711 if (ret_var.is_owned) {
39717 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
39718 LDKChannelInfo this_ptr_conv;
39719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39720 this_ptr_conv.is_owned = false;
39721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39722 LDKNodeId val_conv;
39723 val_conv.inner = (void*)(val & (~1));
39724 val_conv.is_owned = (val & 1) || (val == 0);
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39726 val_conv = NodeId_clone(&val_conv);
39727 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
39730 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
39731 LDKChannelInfo this_ptr_conv;
39732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39733 this_ptr_conv.is_owned = false;
39734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39735 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
39736 uint32_t ret_ref = 0;
39737 if ((uintptr_t)ret_var.inner > 4096) {
39738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39741 ret_ref = (uintptr_t)ret_var.inner;
39742 if (ret_var.is_owned) {
39749 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
39750 LDKChannelInfo this_ptr_conv;
39751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39752 this_ptr_conv.is_owned = false;
39753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39754 LDKChannelUpdateInfo val_conv;
39755 val_conv.inner = (void*)(val & (~1));
39756 val_conv.is_owned = (val & 1) || (val == 0);
39757 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39758 val_conv = ChannelUpdateInfo_clone(&val_conv);
39759 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
39762 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
39763 LDKChannelInfo this_ptr_conv;
39764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39765 this_ptr_conv.is_owned = false;
39766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39767 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39768 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
39769 uint32_t ret_ref = (uintptr_t)ret_copy;
39773 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
39774 LDKChannelInfo this_ptr_conv;
39775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39776 this_ptr_conv.is_owned = false;
39777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39778 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39779 CHECK_ACCESS(val_ptr);
39780 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39781 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39782 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
39785 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
39786 LDKChannelInfo this_ptr_conv;
39787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39788 this_ptr_conv.is_owned = false;
39789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39790 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
39791 uint32_t ret_ref = 0;
39792 if ((uintptr_t)ret_var.inner > 4096) {
39793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39796 ret_ref = (uintptr_t)ret_var.inner;
39797 if (ret_var.is_owned) {
39804 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
39805 LDKChannelInfo this_ptr_conv;
39806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39807 this_ptr_conv.is_owned = false;
39808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39809 LDKChannelAnnouncement val_conv;
39810 val_conv.inner = (void*)(val & (~1));
39811 val_conv.is_owned = (val & 1) || (val == 0);
39812 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39813 val_conv = ChannelAnnouncement_clone(&val_conv);
39814 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
39817 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
39818 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
39819 uint32_t ret_ref = 0;
39820 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39821 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39823 ret_ref = (uintptr_t)ret_var.inner;
39824 if (ret_var.is_owned) {
39829 uint32_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
39830 LDKChannelInfo arg_conv;
39831 arg_conv.inner = (void*)(arg & (~1));
39832 arg_conv.is_owned = false;
39833 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39834 uint32_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
39838 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
39839 LDKChannelInfo orig_conv;
39840 orig_conv.inner = (void*)(orig & (~1));
39841 orig_conv.is_owned = false;
39842 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39843 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
39844 uint32_t ret_ref = 0;
39845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39848 ret_ref = (uintptr_t)ret_var.inner;
39849 if (ret_var.is_owned) {
39855 uint32_t __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint32_t this_arg, int8_t channel_flags) {
39856 LDKChannelInfo this_arg_conv;
39857 this_arg_conv.inner = (void*)(this_arg & (~1));
39858 this_arg_conv.is_owned = false;
39859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39860 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
39861 uint32_t ret_ref = 0;
39862 if ((uintptr_t)ret_var.inner > 4096) {
39863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39866 ret_ref = (uintptr_t)ret_var.inner;
39867 if (ret_var.is_owned) {
39874 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
39875 LDKChannelInfo obj_conv;
39876 obj_conv.inner = (void*)(obj & (~1));
39877 obj_conv.is_owned = false;
39878 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39879 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
39880 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39881 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39882 CVec_u8Z_free(ret_var);
39886 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
39887 LDKu8slice ser_ref;
39888 ser_ref.datalen = ser->arr_len;
39889 ser_ref.data = ser->elems;
39890 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
39891 *ret_conv = ChannelInfo_read(ser_ref);
39893 return (uint32_t)ret_conv;
39896 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
39897 LDKDirectedChannelInfo this_obj_conv;
39898 this_obj_conv.inner = (void*)(this_obj & (~1));
39899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39901 DirectedChannelInfo_free(this_obj_conv);
39904 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
39905 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
39906 uint32_t ret_ref = 0;
39907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39910 ret_ref = (uintptr_t)ret_var.inner;
39911 if (ret_var.is_owned) {
39916 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
39917 LDKDirectedChannelInfo arg_conv;
39918 arg_conv.inner = (void*)(arg & (~1));
39919 arg_conv.is_owned = false;
39920 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39921 uint32_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
39925 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
39926 LDKDirectedChannelInfo orig_conv;
39927 orig_conv.inner = (void*)(orig & (~1));
39928 orig_conv.is_owned = false;
39929 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39930 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
39931 uint32_t ret_ref = 0;
39932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39935 ret_ref = (uintptr_t)ret_var.inner;
39936 if (ret_var.is_owned) {
39942 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
39943 LDKDirectedChannelInfo this_arg_conv;
39944 this_arg_conv.inner = (void*)(this_arg & (~1));
39945 this_arg_conv.is_owned = false;
39946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39947 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
39948 uint32_t ret_ref = 0;
39949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39952 ret_ref = (uintptr_t)ret_var.inner;
39953 if (ret_var.is_owned) {
39959 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
39960 LDKDirectedChannelInfo this_arg_conv;
39961 this_arg_conv.inner = (void*)(this_arg & (~1));
39962 this_arg_conv.is_owned = false;
39963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39964 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
39965 uint32_t ret_ref = 0;
39966 if ((uintptr_t)ret_var.inner > 4096) {
39967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39970 ret_ref = (uintptr_t)ret_var.inner;
39971 if (ret_var.is_owned) {
39978 int64_t __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint32_t this_arg) {
39979 LDKDirectedChannelInfo this_arg_conv;
39980 this_arg_conv.inner = (void*)(this_arg & (~1));
39981 this_arg_conv.is_owned = false;
39982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39983 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
39987 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
39988 LDKDirectedChannelInfo this_arg_conv;
39989 this_arg_conv.inner = (void*)(this_arg & (~1));
39990 this_arg_conv.is_owned = false;
39991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39992 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39993 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
39994 uint32_t ret_ref = (uintptr_t)ret_copy;
39998 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
39999 if ((this_ptr & 1) != 0) return;
40000 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40001 CHECK_ACCESS(this_ptr_ptr);
40002 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40003 FREE((void*)this_ptr);
40004 EffectiveCapacity_free(this_ptr_conv);
40007 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40008 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40009 *ret_copy = EffectiveCapacity_clone(arg);
40010 uint32_t ret_ref = (uintptr_t)ret_copy;
40013 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
40014 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
40015 uint32_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
40019 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
40020 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
40021 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40022 *ret_copy = EffectiveCapacity_clone(orig_conv);
40023 uint32_t ret_ref = (uintptr_t)ret_copy;
40027 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
40028 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40029 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40030 uint32_t ret_ref = (uintptr_t)ret_copy;
40034 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
40035 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40036 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40037 uint32_t ret_ref = (uintptr_t)ret_copy;
40041 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint32_t htlc_maximum_msat) {
40042 void* htlc_maximum_msat_ptr = (void*)(((uintptr_t)htlc_maximum_msat) & ~1);
40043 CHECK_ACCESS(htlc_maximum_msat_ptr);
40044 LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
40045 htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat) & ~1));
40046 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40047 *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
40048 uint32_t ret_ref = (uintptr_t)ret_copy;
40052 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
40053 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40054 *ret_copy = EffectiveCapacity_infinite();
40055 uint32_t ret_ref = (uintptr_t)ret_copy;
40059 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
40060 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40061 *ret_copy = EffectiveCapacity_unknown();
40062 uint32_t ret_ref = (uintptr_t)ret_copy;
40066 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
40067 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
40068 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
40072 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
40073 LDKRoutingFees this_obj_conv;
40074 this_obj_conv.inner = (void*)(this_obj & (~1));
40075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40077 RoutingFees_free(this_obj_conv);
40080 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
40081 LDKRoutingFees this_ptr_conv;
40082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40083 this_ptr_conv.is_owned = false;
40084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40085 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
40089 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
40090 LDKRoutingFees this_ptr_conv;
40091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40092 this_ptr_conv.is_owned = false;
40093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40094 RoutingFees_set_base_msat(&this_ptr_conv, val);
40097 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
40098 LDKRoutingFees this_ptr_conv;
40099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40100 this_ptr_conv.is_owned = false;
40101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40102 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40106 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
40107 LDKRoutingFees this_ptr_conv;
40108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40109 this_ptr_conv.is_owned = false;
40110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40111 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40114 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
40115 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40116 uint32_t ret_ref = 0;
40117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40120 ret_ref = (uintptr_t)ret_var.inner;
40121 if (ret_var.is_owned) {
40127 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
40128 LDKRoutingFees a_conv;
40129 a_conv.inner = (void*)(a & (~1));
40130 a_conv.is_owned = false;
40131 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40132 LDKRoutingFees b_conv;
40133 b_conv.inner = (void*)(b & (~1));
40134 b_conv.is_owned = false;
40135 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40136 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
40140 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40141 LDKRoutingFees ret_var = RoutingFees_clone(arg);
40142 uint32_t ret_ref = 0;
40143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40146 ret_ref = (uintptr_t)ret_var.inner;
40147 if (ret_var.is_owned) {
40152 uint32_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
40153 LDKRoutingFees arg_conv;
40154 arg_conv.inner = (void*)(arg & (~1));
40155 arg_conv.is_owned = false;
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40157 uint32_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
40161 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
40162 LDKRoutingFees orig_conv;
40163 orig_conv.inner = (void*)(orig & (~1));
40164 orig_conv.is_owned = false;
40165 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40166 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40167 uint32_t ret_ref = 0;
40168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40171 ret_ref = (uintptr_t)ret_var.inner;
40172 if (ret_var.is_owned) {
40178 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
40179 LDKRoutingFees o_conv;
40180 o_conv.inner = (void*)(o & (~1));
40181 o_conv.is_owned = false;
40182 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40183 int64_t ret_conv = RoutingFees_hash(&o_conv);
40187 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
40188 LDKRoutingFees obj_conv;
40189 obj_conv.inner = (void*)(obj & (~1));
40190 obj_conv.is_owned = false;
40191 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40192 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40193 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40194 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40195 CVec_u8Z_free(ret_var);
40199 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
40200 LDKu8slice ser_ref;
40201 ser_ref.datalen = ser->arr_len;
40202 ser_ref.data = ser->elems;
40203 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40204 *ret_conv = RoutingFees_read(ser_ref);
40206 return (uint32_t)ret_conv;
40209 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
40210 LDKNodeAnnouncementInfo this_obj_conv;
40211 this_obj_conv.inner = (void*)(this_obj & (~1));
40212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40214 NodeAnnouncementInfo_free(this_obj_conv);
40217 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
40218 LDKNodeAnnouncementInfo this_ptr_conv;
40219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40220 this_ptr_conv.is_owned = false;
40221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40222 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40223 uint32_t ret_ref = 0;
40224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40227 ret_ref = (uintptr_t)ret_var.inner;
40228 if (ret_var.is_owned) {
40234 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
40235 LDKNodeAnnouncementInfo this_ptr_conv;
40236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40237 this_ptr_conv.is_owned = false;
40238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40239 LDKNodeFeatures val_conv;
40240 val_conv.inner = (void*)(val & (~1));
40241 val_conv.is_owned = (val & 1) || (val == 0);
40242 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40243 val_conv = NodeFeatures_clone(&val_conv);
40244 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40247 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
40248 LDKNodeAnnouncementInfo this_ptr_conv;
40249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40250 this_ptr_conv.is_owned = false;
40251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40252 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40256 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
40257 LDKNodeAnnouncementInfo this_ptr_conv;
40258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40259 this_ptr_conv.is_owned = false;
40260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40261 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40264 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
40265 LDKNodeAnnouncementInfo this_ptr_conv;
40266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40267 this_ptr_conv.is_owned = false;
40268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40269 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
40270 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
40274 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
40275 LDKNodeAnnouncementInfo this_ptr_conv;
40276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40277 this_ptr_conv.is_owned = false;
40278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40279 LDKThreeBytes val_ref;
40280 CHECK(val->arr_len == 3);
40281 memcpy(val_ref.data, val->elems, 3); FREE(val);
40282 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40285 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
40286 LDKNodeAnnouncementInfo this_ptr_conv;
40287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40288 this_ptr_conv.is_owned = false;
40289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40290 LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
40291 uint32_t ret_ref = 0;
40292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40295 ret_ref = (uintptr_t)ret_var.inner;
40296 if (ret_var.is_owned) {
40302 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, uint32_t val) {
40303 LDKNodeAnnouncementInfo this_ptr_conv;
40304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40305 this_ptr_conv.is_owned = false;
40306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40307 LDKNodeAlias val_conv;
40308 val_conv.inner = (void*)(val & (~1));
40309 val_conv.is_owned = (val & 1) || (val == 0);
40310 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40311 val_conv = NodeAlias_clone(&val_conv);
40312 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
40315 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
40316 LDKNodeAnnouncementInfo this_ptr_conv;
40317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40318 this_ptr_conv.is_owned = false;
40319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40320 LDKCVec_NetAddressZ val_constr;
40321 val_constr.datalen = val->arr_len;
40322 if (val_constr.datalen > 0)
40323 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40325 val_constr.data = NULL;
40326 uint32_t* val_vals = val->elems;
40327 for (size_t m = 0; m < val_constr.datalen; m++) {
40328 uint32_t val_conv_12 = val_vals[m];
40329 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
40330 CHECK_ACCESS(val_conv_12_ptr);
40331 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40332 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
40333 val_constr.data[m] = val_conv_12_conv;
40336 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40339 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
40340 LDKNodeAnnouncementInfo this_ptr_conv;
40341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40342 this_ptr_conv.is_owned = false;
40343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40344 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40345 uint32_t ret_ref = 0;
40346 if ((uintptr_t)ret_var.inner > 4096) {
40347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40350 ret_ref = (uintptr_t)ret_var.inner;
40351 if (ret_var.is_owned) {
40358 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
40359 LDKNodeAnnouncementInfo this_ptr_conv;
40360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40361 this_ptr_conv.is_owned = false;
40362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40363 LDKNodeAnnouncement val_conv;
40364 val_conv.inner = (void*)(val & (~1));
40365 val_conv.is_owned = (val & 1) || (val == 0);
40366 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40367 val_conv = NodeAnnouncement_clone(&val_conv);
40368 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40371 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, uint32_t alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
40372 LDKNodeFeatures features_arg_conv;
40373 features_arg_conv.inner = (void*)(features_arg & (~1));
40374 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40375 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40376 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40377 LDKThreeBytes rgb_arg_ref;
40378 CHECK(rgb_arg->arr_len == 3);
40379 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
40380 LDKNodeAlias alias_arg_conv;
40381 alias_arg_conv.inner = (void*)(alias_arg & (~1));
40382 alias_arg_conv.is_owned = (alias_arg & 1) || (alias_arg == 0);
40383 CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
40384 alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
40385 LDKCVec_NetAddressZ addresses_arg_constr;
40386 addresses_arg_constr.datalen = addresses_arg->arr_len;
40387 if (addresses_arg_constr.datalen > 0)
40388 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40390 addresses_arg_constr.data = NULL;
40391 uint32_t* addresses_arg_vals = addresses_arg->elems;
40392 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40393 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
40394 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
40395 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40396 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40397 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40399 FREE(addresses_arg);
40400 LDKNodeAnnouncement announcement_message_arg_conv;
40401 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
40402 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
40403 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40404 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40405 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
40406 uint32_t ret_ref = 0;
40407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40410 ret_ref = (uintptr_t)ret_var.inner;
40411 if (ret_var.is_owned) {
40417 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40418 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40419 uint32_t ret_ref = 0;
40420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40423 ret_ref = (uintptr_t)ret_var.inner;
40424 if (ret_var.is_owned) {
40429 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
40430 LDKNodeAnnouncementInfo arg_conv;
40431 arg_conv.inner = (void*)(arg & (~1));
40432 arg_conv.is_owned = false;
40433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40434 uint32_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40438 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
40439 LDKNodeAnnouncementInfo orig_conv;
40440 orig_conv.inner = (void*)(orig & (~1));
40441 orig_conv.is_owned = false;
40442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40443 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40444 uint32_t ret_ref = 0;
40445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40448 ret_ref = (uintptr_t)ret_var.inner;
40449 if (ret_var.is_owned) {
40455 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
40456 LDKNodeAnnouncementInfo obj_conv;
40457 obj_conv.inner = (void*)(obj & (~1));
40458 obj_conv.is_owned = false;
40459 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40460 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40461 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40462 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40463 CVec_u8Z_free(ret_var);
40467 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
40468 LDKu8slice ser_ref;
40469 ser_ref.datalen = ser->arr_len;
40470 ser_ref.data = ser->elems;
40471 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
40472 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
40474 return (uint32_t)ret_conv;
40477 void __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint32_t this_obj) {
40478 LDKNodeAlias this_obj_conv;
40479 this_obj_conv.inner = (void*)(this_obj & (~1));
40480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40482 NodeAlias_free(this_obj_conv);
40485 int8_tArray __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint32_t this_ptr) {
40486 LDKNodeAlias this_ptr_conv;
40487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40488 this_ptr_conv.is_owned = false;
40489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40490 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40491 memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
40495 void __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint32_t this_ptr, int8_tArray val) {
40496 LDKNodeAlias this_ptr_conv;
40497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40498 this_ptr_conv.is_owned = false;
40499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40500 LDKThirtyTwoBytes val_ref;
40501 CHECK(val->arr_len == 32);
40502 memcpy(val_ref.data, val->elems, 32); FREE(val);
40503 NodeAlias_set_a(&this_ptr_conv, val_ref);
40506 uint32_t __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
40507 LDKThirtyTwoBytes a_arg_ref;
40508 CHECK(a_arg->arr_len == 32);
40509 memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
40510 LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
40511 uint32_t ret_ref = 0;
40512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40515 ret_ref = (uintptr_t)ret_var.inner;
40516 if (ret_var.is_owned) {
40522 static inline uintptr_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
40523 LDKNodeAlias ret_var = NodeAlias_clone(arg);
40524 uint32_t ret_ref = 0;
40525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40528 ret_ref = (uintptr_t)ret_var.inner;
40529 if (ret_var.is_owned) {
40534 uint32_t __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint32_t arg) {
40535 LDKNodeAlias arg_conv;
40536 arg_conv.inner = (void*)(arg & (~1));
40537 arg_conv.is_owned = false;
40538 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40539 uint32_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
40543 uint32_t __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint32_t orig) {
40544 LDKNodeAlias orig_conv;
40545 orig_conv.inner = (void*)(orig & (~1));
40546 orig_conv.is_owned = false;
40547 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40548 LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
40549 uint32_t ret_ref = 0;
40550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40553 ret_ref = (uintptr_t)ret_var.inner;
40554 if (ret_var.is_owned) {
40560 int8_tArray __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint32_t obj) {
40561 LDKNodeAlias obj_conv;
40562 obj_conv.inner = (void*)(obj & (~1));
40563 obj_conv.is_owned = false;
40564 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40565 LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
40566 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40567 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40568 CVec_u8Z_free(ret_var);
40572 uint32_t __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
40573 LDKu8slice ser_ref;
40574 ser_ref.datalen = ser->arr_len;
40575 ser_ref.data = ser->elems;
40576 LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
40577 *ret_conv = NodeAlias_read(ser_ref);
40579 return (uint32_t)ret_conv;
40582 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
40583 LDKNodeInfo this_obj_conv;
40584 this_obj_conv.inner = (void*)(this_obj & (~1));
40585 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40587 NodeInfo_free(this_obj_conv);
40590 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
40591 LDKNodeInfo this_ptr_conv;
40592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40593 this_ptr_conv.is_owned = false;
40594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40595 LDKCVec_u64Z val_constr;
40596 val_constr.datalen = val->arr_len;
40597 if (val_constr.datalen > 0)
40598 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40600 val_constr.data = NULL;
40601 int64_t* val_vals = val->elems;
40602 for (size_t i = 0; i < val_constr.datalen; i++) {
40603 int64_t val_conv_8 = val_vals[i];
40604 val_constr.data[i] = val_conv_8;
40607 NodeInfo_set_channels(&this_ptr_conv, val_constr);
40610 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
40611 LDKNodeInfo this_ptr_conv;
40612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40613 this_ptr_conv.is_owned = false;
40614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40615 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
40616 uint32_t ret_ref = 0;
40617 if ((uintptr_t)ret_var.inner > 4096) {
40618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40621 ret_ref = (uintptr_t)ret_var.inner;
40622 if (ret_var.is_owned) {
40629 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) {
40630 LDKNodeInfo this_ptr_conv;
40631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40632 this_ptr_conv.is_owned = false;
40633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40634 LDKRoutingFees val_conv;
40635 val_conv.inner = (void*)(val & (~1));
40636 val_conv.is_owned = (val & 1) || (val == 0);
40637 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40638 val_conv = RoutingFees_clone(&val_conv);
40639 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
40642 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
40643 LDKNodeInfo this_ptr_conv;
40644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40645 this_ptr_conv.is_owned = false;
40646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40647 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
40648 uint32_t ret_ref = 0;
40649 if ((uintptr_t)ret_var.inner > 4096) {
40650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40653 ret_ref = (uintptr_t)ret_var.inner;
40654 if (ret_var.is_owned) {
40661 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
40662 LDKNodeInfo this_ptr_conv;
40663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40664 this_ptr_conv.is_owned = false;
40665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40666 LDKNodeAnnouncementInfo val_conv;
40667 val_conv.inner = (void*)(val & (~1));
40668 val_conv.is_owned = (val & 1) || (val == 0);
40669 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40670 val_conv = NodeAnnouncementInfo_clone(&val_conv);
40671 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
40674 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) {
40675 LDKCVec_u64Z channels_arg_constr;
40676 channels_arg_constr.datalen = channels_arg->arr_len;
40677 if (channels_arg_constr.datalen > 0)
40678 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40680 channels_arg_constr.data = NULL;
40681 int64_t* channels_arg_vals = channels_arg->elems;
40682 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
40683 int64_t channels_arg_conv_8 = channels_arg_vals[i];
40684 channels_arg_constr.data[i] = channels_arg_conv_8;
40686 FREE(channels_arg);
40687 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
40688 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
40689 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
40690 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
40691 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
40692 LDKNodeAnnouncementInfo announcement_info_arg_conv;
40693 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
40694 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
40695 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
40696 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
40697 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
40698 uint32_t ret_ref = 0;
40699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40702 ret_ref = (uintptr_t)ret_var.inner;
40703 if (ret_var.is_owned) {
40709 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
40710 LDKNodeInfo ret_var = NodeInfo_clone(arg);
40711 uint32_t ret_ref = 0;
40712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40715 ret_ref = (uintptr_t)ret_var.inner;
40716 if (ret_var.is_owned) {
40721 uint32_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
40722 LDKNodeInfo arg_conv;
40723 arg_conv.inner = (void*)(arg & (~1));
40724 arg_conv.is_owned = false;
40725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40726 uint32_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
40730 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
40731 LDKNodeInfo orig_conv;
40732 orig_conv.inner = (void*)(orig & (~1));
40733 orig_conv.is_owned = false;
40734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40735 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
40736 uint32_t ret_ref = 0;
40737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40740 ret_ref = (uintptr_t)ret_var.inner;
40741 if (ret_var.is_owned) {
40747 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
40748 LDKNodeInfo obj_conv;
40749 obj_conv.inner = (void*)(obj & (~1));
40750 obj_conv.is_owned = false;
40751 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40752 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
40753 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40754 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40755 CVec_u8Z_free(ret_var);
40759 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
40760 LDKu8slice ser_ref;
40761 ser_ref.datalen = ser->arr_len;
40762 ser_ref.data = ser->elems;
40763 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
40764 *ret_conv = NodeInfo_read(ser_ref);
40766 return (uint32_t)ret_conv;
40769 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
40770 LDKNetworkGraph obj_conv;
40771 obj_conv.inner = (void*)(obj & (~1));
40772 obj_conv.is_owned = false;
40773 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40774 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
40775 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40776 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40777 CVec_u8Z_free(ret_var);
40781 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint32_t arg) {
40782 LDKu8slice ser_ref;
40783 ser_ref.datalen = ser->arr_len;
40784 ser_ref.data = ser->elems;
40785 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
40786 CHECK_ACCESS(arg_ptr);
40787 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
40788 if (arg_conv.free == LDKLogger_JCalls_free) {
40789 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40790 LDKLogger_JCalls_cloned(&arg_conv);
40792 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
40793 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
40795 return (uint32_t)ret_conv;
40798 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint32_t logger) {
40799 LDKThirtyTwoBytes genesis_hash_ref;
40800 CHECK(genesis_hash->arr_len == 32);
40801 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
40802 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
40803 CHECK_ACCESS(logger_ptr);
40804 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40805 if (logger_conv.free == LDKLogger_JCalls_free) {
40806 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40807 LDKLogger_JCalls_cloned(&logger_conv);
40809 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
40810 uint32_t ret_ref = 0;
40811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40814 ret_ref = (uintptr_t)ret_var.inner;
40815 if (ret_var.is_owned) {
40821 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
40822 LDKNetworkGraph this_arg_conv;
40823 this_arg_conv.inner = (void*)(this_arg & (~1));
40824 this_arg_conv.is_owned = false;
40825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40826 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
40827 uint32_t ret_ref = 0;
40828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40831 ret_ref = (uintptr_t)ret_var.inner;
40832 if (ret_var.is_owned) {
40838 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) {
40839 LDKNetworkGraph this_arg_conv;
40840 this_arg_conv.inner = (void*)(this_arg & (~1));
40841 this_arg_conv.is_owned = false;
40842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40843 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
40844 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
40845 uint32_t ret_ref = (uintptr_t)ret_copy;
40849 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) {
40850 LDKNetworkGraph this_arg_conv;
40851 this_arg_conv.inner = (void*)(this_arg & (~1));
40852 this_arg_conv.is_owned = false;
40853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40854 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
40857 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
40858 LDKNetworkGraph this_arg_conv;
40859 this_arg_conv.inner = (void*)(this_arg & (~1));
40860 this_arg_conv.is_owned = false;
40861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40862 LDKNodeAnnouncement msg_conv;
40863 msg_conv.inner = (void*)(msg & (~1));
40864 msg_conv.is_owned = false;
40865 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40866 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40867 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
40868 return (uint32_t)ret_conv;
40871 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) {
40872 LDKNetworkGraph this_arg_conv;
40873 this_arg_conv.inner = (void*)(this_arg & (~1));
40874 this_arg_conv.is_owned = false;
40875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40876 LDKUnsignedNodeAnnouncement msg_conv;
40877 msg_conv.inner = (void*)(msg & (~1));
40878 msg_conv.is_owned = false;
40879 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40880 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40881 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
40882 return (uint32_t)ret_conv;
40885 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) {
40886 LDKNetworkGraph this_arg_conv;
40887 this_arg_conv.inner = (void*)(this_arg & (~1));
40888 this_arg_conv.is_owned = false;
40889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40890 LDKChannelAnnouncement msg_conv;
40891 msg_conv.inner = (void*)(msg & (~1));
40892 msg_conv.is_owned = false;
40893 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40894 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40895 CHECK_ACCESS(chain_access_ptr);
40896 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40897 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40898 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40899 // Manually implement clone for Java trait instances
40900 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40901 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40902 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40905 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40906 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40907 return (uint32_t)ret_conv;
40910 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) {
40911 LDKNetworkGraph this_arg_conv;
40912 this_arg_conv.inner = (void*)(this_arg & (~1));
40913 this_arg_conv.is_owned = false;
40914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40915 LDKUnsignedChannelAnnouncement msg_conv;
40916 msg_conv.inner = (void*)(msg & (~1));
40917 msg_conv.is_owned = false;
40918 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40919 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40920 CHECK_ACCESS(chain_access_ptr);
40921 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40922 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40923 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40924 // Manually implement clone for Java trait instances
40925 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40927 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40930 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40931 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40932 return (uint32_t)ret_conv;
40935 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) {
40936 LDKNetworkGraph this_arg_conv;
40937 this_arg_conv.inner = (void*)(this_arg & (~1));
40938 this_arg_conv.is_owned = false;
40939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40940 LDKChannelFeatures features_conv;
40941 features_conv.inner = (void*)(features & (~1));
40942 features_conv.is_owned = (features & 1) || (features == 0);
40943 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
40944 features_conv = ChannelFeatures_clone(&features_conv);
40945 LDKPublicKey node_id_1_ref;
40946 CHECK(node_id_1->arr_len == 33);
40947 memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
40948 LDKPublicKey node_id_2_ref;
40949 CHECK(node_id_2->arr_len == 33);
40950 memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
40951 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40952 *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);
40953 return (uint32_t)ret_conv;
40956 void __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
40957 LDKNetworkGraph this_arg_conv;
40958 this_arg_conv.inner = (void*)(this_arg & (~1));
40959 this_arg_conv.is_owned = false;
40960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40961 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
40964 void __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
40965 LDKNetworkGraph this_arg_conv;
40966 this_arg_conv.inner = (void*)(this_arg & (~1));
40967 this_arg_conv.is_owned = false;
40968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40969 LDKPublicKey _node_id_ref;
40970 CHECK(_node_id->arr_len == 33);
40971 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
40972 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
40975 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) {
40976 LDKNetworkGraph this_arg_conv;
40977 this_arg_conv.inner = (void*)(this_arg & (~1));
40978 this_arg_conv.is_owned = false;
40979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40980 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
40983 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
40984 LDKNetworkGraph this_arg_conv;
40985 this_arg_conv.inner = (void*)(this_arg & (~1));
40986 this_arg_conv.is_owned = false;
40987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40988 LDKChannelUpdate msg_conv;
40989 msg_conv.inner = (void*)(msg & (~1));
40990 msg_conv.is_owned = false;
40991 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40992 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40993 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
40994 return (uint32_t)ret_conv;
40997 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
40998 LDKNetworkGraph this_arg_conv;
40999 this_arg_conv.inner = (void*)(this_arg & (~1));
41000 this_arg_conv.is_owned = false;
41001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41002 LDKUnsignedChannelUpdate msg_conv;
41003 msg_conv.inner = (void*)(msg & (~1));
41004 msg_conv.is_owned = false;
41005 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41006 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41007 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
41008 return (uint32_t)ret_conv;
41011 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint32_t this_arg, int64_t short_channel_id) {
41012 LDKReadOnlyNetworkGraph this_arg_conv;
41013 this_arg_conv.inner = (void*)(this_arg & (~1));
41014 this_arg_conv.is_owned = false;
41015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41016 LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
41017 uint32_t ret_ref = 0;
41018 if ((uintptr_t)ret_var.inner > 4096) {
41019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41022 ret_ref = (uintptr_t)ret_var.inner;
41023 if (ret_var.is_owned) {
41030 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint32_t this_arg, uint32_t node_id) {
41031 LDKReadOnlyNetworkGraph this_arg_conv;
41032 this_arg_conv.inner = (void*)(this_arg & (~1));
41033 this_arg_conv.is_owned = false;
41034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41035 LDKNodeId node_id_conv;
41036 node_id_conv.inner = (void*)(node_id & (~1));
41037 node_id_conv.is_owned = false;
41038 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41039 LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
41040 uint32_t ret_ref = 0;
41041 if ((uintptr_t)ret_var.inner > 4096) {
41042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41045 ret_ref = (uintptr_t)ret_var.inner;
41046 if (ret_var.is_owned) {
41053 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
41054 LDKReadOnlyNetworkGraph this_arg_conv;
41055 this_arg_conv.inner = (void*)(this_arg & (~1));
41056 this_arg_conv.is_owned = false;
41057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41058 LDKPublicKey pubkey_ref;
41059 CHECK(pubkey->arr_len == 33);
41060 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41061 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
41062 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
41063 uint32_t ret_ref = (uintptr_t)ret_copy;
41067 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
41068 LDKRouteHop this_obj_conv;
41069 this_obj_conv.inner = (void*)(this_obj & (~1));
41070 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41072 RouteHop_free(this_obj_conv);
41075 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
41076 LDKRouteHop this_ptr_conv;
41077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41078 this_ptr_conv.is_owned = false;
41079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41080 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41081 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
41085 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
41086 LDKRouteHop this_ptr_conv;
41087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41088 this_ptr_conv.is_owned = false;
41089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41090 LDKPublicKey val_ref;
41091 CHECK(val->arr_len == 33);
41092 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41093 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
41096 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
41097 LDKRouteHop this_ptr_conv;
41098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41099 this_ptr_conv.is_owned = false;
41100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41101 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
41102 uint32_t ret_ref = 0;
41103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41106 ret_ref = (uintptr_t)ret_var.inner;
41107 if (ret_var.is_owned) {
41113 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
41114 LDKRouteHop 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 LDKNodeFeatures val_conv;
41119 val_conv.inner = (void*)(val & (~1));
41120 val_conv.is_owned = (val & 1) || (val == 0);
41121 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41122 val_conv = NodeFeatures_clone(&val_conv);
41123 RouteHop_set_node_features(&this_ptr_conv, val_conv);
41126 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
41127 LDKRouteHop this_ptr_conv;
41128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41129 this_ptr_conv.is_owned = false;
41130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41131 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
41135 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
41136 LDKRouteHop this_ptr_conv;
41137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41138 this_ptr_conv.is_owned = false;
41139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41140 RouteHop_set_short_channel_id(&this_ptr_conv, val);
41143 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
41144 LDKRouteHop this_ptr_conv;
41145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41146 this_ptr_conv.is_owned = false;
41147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41148 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
41149 uint32_t ret_ref = 0;
41150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41153 ret_ref = (uintptr_t)ret_var.inner;
41154 if (ret_var.is_owned) {
41160 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
41161 LDKRouteHop this_ptr_conv;
41162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41163 this_ptr_conv.is_owned = false;
41164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41165 LDKChannelFeatures val_conv;
41166 val_conv.inner = (void*)(val & (~1));
41167 val_conv.is_owned = (val & 1) || (val == 0);
41168 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41169 val_conv = ChannelFeatures_clone(&val_conv);
41170 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41173 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
41174 LDKRouteHop this_ptr_conv;
41175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41176 this_ptr_conv.is_owned = false;
41177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41178 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
41182 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
41183 LDKRouteHop this_ptr_conv;
41184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41185 this_ptr_conv.is_owned = false;
41186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41187 RouteHop_set_fee_msat(&this_ptr_conv, val);
41190 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
41191 LDKRouteHop this_ptr_conv;
41192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41193 this_ptr_conv.is_owned = false;
41194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41195 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41199 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
41200 LDKRouteHop this_ptr_conv;
41201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41202 this_ptr_conv.is_owned = false;
41203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41204 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41207 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) {
41208 LDKPublicKey pubkey_arg_ref;
41209 CHECK(pubkey_arg->arr_len == 33);
41210 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
41211 LDKNodeFeatures node_features_arg_conv;
41212 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
41213 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
41214 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41215 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41216 LDKChannelFeatures channel_features_arg_conv;
41217 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
41218 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
41219 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41220 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41221 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);
41222 uint32_t ret_ref = 0;
41223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41226 ret_ref = (uintptr_t)ret_var.inner;
41227 if (ret_var.is_owned) {
41233 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41234 LDKRouteHop ret_var = RouteHop_clone(arg);
41235 uint32_t ret_ref = 0;
41236 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41237 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41239 ret_ref = (uintptr_t)ret_var.inner;
41240 if (ret_var.is_owned) {
41245 uint32_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
41246 LDKRouteHop arg_conv;
41247 arg_conv.inner = (void*)(arg & (~1));
41248 arg_conv.is_owned = false;
41249 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41250 uint32_t ret_conv = RouteHop_clone_ptr(&arg_conv);
41254 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
41255 LDKRouteHop orig_conv;
41256 orig_conv.inner = (void*)(orig & (~1));
41257 orig_conv.is_owned = false;
41258 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41259 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41260 uint32_t ret_ref = 0;
41261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41264 ret_ref = (uintptr_t)ret_var.inner;
41265 if (ret_var.is_owned) {
41271 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
41272 LDKRouteHop o_conv;
41273 o_conv.inner = (void*)(o & (~1));
41274 o_conv.is_owned = false;
41275 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41276 int64_t ret_conv = RouteHop_hash(&o_conv);
41280 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
41281 LDKRouteHop a_conv;
41282 a_conv.inner = (void*)(a & (~1));
41283 a_conv.is_owned = false;
41284 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41285 LDKRouteHop b_conv;
41286 b_conv.inner = (void*)(b & (~1));
41287 b_conv.is_owned = false;
41288 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41289 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
41293 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
41294 LDKRouteHop obj_conv;
41295 obj_conv.inner = (void*)(obj & (~1));
41296 obj_conv.is_owned = false;
41297 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41298 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41299 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41300 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41301 CVec_u8Z_free(ret_var);
41305 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
41306 LDKu8slice ser_ref;
41307 ser_ref.datalen = ser->arr_len;
41308 ser_ref.data = ser->elems;
41309 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41310 *ret_conv = RouteHop_read(ser_ref);
41312 return (uint32_t)ret_conv;
41315 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
41316 LDKRoute this_obj_conv;
41317 this_obj_conv.inner = (void*)(this_obj & (~1));
41318 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41320 Route_free(this_obj_conv);
41323 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
41324 LDKRoute this_ptr_conv;
41325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41326 this_ptr_conv.is_owned = false;
41327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41328 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41329 ptrArray ret_arr = NULL;
41330 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
41331 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
41332 for (size_t m = 0; m < ret_var.datalen; m++) {
41333 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41334 uint32_tArray ret_conv_12_arr = NULL;
41335 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
41336 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
41337 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41338 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41339 uint32_t ret_conv_12_conv_10_ref = 0;
41340 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41341 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41343 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
41344 if (ret_conv_12_conv_10_var.is_owned) {
41345 ret_conv_12_conv_10_ref |= 1;
41347 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41350 FREE(ret_conv_12_var.data);
41351 ret_arr_ptr[m] = ret_conv_12_arr;
41354 FREE(ret_var.data);
41358 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
41359 LDKRoute this_ptr_conv;
41360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41361 this_ptr_conv.is_owned = false;
41362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41363 LDKCVec_CVec_RouteHopZZ val_constr;
41364 val_constr.datalen = val->arr_len;
41365 if (val_constr.datalen > 0)
41366 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41368 val_constr.data = NULL;
41369 uint32_tArray* val_vals = (void*) val->elems;
41370 for (size_t m = 0; m < val_constr.datalen; m++) {
41371 uint32_tArray val_conv_12 = val_vals[m];
41372 LDKCVec_RouteHopZ val_conv_12_constr;
41373 val_conv_12_constr.datalen = val_conv_12->arr_len;
41374 if (val_conv_12_constr.datalen > 0)
41375 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41377 val_conv_12_constr.data = NULL;
41378 uint32_t* val_conv_12_vals = val_conv_12->elems;
41379 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41380 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
41381 LDKRouteHop val_conv_12_conv_10_conv;
41382 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
41383 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
41384 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41385 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41386 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41389 val_constr.data[m] = val_conv_12_constr;
41392 Route_set_paths(&this_ptr_conv, val_constr);
41395 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
41396 LDKRoute this_ptr_conv;
41397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41398 this_ptr_conv.is_owned = false;
41399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41400 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41401 uint32_t ret_ref = 0;
41402 if ((uintptr_t)ret_var.inner > 4096) {
41403 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41404 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41406 ret_ref = (uintptr_t)ret_var.inner;
41407 if (ret_var.is_owned) {
41414 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
41415 LDKRoute this_ptr_conv;
41416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41417 this_ptr_conv.is_owned = false;
41418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41419 LDKPaymentParameters val_conv;
41420 val_conv.inner = (void*)(val & (~1));
41421 val_conv.is_owned = (val & 1) || (val == 0);
41422 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41423 val_conv = PaymentParameters_clone(&val_conv);
41424 Route_set_payment_params(&this_ptr_conv, val_conv);
41427 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
41428 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41429 paths_arg_constr.datalen = paths_arg->arr_len;
41430 if (paths_arg_constr.datalen > 0)
41431 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41433 paths_arg_constr.data = NULL;
41434 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
41435 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41436 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
41437 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41438 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
41439 if (paths_arg_conv_12_constr.datalen > 0)
41440 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41442 paths_arg_conv_12_constr.data = NULL;
41443 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
41444 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41445 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41446 LDKRouteHop paths_arg_conv_12_conv_10_conv;
41447 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
41448 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
41449 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41450 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41451 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41453 FREE(paths_arg_conv_12);
41454 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41457 LDKPaymentParameters payment_params_arg_conv;
41458 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41459 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41460 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41461 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41462 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41463 uint32_t ret_ref = 0;
41464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41467 ret_ref = (uintptr_t)ret_var.inner;
41468 if (ret_var.is_owned) {
41474 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41475 LDKRoute ret_var = Route_clone(arg);
41476 uint32_t ret_ref = 0;
41477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41480 ret_ref = (uintptr_t)ret_var.inner;
41481 if (ret_var.is_owned) {
41486 uint32_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
41488 arg_conv.inner = (void*)(arg & (~1));
41489 arg_conv.is_owned = false;
41490 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41491 uint32_t ret_conv = Route_clone_ptr(&arg_conv);
41495 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
41496 LDKRoute orig_conv;
41497 orig_conv.inner = (void*)(orig & (~1));
41498 orig_conv.is_owned = false;
41499 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41500 LDKRoute ret_var = Route_clone(&orig_conv);
41501 uint32_t ret_ref = 0;
41502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41505 ret_ref = (uintptr_t)ret_var.inner;
41506 if (ret_var.is_owned) {
41512 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
41514 o_conv.inner = (void*)(o & (~1));
41515 o_conv.is_owned = false;
41516 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41517 int64_t ret_conv = Route_hash(&o_conv);
41521 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
41523 a_conv.inner = (void*)(a & (~1));
41524 a_conv.is_owned = false;
41525 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41527 b_conv.inner = (void*)(b & (~1));
41528 b_conv.is_owned = false;
41529 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41530 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
41534 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
41535 LDKRoute this_arg_conv;
41536 this_arg_conv.inner = (void*)(this_arg & (~1));
41537 this_arg_conv.is_owned = false;
41538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41539 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
41543 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
41544 LDKRoute this_arg_conv;
41545 this_arg_conv.inner = (void*)(this_arg & (~1));
41546 this_arg_conv.is_owned = false;
41547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41548 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
41552 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
41554 obj_conv.inner = (void*)(obj & (~1));
41555 obj_conv.is_owned = false;
41556 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41557 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41558 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41559 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41560 CVec_u8Z_free(ret_var);
41564 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
41565 LDKu8slice ser_ref;
41566 ser_ref.datalen = ser->arr_len;
41567 ser_ref.data = ser->elems;
41568 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41569 *ret_conv = Route_read(ser_ref);
41571 return (uint32_t)ret_conv;
41574 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
41575 LDKRouteParameters this_obj_conv;
41576 this_obj_conv.inner = (void*)(this_obj & (~1));
41577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41579 RouteParameters_free(this_obj_conv);
41582 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
41583 LDKRouteParameters this_ptr_conv;
41584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41585 this_ptr_conv.is_owned = false;
41586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41587 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41588 uint32_t ret_ref = 0;
41589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41592 ret_ref = (uintptr_t)ret_var.inner;
41593 if (ret_var.is_owned) {
41599 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
41600 LDKRouteParameters this_ptr_conv;
41601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41602 this_ptr_conv.is_owned = false;
41603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41604 LDKPaymentParameters val_conv;
41605 val_conv.inner = (void*)(val & (~1));
41606 val_conv.is_owned = (val & 1) || (val == 0);
41607 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41608 val_conv = PaymentParameters_clone(&val_conv);
41609 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41612 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
41613 LDKRouteParameters this_ptr_conv;
41614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41615 this_ptr_conv.is_owned = false;
41616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41617 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
41621 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
41622 LDKRouteParameters this_ptr_conv;
41623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41624 this_ptr_conv.is_owned = false;
41625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41626 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41629 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
41630 LDKRouteParameters this_ptr_conv;
41631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41632 this_ptr_conv.is_owned = false;
41633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41634 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41638 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) {
41639 LDKRouteParameters this_ptr_conv;
41640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41641 this_ptr_conv.is_owned = false;
41642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41643 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41646 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) {
41647 LDKPaymentParameters payment_params_arg_conv;
41648 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41649 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41650 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41651 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41652 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41653 uint32_t ret_ref = 0;
41654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41657 ret_ref = (uintptr_t)ret_var.inner;
41658 if (ret_var.is_owned) {
41664 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41665 LDKRouteParameters ret_var = RouteParameters_clone(arg);
41666 uint32_t ret_ref = 0;
41667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41670 ret_ref = (uintptr_t)ret_var.inner;
41671 if (ret_var.is_owned) {
41676 uint32_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
41677 LDKRouteParameters arg_conv;
41678 arg_conv.inner = (void*)(arg & (~1));
41679 arg_conv.is_owned = false;
41680 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41681 uint32_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
41685 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
41686 LDKRouteParameters orig_conv;
41687 orig_conv.inner = (void*)(orig & (~1));
41688 orig_conv.is_owned = false;
41689 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41690 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
41691 uint32_t ret_ref = 0;
41692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41695 ret_ref = (uintptr_t)ret_var.inner;
41696 if (ret_var.is_owned) {
41702 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
41703 LDKRouteParameters obj_conv;
41704 obj_conv.inner = (void*)(obj & (~1));
41705 obj_conv.is_owned = false;
41706 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41707 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
41708 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41709 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41710 CVec_u8Z_free(ret_var);
41714 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
41715 LDKu8slice ser_ref;
41716 ser_ref.datalen = ser->arr_len;
41717 ser_ref.data = ser->elems;
41718 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
41719 *ret_conv = RouteParameters_read(ser_ref);
41721 return (uint32_t)ret_conv;
41724 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
41725 LDKPaymentParameters this_obj_conv;
41726 this_obj_conv.inner = (void*)(this_obj & (~1));
41727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41729 PaymentParameters_free(this_obj_conv);
41732 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
41733 LDKPaymentParameters this_ptr_conv;
41734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41735 this_ptr_conv.is_owned = false;
41736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41737 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41738 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
41742 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
41743 LDKPaymentParameters this_ptr_conv;
41744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41745 this_ptr_conv.is_owned = false;
41746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41747 LDKPublicKey val_ref;
41748 CHECK(val->arr_len == 33);
41749 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41750 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
41753 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
41754 LDKPaymentParameters this_ptr_conv;
41755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41756 this_ptr_conv.is_owned = false;
41757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41758 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
41759 uint32_t ret_ref = 0;
41760 if ((uintptr_t)ret_var.inner > 4096) {
41761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41764 ret_ref = (uintptr_t)ret_var.inner;
41765 if (ret_var.is_owned) {
41772 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
41773 LDKPaymentParameters this_ptr_conv;
41774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41775 this_ptr_conv.is_owned = false;
41776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41777 LDKInvoiceFeatures val_conv;
41778 val_conv.inner = (void*)(val & (~1));
41779 val_conv.is_owned = (val & 1) || (val == 0);
41780 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41781 val_conv = InvoiceFeatures_clone(&val_conv);
41782 PaymentParameters_set_features(&this_ptr_conv, val_conv);
41785 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
41786 LDKPaymentParameters this_ptr_conv;
41787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41788 this_ptr_conv.is_owned = false;
41789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41790 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
41791 uint32_tArray ret_arr = NULL;
41792 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
41793 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
41794 for (size_t l = 0; l < ret_var.datalen; l++) {
41795 LDKRouteHint ret_conv_11_var = ret_var.data[l];
41796 uint32_t ret_conv_11_ref = 0;
41797 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41798 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
41800 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
41801 if (ret_conv_11_var.is_owned) {
41802 ret_conv_11_ref |= 1;
41804 ret_arr_ptr[l] = ret_conv_11_ref;
41807 FREE(ret_var.data);
41811 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
41812 LDKPaymentParameters this_ptr_conv;
41813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41814 this_ptr_conv.is_owned = false;
41815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41816 LDKCVec_RouteHintZ val_constr;
41817 val_constr.datalen = val->arr_len;
41818 if (val_constr.datalen > 0)
41819 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41821 val_constr.data = NULL;
41822 uint32_t* val_vals = val->elems;
41823 for (size_t l = 0; l < val_constr.datalen; l++) {
41824 uint32_t val_conv_11 = val_vals[l];
41825 LDKRouteHint val_conv_11_conv;
41826 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
41827 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
41828 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
41829 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
41830 val_constr.data[l] = val_conv_11_conv;
41833 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
41836 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
41837 LDKPaymentParameters this_ptr_conv;
41838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41839 this_ptr_conv.is_owned = false;
41840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41841 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41842 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
41843 uint32_t ret_ref = (uintptr_t)ret_copy;
41847 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
41848 LDKPaymentParameters this_ptr_conv;
41849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41850 this_ptr_conv.is_owned = false;
41851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41852 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41853 CHECK_ACCESS(val_ptr);
41854 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41855 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41856 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
41859 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) {
41860 LDKPaymentParameters this_ptr_conv;
41861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41862 this_ptr_conv.is_owned = false;
41863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41864 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
41868 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) {
41869 LDKPaymentParameters this_ptr_conv;
41870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41871 this_ptr_conv.is_owned = false;
41872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41873 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
41876 int8_t __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint32_t this_ptr) {
41877 LDKPaymentParameters this_ptr_conv;
41878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41879 this_ptr_conv.is_owned = false;
41880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41881 int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
41885 void __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint32_t this_ptr, int8_t val) {
41886 LDKPaymentParameters this_ptr_conv;
41887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41888 this_ptr_conv.is_owned = false;
41889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41890 PaymentParameters_set_max_path_count(&this_ptr_conv, val);
41893 int8_t __attribute__((export_name("TS_PaymentParameters_get_max_channel_saturation_power_of_half"))) TS_PaymentParameters_get_max_channel_saturation_power_of_half(uint32_t this_ptr) {
41894 LDKPaymentParameters this_ptr_conv;
41895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41896 this_ptr_conv.is_owned = false;
41897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41898 int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
41902 void __attribute__((export_name("TS_PaymentParameters_set_max_channel_saturation_power_of_half"))) TS_PaymentParameters_set_max_channel_saturation_power_of_half(uint32_t this_ptr, int8_t val) {
41903 LDKPaymentParameters this_ptr_conv;
41904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41905 this_ptr_conv.is_owned = false;
41906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41907 PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
41910 void __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint32_t this_ptr, int64_tArray val) {
41911 LDKPaymentParameters this_ptr_conv;
41912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41913 this_ptr_conv.is_owned = false;
41914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41915 LDKCVec_u64Z val_constr;
41916 val_constr.datalen = val->arr_len;
41917 if (val_constr.datalen > 0)
41918 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41920 val_constr.data = NULL;
41921 int64_t* val_vals = val->elems;
41922 for (size_t i = 0; i < val_constr.datalen; i++) {
41923 int64_t val_conv_8 = val_vals[i];
41924 val_constr.data[i] = val_conv_8;
41927 PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
41930 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, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
41931 LDKPublicKey payee_pubkey_arg_ref;
41932 CHECK(payee_pubkey_arg->arr_len == 33);
41933 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
41934 LDKInvoiceFeatures features_arg_conv;
41935 features_arg_conv.inner = (void*)(features_arg & (~1));
41936 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
41937 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41938 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
41939 LDKCVec_RouteHintZ route_hints_arg_constr;
41940 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
41941 if (route_hints_arg_constr.datalen > 0)
41942 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41944 route_hints_arg_constr.data = NULL;
41945 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
41946 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
41947 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
41948 LDKRouteHint route_hints_arg_conv_11_conv;
41949 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
41950 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
41951 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
41952 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
41953 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
41955 FREE(route_hints_arg);
41956 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
41957 CHECK_ACCESS(expiry_time_arg_ptr);
41958 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
41959 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
41960 LDKCVec_u64Z previously_failed_channels_arg_constr;
41961 previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
41962 if (previously_failed_channels_arg_constr.datalen > 0)
41963 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41965 previously_failed_channels_arg_constr.data = NULL;
41966 int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
41967 for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
41968 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
41969 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
41971 FREE(previously_failed_channels_arg);
41972 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, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
41973 uint32_t ret_ref = 0;
41974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41977 ret_ref = (uintptr_t)ret_var.inner;
41978 if (ret_var.is_owned) {
41984 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
41985 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
41986 uint32_t ret_ref = 0;
41987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41990 ret_ref = (uintptr_t)ret_var.inner;
41991 if (ret_var.is_owned) {
41996 uint32_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
41997 LDKPaymentParameters arg_conv;
41998 arg_conv.inner = (void*)(arg & (~1));
41999 arg_conv.is_owned = false;
42000 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42001 uint32_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
42005 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
42006 LDKPaymentParameters orig_conv;
42007 orig_conv.inner = (void*)(orig & (~1));
42008 orig_conv.is_owned = false;
42009 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42010 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
42011 uint32_t ret_ref = 0;
42012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42015 ret_ref = (uintptr_t)ret_var.inner;
42016 if (ret_var.is_owned) {
42022 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
42023 LDKPaymentParameters o_conv;
42024 o_conv.inner = (void*)(o & (~1));
42025 o_conv.is_owned = false;
42026 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42027 int64_t ret_conv = PaymentParameters_hash(&o_conv);
42031 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
42032 LDKPaymentParameters a_conv;
42033 a_conv.inner = (void*)(a & (~1));
42034 a_conv.is_owned = false;
42035 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42036 LDKPaymentParameters b_conv;
42037 b_conv.inner = (void*)(b & (~1));
42038 b_conv.is_owned = false;
42039 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42040 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
42044 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
42045 LDKPaymentParameters obj_conv;
42046 obj_conv.inner = (void*)(obj & (~1));
42047 obj_conv.is_owned = false;
42048 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42049 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
42050 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42051 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42052 CVec_u8Z_free(ret_var);
42056 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
42057 LDKu8slice ser_ref;
42058 ser_ref.datalen = ser->arr_len;
42059 ser_ref.data = ser->elems;
42060 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
42061 *ret_conv = PaymentParameters_read(ser_ref);
42063 return (uint32_t)ret_conv;
42066 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
42067 LDKPublicKey payee_pubkey_ref;
42068 CHECK(payee_pubkey->arr_len == 33);
42069 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42070 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
42071 uint32_t ret_ref = 0;
42072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42075 ret_ref = (uintptr_t)ret_var.inner;
42076 if (ret_var.is_owned) {
42082 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
42083 LDKPublicKey payee_pubkey_ref;
42084 CHECK(payee_pubkey->arr_len == 33);
42085 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42086 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
42087 uint32_t ret_ref = 0;
42088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42091 ret_ref = (uintptr_t)ret_var.inner;
42092 if (ret_var.is_owned) {
42098 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
42099 LDKRouteHint this_obj_conv;
42100 this_obj_conv.inner = (void*)(this_obj & (~1));
42101 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42103 RouteHint_free(this_obj_conv);
42106 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
42107 LDKRouteHint this_ptr_conv;
42108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42109 this_ptr_conv.is_owned = false;
42110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42111 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
42112 uint32_tArray ret_arr = NULL;
42113 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
42114 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
42115 for (size_t o = 0; o < ret_var.datalen; o++) {
42116 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
42117 uint32_t ret_conv_14_ref = 0;
42118 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42119 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42121 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
42122 if (ret_conv_14_var.is_owned) {
42123 ret_conv_14_ref |= 1;
42125 ret_arr_ptr[o] = ret_conv_14_ref;
42128 FREE(ret_var.data);
42132 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
42133 LDKRouteHint this_ptr_conv;
42134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42135 this_ptr_conv.is_owned = false;
42136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42137 LDKCVec_RouteHintHopZ val_constr;
42138 val_constr.datalen = val->arr_len;
42139 if (val_constr.datalen > 0)
42140 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42142 val_constr.data = NULL;
42143 uint32_t* val_vals = val->elems;
42144 for (size_t o = 0; o < val_constr.datalen; o++) {
42145 uint32_t val_conv_14 = val_vals[o];
42146 LDKRouteHintHop val_conv_14_conv;
42147 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
42148 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
42149 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
42150 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
42151 val_constr.data[o] = val_conv_14_conv;
42154 RouteHint_set_a(&this_ptr_conv, val_constr);
42157 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
42158 LDKCVec_RouteHintHopZ a_arg_constr;
42159 a_arg_constr.datalen = a_arg->arr_len;
42160 if (a_arg_constr.datalen > 0)
42161 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42163 a_arg_constr.data = NULL;
42164 uint32_t* a_arg_vals = a_arg->elems;
42165 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
42166 uint32_t a_arg_conv_14 = a_arg_vals[o];
42167 LDKRouteHintHop a_arg_conv_14_conv;
42168 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
42169 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
42170 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
42171 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
42172 a_arg_constr.data[o] = a_arg_conv_14_conv;
42175 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
42176 uint32_t ret_ref = 0;
42177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42180 ret_ref = (uintptr_t)ret_var.inner;
42181 if (ret_var.is_owned) {
42187 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
42188 LDKRouteHint ret_var = RouteHint_clone(arg);
42189 uint32_t ret_ref = 0;
42190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42193 ret_ref = (uintptr_t)ret_var.inner;
42194 if (ret_var.is_owned) {
42199 uint32_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
42200 LDKRouteHint arg_conv;
42201 arg_conv.inner = (void*)(arg & (~1));
42202 arg_conv.is_owned = false;
42203 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42204 uint32_t ret_conv = RouteHint_clone_ptr(&arg_conv);
42208 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
42209 LDKRouteHint orig_conv;
42210 orig_conv.inner = (void*)(orig & (~1));
42211 orig_conv.is_owned = false;
42212 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42213 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
42214 uint32_t ret_ref = 0;
42215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42218 ret_ref = (uintptr_t)ret_var.inner;
42219 if (ret_var.is_owned) {
42225 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
42226 LDKRouteHint o_conv;
42227 o_conv.inner = (void*)(o & (~1));
42228 o_conv.is_owned = false;
42229 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42230 int64_t ret_conv = RouteHint_hash(&o_conv);
42234 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
42235 LDKRouteHint a_conv;
42236 a_conv.inner = (void*)(a & (~1));
42237 a_conv.is_owned = false;
42238 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42239 LDKRouteHint b_conv;
42240 b_conv.inner = (void*)(b & (~1));
42241 b_conv.is_owned = false;
42242 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42243 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
42247 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
42248 LDKRouteHint obj_conv;
42249 obj_conv.inner = (void*)(obj & (~1));
42250 obj_conv.is_owned = false;
42251 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42252 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42253 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42254 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42255 CVec_u8Z_free(ret_var);
42259 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
42260 LDKu8slice ser_ref;
42261 ser_ref.datalen = ser->arr_len;
42262 ser_ref.data = ser->elems;
42263 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42264 *ret_conv = RouteHint_read(ser_ref);
42266 return (uint32_t)ret_conv;
42269 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
42270 LDKRouteHintHop this_obj_conv;
42271 this_obj_conv.inner = (void*)(this_obj & (~1));
42272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42274 RouteHintHop_free(this_obj_conv);
42277 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
42278 LDKRouteHintHop this_ptr_conv;
42279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42280 this_ptr_conv.is_owned = false;
42281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42282 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42283 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
42287 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
42288 LDKRouteHintHop 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 LDKPublicKey val_ref;
42293 CHECK(val->arr_len == 33);
42294 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42295 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42298 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
42299 LDKRouteHintHop this_ptr_conv;
42300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42301 this_ptr_conv.is_owned = false;
42302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42303 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42307 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
42308 LDKRouteHintHop this_ptr_conv;
42309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42310 this_ptr_conv.is_owned = false;
42311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42312 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42315 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
42316 LDKRouteHintHop this_ptr_conv;
42317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42318 this_ptr_conv.is_owned = false;
42319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42320 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42321 uint32_t ret_ref = 0;
42322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42325 ret_ref = (uintptr_t)ret_var.inner;
42326 if (ret_var.is_owned) {
42332 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
42333 LDKRouteHintHop this_ptr_conv;
42334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42335 this_ptr_conv.is_owned = false;
42336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42337 LDKRoutingFees val_conv;
42338 val_conv.inner = (void*)(val & (~1));
42339 val_conv.is_owned = (val & 1) || (val == 0);
42340 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42341 val_conv = RoutingFees_clone(&val_conv);
42342 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42345 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
42346 LDKRouteHintHop this_ptr_conv;
42347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42348 this_ptr_conv.is_owned = false;
42349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42350 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42354 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
42355 LDKRouteHintHop this_ptr_conv;
42356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42357 this_ptr_conv.is_owned = false;
42358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42362 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
42363 LDKRouteHintHop this_ptr_conv;
42364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42365 this_ptr_conv.is_owned = false;
42366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42367 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42368 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42369 uint32_t ret_ref = (uintptr_t)ret_copy;
42373 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
42374 LDKRouteHintHop this_ptr_conv;
42375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42376 this_ptr_conv.is_owned = false;
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42378 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42379 CHECK_ACCESS(val_ptr);
42380 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42381 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42382 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42385 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
42386 LDKRouteHintHop this_ptr_conv;
42387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42388 this_ptr_conv.is_owned = false;
42389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42390 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42391 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42392 uint32_t ret_ref = (uintptr_t)ret_copy;
42396 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
42397 LDKRouteHintHop this_ptr_conv;
42398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42399 this_ptr_conv.is_owned = false;
42400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42401 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42402 CHECK_ACCESS(val_ptr);
42403 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42404 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42405 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42408 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) {
42409 LDKPublicKey src_node_id_arg_ref;
42410 CHECK(src_node_id_arg->arr_len == 33);
42411 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
42412 LDKRoutingFees fees_arg_conv;
42413 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42414 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42415 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42416 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42417 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
42418 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42419 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42420 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
42421 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42422 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42423 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42424 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42425 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);
42426 uint32_t ret_ref = 0;
42427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42430 ret_ref = (uintptr_t)ret_var.inner;
42431 if (ret_var.is_owned) {
42437 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42438 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42439 uint32_t ret_ref = 0;
42440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42443 ret_ref = (uintptr_t)ret_var.inner;
42444 if (ret_var.is_owned) {
42449 uint32_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
42450 LDKRouteHintHop arg_conv;
42451 arg_conv.inner = (void*)(arg & (~1));
42452 arg_conv.is_owned = false;
42453 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42454 uint32_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
42458 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
42459 LDKRouteHintHop orig_conv;
42460 orig_conv.inner = (void*)(orig & (~1));
42461 orig_conv.is_owned = false;
42462 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42463 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42464 uint32_t ret_ref = 0;
42465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42468 ret_ref = (uintptr_t)ret_var.inner;
42469 if (ret_var.is_owned) {
42475 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
42476 LDKRouteHintHop o_conv;
42477 o_conv.inner = (void*)(o & (~1));
42478 o_conv.is_owned = false;
42479 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42480 int64_t ret_conv = RouteHintHop_hash(&o_conv);
42484 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
42485 LDKRouteHintHop a_conv;
42486 a_conv.inner = (void*)(a & (~1));
42487 a_conv.is_owned = false;
42488 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42489 LDKRouteHintHop b_conv;
42490 b_conv.inner = (void*)(b & (~1));
42491 b_conv.is_owned = false;
42492 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42493 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
42497 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
42498 LDKRouteHintHop obj_conv;
42499 obj_conv.inner = (void*)(obj & (~1));
42500 obj_conv.is_owned = false;
42501 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42502 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42503 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42504 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42505 CVec_u8Z_free(ret_var);
42509 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
42510 LDKu8slice ser_ref;
42511 ser_ref.datalen = ser->arr_len;
42512 ser_ref.data = ser->elems;
42513 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42514 *ret_conv = RouteHintHop_read(ser_ref);
42516 return (uint32_t)ret_conv;
42519 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) {
42520 LDKPublicKey our_node_pubkey_ref;
42521 CHECK(our_node_pubkey->arr_len == 33);
42522 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42523 LDKRouteParameters route_params_conv;
42524 route_params_conv.inner = (void*)(route_params & (~1));
42525 route_params_conv.is_owned = false;
42526 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42527 LDKNetworkGraph network_graph_conv;
42528 network_graph_conv.inner = (void*)(network_graph & (~1));
42529 network_graph_conv.is_owned = false;
42530 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42531 LDKCVec_ChannelDetailsZ first_hops_constr;
42532 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42533 if (first_hops != 0) {
42534 first_hops_constr.datalen = first_hops->arr_len;
42535 if (first_hops_constr.datalen > 0)
42536 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42538 first_hops_constr.data = NULL;
42539 uint32_t* first_hops_vals = first_hops->elems;
42540 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42541 uint32_t first_hops_conv_16 = first_hops_vals[q];
42542 LDKChannelDetails first_hops_conv_16_conv;
42543 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
42544 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
42545 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42546 first_hops_constr.data[q] = first_hops_conv_16_conv;
42549 first_hops_ptr = &first_hops_constr;
42551 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42552 CHECK_ACCESS(logger_ptr);
42553 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42554 if (logger_conv.free == LDKLogger_JCalls_free) {
42555 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42556 LDKLogger_JCalls_cloned(&logger_conv);
42558 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
42559 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
42560 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42561 unsigned char random_seed_bytes_arr[32];
42562 CHECK(random_seed_bytes->arr_len == 32);
42563 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42564 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42565 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42566 *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);
42567 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42568 return (uint32_t)ret_conv;
42571 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) {
42572 LDKPublicKey our_node_pubkey_ref;
42573 CHECK(our_node_pubkey->arr_len == 33);
42574 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42575 LDKCVec_PublicKeyZ hops_constr;
42576 hops_constr.datalen = hops->arr_len;
42577 if (hops_constr.datalen > 0)
42578 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
42580 hops_constr.data = NULL;
42581 int8_tArray* hops_vals = (void*) hops->elems;
42582 for (size_t m = 0; m < hops_constr.datalen; m++) {
42583 int8_tArray hops_conv_12 = hops_vals[m];
42584 LDKPublicKey hops_conv_12_ref;
42585 CHECK(hops_conv_12->arr_len == 33);
42586 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
42587 hops_constr.data[m] = hops_conv_12_ref;
42590 LDKRouteParameters route_params_conv;
42591 route_params_conv.inner = (void*)(route_params & (~1));
42592 route_params_conv.is_owned = false;
42593 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42594 LDKNetworkGraph network_graph_conv;
42595 network_graph_conv.inner = (void*)(network_graph & (~1));
42596 network_graph_conv.is_owned = false;
42597 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42598 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42599 CHECK_ACCESS(logger_ptr);
42600 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42601 if (logger_conv.free == LDKLogger_JCalls_free) {
42602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42603 LDKLogger_JCalls_cloned(&logger_conv);
42605 unsigned char random_seed_bytes_arr[32];
42606 CHECK(random_seed_bytes->arr_len == 32);
42607 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42608 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42609 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42610 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
42611 return (uint32_t)ret_conv;
42614 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
42615 if ((this_ptr & 1) != 0) return;
42616 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42617 CHECK_ACCESS(this_ptr_ptr);
42618 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42619 FREE((void*)this_ptr);
42620 Score_free(this_ptr_conv);
42623 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
42624 if ((this_ptr & 1) != 0) return;
42625 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42626 CHECK_ACCESS(this_ptr_ptr);
42627 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42628 FREE((void*)this_ptr);
42629 LockableScore_free(this_ptr_conv);
42632 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
42633 LDKMultiThreadedLockableScore this_obj_conv;
42634 this_obj_conv.inner = (void*)(this_obj & (~1));
42635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42637 MultiThreadedLockableScore_free(this_obj_conv);
42640 int8_tArray __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint32_t obj) {
42641 LDKMultiThreadedLockableScore obj_conv;
42642 obj_conv.inner = (void*)(obj & (~1));
42643 obj_conv.is_owned = false;
42644 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42645 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
42646 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42647 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42648 CVec_u8Z_free(ret_var);
42652 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
42653 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
42654 CHECK_ACCESS(score_ptr);
42655 LDKScore score_conv = *(LDKScore*)(score_ptr);
42656 if (score_conv.free == LDKScore_JCalls_free) {
42657 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42658 LDKScore_JCalls_cloned(&score_conv);
42660 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42661 uint32_t ret_ref = 0;
42662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42665 ret_ref = (uintptr_t)ret_var.inner;
42666 if (ret_var.is_owned) {
42672 void __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint32_t this_obj) {
42673 LDKChannelUsage this_obj_conv;
42674 this_obj_conv.inner = (void*)(this_obj & (~1));
42675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42677 ChannelUsage_free(this_obj_conv);
42680 int64_t __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint32_t this_ptr) {
42681 LDKChannelUsage this_ptr_conv;
42682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42683 this_ptr_conv.is_owned = false;
42684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42685 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
42689 void __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint32_t this_ptr, int64_t val) {
42690 LDKChannelUsage this_ptr_conv;
42691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42692 this_ptr_conv.is_owned = false;
42693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42694 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
42697 int64_t __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint32_t this_ptr) {
42698 LDKChannelUsage this_ptr_conv;
42699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42700 this_ptr_conv.is_owned = false;
42701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42702 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
42706 void __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint32_t this_ptr, int64_t val) {
42707 LDKChannelUsage this_ptr_conv;
42708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42709 this_ptr_conv.is_owned = false;
42710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42711 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
42714 uint32_t __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint32_t this_ptr) {
42715 LDKChannelUsage this_ptr_conv;
42716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42717 this_ptr_conv.is_owned = false;
42718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42719 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42720 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
42721 uint32_t ret_ref = (uintptr_t)ret_copy;
42725 void __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint32_t this_ptr, uint32_t val) {
42726 LDKChannelUsage this_ptr_conv;
42727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42728 this_ptr_conv.is_owned = false;
42729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42730 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42731 CHECK_ACCESS(val_ptr);
42732 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
42733 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
42734 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
42737 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) {
42738 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
42739 CHECK_ACCESS(effective_capacity_arg_ptr);
42740 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
42741 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
42742 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
42743 uint32_t ret_ref = 0;
42744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42747 ret_ref = (uintptr_t)ret_var.inner;
42748 if (ret_var.is_owned) {
42754 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
42755 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
42756 uint32_t ret_ref = 0;
42757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42760 ret_ref = (uintptr_t)ret_var.inner;
42761 if (ret_var.is_owned) {
42766 uint32_t __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint32_t arg) {
42767 LDKChannelUsage arg_conv;
42768 arg_conv.inner = (void*)(arg & (~1));
42769 arg_conv.is_owned = false;
42770 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42771 uint32_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
42775 uint32_t __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint32_t orig) {
42776 LDKChannelUsage orig_conv;
42777 orig_conv.inner = (void*)(orig & (~1));
42778 orig_conv.is_owned = false;
42779 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42780 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
42781 uint32_t ret_ref = 0;
42782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42785 ret_ref = (uintptr_t)ret_var.inner;
42786 if (ret_var.is_owned) {
42792 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
42793 LDKFixedPenaltyScorer this_obj_conv;
42794 this_obj_conv.inner = (void*)(this_obj & (~1));
42795 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42797 FixedPenaltyScorer_free(this_obj_conv);
42800 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42801 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42802 uint32_t ret_ref = 0;
42803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42806 ret_ref = (uintptr_t)ret_var.inner;
42807 if (ret_var.is_owned) {
42812 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
42813 LDKFixedPenaltyScorer arg_conv;
42814 arg_conv.inner = (void*)(arg & (~1));
42815 arg_conv.is_owned = false;
42816 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42817 uint32_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
42821 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
42822 LDKFixedPenaltyScorer orig_conv;
42823 orig_conv.inner = (void*)(orig & (~1));
42824 orig_conv.is_owned = false;
42825 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42826 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42827 uint32_t ret_ref = 0;
42828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42831 ret_ref = (uintptr_t)ret_var.inner;
42832 if (ret_var.is_owned) {
42838 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
42839 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42840 uint32_t ret_ref = 0;
42841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42844 ret_ref = (uintptr_t)ret_var.inner;
42845 if (ret_var.is_owned) {
42851 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
42852 LDKFixedPenaltyScorer this_arg_conv;
42853 this_arg_conv.inner = (void*)(this_arg & (~1));
42854 this_arg_conv.is_owned = false;
42855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42856 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42857 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
42858 return (uint32_t)ret_ret;
42861 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
42862 LDKFixedPenaltyScorer obj_conv;
42863 obj_conv.inner = (void*)(obj & (~1));
42864 obj_conv.is_owned = false;
42865 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42866 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
42867 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42868 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42869 CVec_u8Z_free(ret_var);
42873 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
42874 LDKu8slice ser_ref;
42875 ser_ref.datalen = ser->arr_len;
42876 ser_ref.data = ser->elems;
42877 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
42878 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
42880 return (uint32_t)ret_conv;
42883 void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint32_t this_obj) {
42884 LDKProbabilisticScorer this_obj_conv;
42885 this_obj_conv.inner = (void*)(this_obj & (~1));
42886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42888 ProbabilisticScorer_free(this_obj_conv);
42891 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
42892 LDKProbabilisticScoringParameters this_obj_conv;
42893 this_obj_conv.inner = (void*)(this_obj & (~1));
42894 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42896 ProbabilisticScoringParameters_free(this_obj_conv);
42899 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
42900 LDKProbabilisticScoringParameters this_ptr_conv;
42901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42902 this_ptr_conv.is_owned = false;
42903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42904 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
42908 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
42909 LDKProbabilisticScoringParameters this_ptr_conv;
42910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42911 this_ptr_conv.is_owned = false;
42912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42913 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
42916 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(uint32_t this_ptr) {
42917 LDKProbabilisticScoringParameters this_ptr_conv;
42918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42919 this_ptr_conv.is_owned = false;
42920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42921 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
42925 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(uint32_t this_ptr, int64_t val) {
42926 LDKProbabilisticScoringParameters this_ptr_conv;
42927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42928 this_ptr_conv.is_owned = false;
42929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42930 ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
42933 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
42934 LDKProbabilisticScoringParameters this_ptr_conv;
42935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42936 this_ptr_conv.is_owned = false;
42937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42938 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
42942 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) {
42943 LDKProbabilisticScoringParameters this_ptr_conv;
42944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42945 this_ptr_conv.is_owned = false;
42946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42947 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
42950 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
42951 LDKProbabilisticScoringParameters this_ptr_conv;
42952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42953 this_ptr_conv.is_owned = false;
42954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42955 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
42959 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) {
42960 LDKProbabilisticScoringParameters this_ptr_conv;
42961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42962 this_ptr_conv.is_owned = false;
42963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42964 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
42967 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(uint32_t this_ptr) {
42968 LDKProbabilisticScoringParameters this_ptr_conv;
42969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42970 this_ptr_conv.is_owned = false;
42971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42972 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
42976 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(uint32_t this_ptr, int64_t val) {
42977 LDKProbabilisticScoringParameters this_ptr_conv;
42978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42979 this_ptr_conv.is_owned = false;
42980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42981 ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
42984 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint32_t this_ptr) {
42985 LDKProbabilisticScoringParameters this_ptr_conv;
42986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42987 this_ptr_conv.is_owned = false;
42988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42989 int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
42993 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat(uint32_t this_ptr, int64_t val) {
42994 LDKProbabilisticScoringParameters this_ptr_conv;
42995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42996 this_ptr_conv.is_owned = false;
42997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42998 ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
43001 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint32_t this_ptr) {
43002 LDKProbabilisticScoringParameters this_ptr_conv;
43003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43004 this_ptr_conv.is_owned = false;
43005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43006 int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
43010 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(uint32_t this_ptr, int64_t val) {
43011 LDKProbabilisticScoringParameters this_ptr_conv;
43012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43013 this_ptr_conv.is_owned = false;
43014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43015 ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
43018 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
43019 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
43020 uint32_t ret_ref = 0;
43021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43024 ret_ref = (uintptr_t)ret_var.inner;
43025 if (ret_var.is_owned) {
43030 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
43031 LDKProbabilisticScoringParameters arg_conv;
43032 arg_conv.inner = (void*)(arg & (~1));
43033 arg_conv.is_owned = false;
43034 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43035 uint32_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
43039 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
43040 LDKProbabilisticScoringParameters orig_conv;
43041 orig_conv.inner = (void*)(orig & (~1));
43042 orig_conv.is_owned = false;
43043 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43044 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
43045 uint32_t ret_ref = 0;
43046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43049 ret_ref = (uintptr_t)ret_var.inner;
43050 if (ret_var.is_owned) {
43056 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint32_t params, uint32_t network_graph, uint32_t logger) {
43057 LDKProbabilisticScoringParameters params_conv;
43058 params_conv.inner = (void*)(params & (~1));
43059 params_conv.is_owned = (params & 1) || (params == 0);
43060 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43061 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
43062 LDKNetworkGraph network_graph_conv;
43063 network_graph_conv.inner = (void*)(network_graph & (~1));
43064 network_graph_conv.is_owned = false;
43065 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43066 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43067 CHECK_ACCESS(logger_ptr);
43068 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43069 if (logger_conv.free == LDKLogger_JCalls_free) {
43070 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43071 LDKLogger_JCalls_cloned(&logger_conv);
43073 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
43074 uint32_t ret_ref = 0;
43075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43078 ret_ref = (uintptr_t)ret_var.inner;
43079 if (ret_var.is_owned) {
43085 void __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint32_t this_arg) {
43086 LDKProbabilisticScorer this_arg_conv;
43087 this_arg_conv.inner = (void*)(this_arg & (~1));
43088 this_arg_conv.is_owned = false;
43089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43090 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
43093 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_estimated_channel_liquidity_range"))) TS_ProbabilisticScorer_estimated_channel_liquidity_range(uint32_t this_arg, int64_t scid, uint32_t target) {
43094 LDKProbabilisticScorer this_arg_conv;
43095 this_arg_conv.inner = (void*)(this_arg & (~1));
43096 this_arg_conv.is_owned = false;
43097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43098 LDKNodeId target_conv;
43099 target_conv.inner = (void*)(target & (~1));
43100 target_conv.is_owned = false;
43101 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
43102 LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
43103 *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
43104 uint32_t ret_ref = (uintptr_t)ret_copy;
43108 void __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint32_t this_arg, uint32_t node_id) {
43109 LDKProbabilisticScorer this_arg_conv;
43110 this_arg_conv.inner = (void*)(this_arg & (~1));
43111 this_arg_conv.is_owned = false;
43112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43113 LDKNodeId node_id_conv;
43114 node_id_conv.inner = (void*)(node_id & (~1));
43115 node_id_conv.is_owned = false;
43116 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43117 ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
43120 void __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint32_t this_arg, uint32_t node_id) {
43121 LDKProbabilisticScorer this_arg_conv;
43122 this_arg_conv.inner = (void*)(this_arg & (~1));
43123 this_arg_conv.is_owned = false;
43124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43125 LDKNodeId node_id_conv;
43126 node_id_conv.inner = (void*)(node_id & (~1));
43127 node_id_conv.is_owned = false;
43128 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43129 ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
43132 void __attribute__((export_name("TS_ProbabilisticScorer_set_manual_penalty"))) TS_ProbabilisticScorer_set_manual_penalty(uint32_t this_arg, uint32_t node_id, int64_t penalty) {
43133 LDKProbabilisticScorer this_arg_conv;
43134 this_arg_conv.inner = (void*)(this_arg & (~1));
43135 this_arg_conv.is_owned = false;
43136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43137 LDKNodeId node_id_conv;
43138 node_id_conv.inner = (void*)(node_id & (~1));
43139 node_id_conv.is_owned = false;
43140 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43141 ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
43144 void __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint32_t this_arg, uint32_t node_id) {
43145 LDKProbabilisticScorer this_arg_conv;
43146 this_arg_conv.inner = (void*)(this_arg & (~1));
43147 this_arg_conv.is_owned = false;
43148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43149 LDKNodeId node_id_conv;
43150 node_id_conv.inner = (void*)(node_id & (~1));
43151 node_id_conv.is_owned = false;
43152 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43153 ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
43156 void __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint32_t this_arg) {
43157 LDKProbabilisticScorer 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 ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
43164 void __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint32_t this_arg, uint32_tArray node_ids) {
43165 LDKProbabilisticScoringParameters this_arg_conv;
43166 this_arg_conv.inner = (void*)(this_arg & (~1));
43167 this_arg_conv.is_owned = false;
43168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43169 LDKCVec_NodeIdZ node_ids_constr;
43170 node_ids_constr.datalen = node_ids->arr_len;
43171 if (node_ids_constr.datalen > 0)
43172 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
43174 node_ids_constr.data = NULL;
43175 uint32_t* node_ids_vals = node_ids->elems;
43176 for (size_t i = 0; i < node_ids_constr.datalen; i++) {
43177 uint32_t node_ids_conv_8 = node_ids_vals[i];
43178 LDKNodeId node_ids_conv_8_conv;
43179 node_ids_conv_8_conv.inner = (void*)(node_ids_conv_8 & (~1));
43180 node_ids_conv_8_conv.is_owned = (node_ids_conv_8 & 1) || (node_ids_conv_8 == 0);
43181 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
43182 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
43183 node_ids_constr.data[i] = node_ids_conv_8_conv;
43186 ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
43189 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
43190 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
43191 uint32_t ret_ref = 0;
43192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43195 ret_ref = (uintptr_t)ret_var.inner;
43196 if (ret_var.is_owned) {
43202 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint32_t this_arg) {
43203 LDKProbabilisticScorer this_arg_conv;
43204 this_arg_conv.inner = (void*)(this_arg & (~1));
43205 this_arg_conv.is_owned = false;
43206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43207 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43208 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
43209 return (uint32_t)ret_ret;
43212 int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint32_t obj) {
43213 LDKProbabilisticScorer obj_conv;
43214 obj_conv.inner = (void*)(obj & (~1));
43215 obj_conv.is_owned = false;
43216 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43217 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
43218 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43219 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43220 CVec_u8Z_free(ret_var);
43224 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) {
43225 LDKu8slice ser_ref;
43226 ser_ref.datalen = ser->arr_len;
43227 ser_ref.data = ser->elems;
43228 LDKProbabilisticScoringParameters arg_a_conv;
43229 arg_a_conv.inner = (void*)(arg_a & (~1));
43230 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
43231 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
43232 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
43233 LDKNetworkGraph arg_b_conv;
43234 arg_b_conv.inner = (void*)(arg_b & (~1));
43235 arg_b_conv.is_owned = false;
43236 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
43237 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
43238 CHECK_ACCESS(arg_c_ptr);
43239 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
43240 if (arg_c_conv.free == LDKLogger_JCalls_free) {
43241 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43242 LDKLogger_JCalls_cloned(&arg_c_conv);
43244 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
43245 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
43247 return (uint32_t)ret_conv;
43250 void __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint32_t this_ptr) {
43251 if ((this_ptr & 1) != 0) return;
43252 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43253 CHECK_ACCESS(this_ptr_ptr);
43254 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
43255 FREE((void*)this_ptr);
43256 ParseError_free(this_ptr_conv);
43259 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
43260 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43261 *ret_copy = ParseError_clone(arg);
43262 uint32_t ret_ref = (uintptr_t)ret_copy;
43265 uint32_t __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint32_t arg) {
43266 LDKParseError* arg_conv = (LDKParseError*)arg;
43267 uint32_t ret_conv = ParseError_clone_ptr(arg_conv);
43271 uint32_t __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint32_t orig) {
43272 LDKParseError* orig_conv = (LDKParseError*)orig;
43273 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43274 *ret_copy = ParseError_clone(orig_conv);
43275 uint32_t ret_ref = (uintptr_t)ret_copy;
43279 uint32_t __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint32_t a) {
43280 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43281 CHECK_ACCESS(a_ptr);
43282 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
43283 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
43284 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43285 *ret_copy = ParseError_bech32_error(a_conv);
43286 uint32_t ret_ref = (uintptr_t)ret_copy;
43290 uint32_t __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
43292 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43293 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
43294 uint32_t ret_ref = (uintptr_t)ret_copy;
43298 uint32_t __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
43299 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
43300 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43301 *ret_copy = ParseError_malformed_signature(a_conv);
43302 uint32_t ret_ref = (uintptr_t)ret_copy;
43306 uint32_t __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
43307 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43308 *ret_copy = ParseError_bad_prefix();
43309 uint32_t ret_ref = (uintptr_t)ret_copy;
43313 uint32_t __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
43314 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43315 *ret_copy = ParseError_unknown_currency();
43316 uint32_t ret_ref = (uintptr_t)ret_copy;
43320 uint32_t __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
43321 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43322 *ret_copy = ParseError_unknown_si_prefix();
43323 uint32_t ret_ref = (uintptr_t)ret_copy;
43327 uint32_t __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
43328 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43329 *ret_copy = ParseError_malformed_hrp();
43330 uint32_t ret_ref = (uintptr_t)ret_copy;
43334 uint32_t __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
43335 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43336 *ret_copy = ParseError_too_short_data_part();
43337 uint32_t ret_ref = (uintptr_t)ret_copy;
43341 uint32_t __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
43342 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43343 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
43344 uint32_t ret_ref = (uintptr_t)ret_copy;
43348 uint32_t __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
43350 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43351 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
43352 uint32_t ret_ref = (uintptr_t)ret_copy;
43356 uint32_t __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
43357 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43358 *ret_copy = ParseError_padding_error();
43359 uint32_t ret_ref = (uintptr_t)ret_copy;
43363 uint32_t __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
43364 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43365 *ret_copy = ParseError_integer_overflow_error();
43366 uint32_t ret_ref = (uintptr_t)ret_copy;
43370 uint32_t __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
43371 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43372 *ret_copy = ParseError_invalid_seg_wit_program_length();
43373 uint32_t ret_ref = (uintptr_t)ret_copy;
43377 uint32_t __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
43378 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43379 *ret_copy = ParseError_invalid_pub_key_hash_length();
43380 uint32_t ret_ref = (uintptr_t)ret_copy;
43384 uint32_t __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
43385 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43386 *ret_copy = ParseError_invalid_script_hash_length();
43387 uint32_t ret_ref = (uintptr_t)ret_copy;
43391 uint32_t __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
43392 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43393 *ret_copy = ParseError_invalid_recovery_id();
43394 uint32_t ret_ref = (uintptr_t)ret_copy;
43398 uint32_t __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
43399 LDKStr a_conv = str_ref_to_owned_c(a);
43400 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43401 *ret_copy = ParseError_invalid_slice_length(a_conv);
43402 uint32_t ret_ref = (uintptr_t)ret_copy;
43406 uint32_t __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
43407 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43408 *ret_copy = ParseError_skip();
43409 uint32_t ret_ref = (uintptr_t)ret_copy;
43413 void __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint32_t this_ptr) {
43414 if ((this_ptr & 1) != 0) return;
43415 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43416 CHECK_ACCESS(this_ptr_ptr);
43417 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
43418 FREE((void*)this_ptr);
43419 ParseOrSemanticError_free(this_ptr_conv);
43422 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
43423 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43424 *ret_copy = ParseOrSemanticError_clone(arg);
43425 uint32_t ret_ref = (uintptr_t)ret_copy;
43428 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint32_t arg) {
43429 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
43430 uint32_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
43434 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint32_t orig) {
43435 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
43436 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43437 *ret_copy = ParseOrSemanticError_clone(orig_conv);
43438 uint32_t ret_ref = (uintptr_t)ret_copy;
43442 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint32_t a) {
43443 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43444 CHECK_ACCESS(a_ptr);
43445 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
43446 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
43447 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43448 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
43449 uint32_t ret_ref = (uintptr_t)ret_copy;
43453 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
43454 LDKSemanticError a_conv = LDKSemanticError_from_js(a);
43455 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43456 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
43457 uint32_t ret_ref = (uintptr_t)ret_copy;
43461 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
43462 LDKInvoice this_obj_conv;
43463 this_obj_conv.inner = (void*)(this_obj & (~1));
43464 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43466 Invoice_free(this_obj_conv);
43469 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
43471 a_conv.inner = (void*)(a & (~1));
43472 a_conv.is_owned = false;
43473 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43475 b_conv.inner = (void*)(b & (~1));
43476 b_conv.is_owned = false;
43477 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43478 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
43482 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
43483 LDKInvoice ret_var = Invoice_clone(arg);
43484 uint32_t ret_ref = 0;
43485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43488 ret_ref = (uintptr_t)ret_var.inner;
43489 if (ret_var.is_owned) {
43494 uint32_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
43495 LDKInvoice arg_conv;
43496 arg_conv.inner = (void*)(arg & (~1));
43497 arg_conv.is_owned = false;
43498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43499 uint32_t ret_conv = Invoice_clone_ptr(&arg_conv);
43503 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
43504 LDKInvoice orig_conv;
43505 orig_conv.inner = (void*)(orig & (~1));
43506 orig_conv.is_owned = false;
43507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43508 LDKInvoice ret_var = Invoice_clone(&orig_conv);
43509 uint32_t ret_ref = 0;
43510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43513 ret_ref = (uintptr_t)ret_var.inner;
43514 if (ret_var.is_owned) {
43520 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
43521 LDKSignedRawInvoice this_obj_conv;
43522 this_obj_conv.inner = (void*)(this_obj & (~1));
43523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43525 SignedRawInvoice_free(this_obj_conv);
43528 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
43529 LDKSignedRawInvoice a_conv;
43530 a_conv.inner = (void*)(a & (~1));
43531 a_conv.is_owned = false;
43532 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43533 LDKSignedRawInvoice b_conv;
43534 b_conv.inner = (void*)(b & (~1));
43535 b_conv.is_owned = false;
43536 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43537 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
43541 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
43542 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
43543 uint32_t ret_ref = 0;
43544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43547 ret_ref = (uintptr_t)ret_var.inner;
43548 if (ret_var.is_owned) {
43553 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
43554 LDKSignedRawInvoice arg_conv;
43555 arg_conv.inner = (void*)(arg & (~1));
43556 arg_conv.is_owned = false;
43557 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43558 uint32_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
43562 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
43563 LDKSignedRawInvoice orig_conv;
43564 orig_conv.inner = (void*)(orig & (~1));
43565 orig_conv.is_owned = false;
43566 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43567 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
43568 uint32_t ret_ref = 0;
43569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43572 ret_ref = (uintptr_t)ret_var.inner;
43573 if (ret_var.is_owned) {
43579 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
43580 LDKRawInvoice this_obj_conv;
43581 this_obj_conv.inner = (void*)(this_obj & (~1));
43582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43584 RawInvoice_free(this_obj_conv);
43587 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
43588 LDKRawInvoice this_ptr_conv;
43589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43590 this_ptr_conv.is_owned = false;
43591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43592 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
43593 uint32_t ret_ref = 0;
43594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43597 ret_ref = (uintptr_t)ret_var.inner;
43598 if (ret_var.is_owned) {
43604 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
43605 LDKRawInvoice this_ptr_conv;
43606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43607 this_ptr_conv.is_owned = false;
43608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43609 LDKRawDataPart val_conv;
43610 val_conv.inner = (void*)(val & (~1));
43611 val_conv.is_owned = (val & 1) || (val == 0);
43612 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43613 val_conv = RawDataPart_clone(&val_conv);
43614 RawInvoice_set_data(&this_ptr_conv, val_conv);
43617 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
43618 LDKRawInvoice a_conv;
43619 a_conv.inner = (void*)(a & (~1));
43620 a_conv.is_owned = false;
43621 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43622 LDKRawInvoice b_conv;
43623 b_conv.inner = (void*)(b & (~1));
43624 b_conv.is_owned = false;
43625 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43626 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
43630 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
43631 LDKRawInvoice ret_var = RawInvoice_clone(arg);
43632 uint32_t ret_ref = 0;
43633 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43634 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43636 ret_ref = (uintptr_t)ret_var.inner;
43637 if (ret_var.is_owned) {
43642 uint32_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
43643 LDKRawInvoice arg_conv;
43644 arg_conv.inner = (void*)(arg & (~1));
43645 arg_conv.is_owned = false;
43646 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43647 uint32_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
43651 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
43652 LDKRawInvoice orig_conv;
43653 orig_conv.inner = (void*)(orig & (~1));
43654 orig_conv.is_owned = false;
43655 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43656 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
43657 uint32_t ret_ref = 0;
43658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43661 ret_ref = (uintptr_t)ret_var.inner;
43662 if (ret_var.is_owned) {
43668 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
43669 LDKRawDataPart this_obj_conv;
43670 this_obj_conv.inner = (void*)(this_obj & (~1));
43671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43673 RawDataPart_free(this_obj_conv);
43676 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
43677 LDKRawDataPart this_ptr_conv;
43678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43679 this_ptr_conv.is_owned = false;
43680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43681 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
43682 uint32_t ret_ref = 0;
43683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43686 ret_ref = (uintptr_t)ret_var.inner;
43687 if (ret_var.is_owned) {
43693 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
43694 LDKRawDataPart this_ptr_conv;
43695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43696 this_ptr_conv.is_owned = false;
43697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43698 LDKPositiveTimestamp val_conv;
43699 val_conv.inner = (void*)(val & (~1));
43700 val_conv.is_owned = (val & 1) || (val == 0);
43701 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43702 val_conv = PositiveTimestamp_clone(&val_conv);
43703 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
43706 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
43707 LDKRawDataPart a_conv;
43708 a_conv.inner = (void*)(a & (~1));
43709 a_conv.is_owned = false;
43710 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43711 LDKRawDataPart b_conv;
43712 b_conv.inner = (void*)(b & (~1));
43713 b_conv.is_owned = false;
43714 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43715 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
43719 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
43720 LDKRawDataPart ret_var = RawDataPart_clone(arg);
43721 uint32_t ret_ref = 0;
43722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43725 ret_ref = (uintptr_t)ret_var.inner;
43726 if (ret_var.is_owned) {
43731 uint32_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
43732 LDKRawDataPart arg_conv;
43733 arg_conv.inner = (void*)(arg & (~1));
43734 arg_conv.is_owned = false;
43735 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43736 uint32_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
43740 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
43741 LDKRawDataPart orig_conv;
43742 orig_conv.inner = (void*)(orig & (~1));
43743 orig_conv.is_owned = false;
43744 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43745 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
43746 uint32_t ret_ref = 0;
43747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43750 ret_ref = (uintptr_t)ret_var.inner;
43751 if (ret_var.is_owned) {
43757 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
43758 LDKPositiveTimestamp this_obj_conv;
43759 this_obj_conv.inner = (void*)(this_obj & (~1));
43760 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43762 PositiveTimestamp_free(this_obj_conv);
43765 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
43766 LDKPositiveTimestamp a_conv;
43767 a_conv.inner = (void*)(a & (~1));
43768 a_conv.is_owned = false;
43769 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43770 LDKPositiveTimestamp b_conv;
43771 b_conv.inner = (void*)(b & (~1));
43772 b_conv.is_owned = false;
43773 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43774 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
43778 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
43779 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
43780 uint32_t ret_ref = 0;
43781 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43782 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43784 ret_ref = (uintptr_t)ret_var.inner;
43785 if (ret_var.is_owned) {
43790 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
43791 LDKPositiveTimestamp arg_conv;
43792 arg_conv.inner = (void*)(arg & (~1));
43793 arg_conv.is_owned = false;
43794 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43795 uint32_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
43799 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
43800 LDKPositiveTimestamp orig_conv;
43801 orig_conv.inner = (void*)(orig & (~1));
43802 orig_conv.is_owned = false;
43803 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43804 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
43805 uint32_t ret_ref = 0;
43806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43809 ret_ref = (uintptr_t)ret_var.inner;
43810 if (ret_var.is_owned) {
43816 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
43817 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
43818 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
43822 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
43823 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
43827 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
43828 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
43832 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
43833 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
43837 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
43838 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
43842 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
43843 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
43844 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
43845 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
43849 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
43850 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
43851 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
43855 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
43856 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
43857 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
43861 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
43862 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
43866 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
43867 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
43871 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
43872 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
43876 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
43877 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
43881 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
43882 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
43886 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
43887 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
43888 int64_t ret_conv = Currency_hash(o_conv);
43892 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
43893 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
43894 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
43895 jboolean ret_conv = Currency_eq(a_conv, b_conv);
43899 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
43900 LDKSha256 this_obj_conv;
43901 this_obj_conv.inner = (void*)(this_obj & (~1));
43902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43904 Sha256_free(this_obj_conv);
43907 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
43908 LDKSha256 ret_var = Sha256_clone(arg);
43909 uint32_t ret_ref = 0;
43910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43913 ret_ref = (uintptr_t)ret_var.inner;
43914 if (ret_var.is_owned) {
43919 uint32_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
43920 LDKSha256 arg_conv;
43921 arg_conv.inner = (void*)(arg & (~1));
43922 arg_conv.is_owned = false;
43923 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43924 uint32_t ret_conv = Sha256_clone_ptr(&arg_conv);
43928 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
43929 LDKSha256 orig_conv;
43930 orig_conv.inner = (void*)(orig & (~1));
43931 orig_conv.is_owned = false;
43932 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43933 LDKSha256 ret_var = Sha256_clone(&orig_conv);
43934 uint32_t ret_ref = 0;
43935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43938 ret_ref = (uintptr_t)ret_var.inner;
43939 if (ret_var.is_owned) {
43945 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
43947 o_conv.inner = (void*)(o & (~1));
43948 o_conv.is_owned = false;
43949 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43950 int64_t ret_conv = Sha256_hash(&o_conv);
43954 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
43956 a_conv.inner = (void*)(a & (~1));
43957 a_conv.is_owned = false;
43958 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43960 b_conv.inner = (void*)(b & (~1));
43961 b_conv.is_owned = false;
43962 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43963 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
43967 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
43968 LDKDescription this_obj_conv;
43969 this_obj_conv.inner = (void*)(this_obj & (~1));
43970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43972 Description_free(this_obj_conv);
43975 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
43976 LDKDescription ret_var = Description_clone(arg);
43977 uint32_t ret_ref = 0;
43978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43981 ret_ref = (uintptr_t)ret_var.inner;
43982 if (ret_var.is_owned) {
43987 uint32_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
43988 LDKDescription arg_conv;
43989 arg_conv.inner = (void*)(arg & (~1));
43990 arg_conv.is_owned = false;
43991 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43992 uint32_t ret_conv = Description_clone_ptr(&arg_conv);
43996 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
43997 LDKDescription orig_conv;
43998 orig_conv.inner = (void*)(orig & (~1));
43999 orig_conv.is_owned = false;
44000 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44001 LDKDescription ret_var = Description_clone(&orig_conv);
44002 uint32_t ret_ref = 0;
44003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44006 ret_ref = (uintptr_t)ret_var.inner;
44007 if (ret_var.is_owned) {
44013 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
44014 LDKDescription o_conv;
44015 o_conv.inner = (void*)(o & (~1));
44016 o_conv.is_owned = false;
44017 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44018 int64_t ret_conv = Description_hash(&o_conv);
44022 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
44023 LDKDescription a_conv;
44024 a_conv.inner = (void*)(a & (~1));
44025 a_conv.is_owned = false;
44026 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44027 LDKDescription b_conv;
44028 b_conv.inner = (void*)(b & (~1));
44029 b_conv.is_owned = false;
44030 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44031 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
44035 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
44036 LDKPayeePubKey this_obj_conv;
44037 this_obj_conv.inner = (void*)(this_obj & (~1));
44038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44040 PayeePubKey_free(this_obj_conv);
44043 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
44044 LDKPayeePubKey this_ptr_conv;
44045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44046 this_ptr_conv.is_owned = false;
44047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44048 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44049 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
44053 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
44054 LDKPayeePubKey this_ptr_conv;
44055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44056 this_ptr_conv.is_owned = false;
44057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44058 LDKPublicKey val_ref;
44059 CHECK(val->arr_len == 33);
44060 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44061 PayeePubKey_set_a(&this_ptr_conv, val_ref);
44064 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
44065 LDKPublicKey a_arg_ref;
44066 CHECK(a_arg->arr_len == 33);
44067 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44068 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
44069 uint32_t ret_ref = 0;
44070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44073 ret_ref = (uintptr_t)ret_var.inner;
44074 if (ret_var.is_owned) {
44080 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
44081 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
44082 uint32_t ret_ref = 0;
44083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44086 ret_ref = (uintptr_t)ret_var.inner;
44087 if (ret_var.is_owned) {
44092 uint32_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
44093 LDKPayeePubKey arg_conv;
44094 arg_conv.inner = (void*)(arg & (~1));
44095 arg_conv.is_owned = false;
44096 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44097 uint32_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
44101 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
44102 LDKPayeePubKey orig_conv;
44103 orig_conv.inner = (void*)(orig & (~1));
44104 orig_conv.is_owned = false;
44105 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44106 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
44107 uint32_t ret_ref = 0;
44108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44111 ret_ref = (uintptr_t)ret_var.inner;
44112 if (ret_var.is_owned) {
44118 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
44119 LDKPayeePubKey o_conv;
44120 o_conv.inner = (void*)(o & (~1));
44121 o_conv.is_owned = false;
44122 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44123 int64_t ret_conv = PayeePubKey_hash(&o_conv);
44127 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
44128 LDKPayeePubKey a_conv;
44129 a_conv.inner = (void*)(a & (~1));
44130 a_conv.is_owned = false;
44131 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44132 LDKPayeePubKey b_conv;
44133 b_conv.inner = (void*)(b & (~1));
44134 b_conv.is_owned = false;
44135 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44136 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
44140 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
44141 LDKExpiryTime this_obj_conv;
44142 this_obj_conv.inner = (void*)(this_obj & (~1));
44143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44145 ExpiryTime_free(this_obj_conv);
44148 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
44149 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
44150 uint32_t ret_ref = 0;
44151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44154 ret_ref = (uintptr_t)ret_var.inner;
44155 if (ret_var.is_owned) {
44160 uint32_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
44161 LDKExpiryTime arg_conv;
44162 arg_conv.inner = (void*)(arg & (~1));
44163 arg_conv.is_owned = false;
44164 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44165 uint32_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
44169 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
44170 LDKExpiryTime orig_conv;
44171 orig_conv.inner = (void*)(orig & (~1));
44172 orig_conv.is_owned = false;
44173 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44174 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
44175 uint32_t ret_ref = 0;
44176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44179 ret_ref = (uintptr_t)ret_var.inner;
44180 if (ret_var.is_owned) {
44186 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
44187 LDKExpiryTime o_conv;
44188 o_conv.inner = (void*)(o & (~1));
44189 o_conv.is_owned = false;
44190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44191 int64_t ret_conv = ExpiryTime_hash(&o_conv);
44195 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
44196 LDKExpiryTime a_conv;
44197 a_conv.inner = (void*)(a & (~1));
44198 a_conv.is_owned = false;
44199 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44200 LDKExpiryTime b_conv;
44201 b_conv.inner = (void*)(b & (~1));
44202 b_conv.is_owned = false;
44203 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44204 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
44208 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
44209 LDKMinFinalCltvExpiry this_obj_conv;
44210 this_obj_conv.inner = (void*)(this_obj & (~1));
44211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44213 MinFinalCltvExpiry_free(this_obj_conv);
44216 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
44217 LDKMinFinalCltvExpiry this_ptr_conv;
44218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44219 this_ptr_conv.is_owned = false;
44220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44221 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
44225 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
44226 LDKMinFinalCltvExpiry this_ptr_conv;
44227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44228 this_ptr_conv.is_owned = false;
44229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44230 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
44233 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
44234 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
44235 uint32_t ret_ref = 0;
44236 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44237 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44239 ret_ref = (uintptr_t)ret_var.inner;
44240 if (ret_var.is_owned) {
44246 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
44247 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
44248 uint32_t ret_ref = 0;
44249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44252 ret_ref = (uintptr_t)ret_var.inner;
44253 if (ret_var.is_owned) {
44258 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
44259 LDKMinFinalCltvExpiry arg_conv;
44260 arg_conv.inner = (void*)(arg & (~1));
44261 arg_conv.is_owned = false;
44262 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44263 uint32_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
44267 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
44268 LDKMinFinalCltvExpiry orig_conv;
44269 orig_conv.inner = (void*)(orig & (~1));
44270 orig_conv.is_owned = false;
44271 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44272 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
44273 uint32_t ret_ref = 0;
44274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44277 ret_ref = (uintptr_t)ret_var.inner;
44278 if (ret_var.is_owned) {
44284 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
44285 LDKMinFinalCltvExpiry o_conv;
44286 o_conv.inner = (void*)(o & (~1));
44287 o_conv.is_owned = false;
44288 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44289 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
44293 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
44294 LDKMinFinalCltvExpiry a_conv;
44295 a_conv.inner = (void*)(a & (~1));
44296 a_conv.is_owned = false;
44297 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44298 LDKMinFinalCltvExpiry b_conv;
44299 b_conv.inner = (void*)(b & (~1));
44300 b_conv.is_owned = false;
44301 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44302 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
44306 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
44307 if ((this_ptr & 1) != 0) return;
44308 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44309 CHECK_ACCESS(this_ptr_ptr);
44310 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
44311 FREE((void*)this_ptr);
44312 Fallback_free(this_ptr_conv);
44315 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
44316 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44317 *ret_copy = Fallback_clone(arg);
44318 uint32_t ret_ref = (uintptr_t)ret_copy;
44321 uint32_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
44322 LDKFallback* arg_conv = (LDKFallback*)arg;
44323 uint32_t ret_conv = Fallback_clone_ptr(arg_conv);
44327 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
44328 LDKFallback* orig_conv = (LDKFallback*)orig;
44329 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44330 *ret_copy = Fallback_clone(orig_conv);
44331 uint32_t ret_ref = (uintptr_t)ret_copy;
44335 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
44337 LDKCVec_u8Z program_ref;
44338 program_ref.datalen = program->arr_len;
44339 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
44340 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
44341 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44342 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
44343 uint32_t ret_ref = (uintptr_t)ret_copy;
44347 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
44348 LDKTwentyBytes a_ref;
44349 CHECK(a->arr_len == 20);
44350 memcpy(a_ref.data, a->elems, 20); FREE(a);
44351 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44352 *ret_copy = Fallback_pub_key_hash(a_ref);
44353 uint32_t ret_ref = (uintptr_t)ret_copy;
44357 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
44358 LDKTwentyBytes a_ref;
44359 CHECK(a->arr_len == 20);
44360 memcpy(a_ref.data, a->elems, 20); FREE(a);
44361 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44362 *ret_copy = Fallback_script_hash(a_ref);
44363 uint32_t ret_ref = (uintptr_t)ret_copy;
44367 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
44368 LDKFallback* o_conv = (LDKFallback*)o;
44369 int64_t ret_conv = Fallback_hash(o_conv);
44373 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
44374 LDKFallback* a_conv = (LDKFallback*)a;
44375 LDKFallback* b_conv = (LDKFallback*)b;
44376 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
44380 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
44381 LDKInvoiceSignature this_obj_conv;
44382 this_obj_conv.inner = (void*)(this_obj & (~1));
44383 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44385 InvoiceSignature_free(this_obj_conv);
44388 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
44389 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
44390 uint32_t ret_ref = 0;
44391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44394 ret_ref = (uintptr_t)ret_var.inner;
44395 if (ret_var.is_owned) {
44400 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
44401 LDKInvoiceSignature arg_conv;
44402 arg_conv.inner = (void*)(arg & (~1));
44403 arg_conv.is_owned = false;
44404 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44405 uint32_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
44409 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
44410 LDKInvoiceSignature orig_conv;
44411 orig_conv.inner = (void*)(orig & (~1));
44412 orig_conv.is_owned = false;
44413 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44414 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44415 uint32_t ret_ref = 0;
44416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44419 ret_ref = (uintptr_t)ret_var.inner;
44420 if (ret_var.is_owned) {
44426 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
44427 LDKInvoiceSignature a_conv;
44428 a_conv.inner = (void*)(a & (~1));
44429 a_conv.is_owned = false;
44430 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44431 LDKInvoiceSignature b_conv;
44432 b_conv.inner = (void*)(b & (~1));
44433 b_conv.is_owned = false;
44434 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44435 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
44439 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
44440 LDKPrivateRoute this_obj_conv;
44441 this_obj_conv.inner = (void*)(this_obj & (~1));
44442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44444 PrivateRoute_free(this_obj_conv);
44447 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44448 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44449 uint32_t ret_ref = 0;
44450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44453 ret_ref = (uintptr_t)ret_var.inner;
44454 if (ret_var.is_owned) {
44459 uint32_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
44460 LDKPrivateRoute arg_conv;
44461 arg_conv.inner = (void*)(arg & (~1));
44462 arg_conv.is_owned = false;
44463 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44464 uint32_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
44468 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
44469 LDKPrivateRoute orig_conv;
44470 orig_conv.inner = (void*)(orig & (~1));
44471 orig_conv.is_owned = false;
44472 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44473 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44474 uint32_t ret_ref = 0;
44475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44478 ret_ref = (uintptr_t)ret_var.inner;
44479 if (ret_var.is_owned) {
44485 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
44486 LDKPrivateRoute o_conv;
44487 o_conv.inner = (void*)(o & (~1));
44488 o_conv.is_owned = false;
44489 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44490 int64_t ret_conv = PrivateRoute_hash(&o_conv);
44494 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
44495 LDKPrivateRoute a_conv;
44496 a_conv.inner = (void*)(a & (~1));
44497 a_conv.is_owned = false;
44498 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44499 LDKPrivateRoute b_conv;
44500 b_conv.inner = (void*)(b & (~1));
44501 b_conv.is_owned = false;
44502 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44503 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
44507 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
44508 LDKSignedRawInvoice this_arg_conv;
44509 this_arg_conv.inner = (void*)(this_arg & (~1));
44510 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44512 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
44513 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
44514 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
44515 return ((uint32_t)ret_conv);
44518 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
44519 LDKSignedRawInvoice this_arg_conv;
44520 this_arg_conv.inner = (void*)(this_arg & (~1));
44521 this_arg_conv.is_owned = false;
44522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44523 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
44524 uint32_t ret_ref = 0;
44525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44528 ret_ref = (uintptr_t)ret_var.inner;
44529 if (ret_var.is_owned) {
44535 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
44536 LDKSignedRawInvoice this_arg_conv;
44537 this_arg_conv.inner = (void*)(this_arg & (~1));
44538 this_arg_conv.is_owned = false;
44539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44540 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44541 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
44545 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
44546 LDKSignedRawInvoice this_arg_conv;
44547 this_arg_conv.inner = (void*)(this_arg & (~1));
44548 this_arg_conv.is_owned = false;
44549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44550 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
44551 uint32_t ret_ref = 0;
44552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44555 ret_ref = (uintptr_t)ret_var.inner;
44556 if (ret_var.is_owned) {
44562 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
44563 LDKSignedRawInvoice this_arg_conv;
44564 this_arg_conv.inner = (void*)(this_arg & (~1));
44565 this_arg_conv.is_owned = false;
44566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44567 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
44568 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
44569 return (uint32_t)ret_conv;
44572 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
44573 LDKSignedRawInvoice this_arg_conv;
44574 this_arg_conv.inner = (void*)(this_arg & (~1));
44575 this_arg_conv.is_owned = false;
44576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44577 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
44581 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
44582 LDKRawInvoice this_arg_conv;
44583 this_arg_conv.inner = (void*)(this_arg & (~1));
44584 this_arg_conv.is_owned = false;
44585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44586 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44587 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
44591 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
44592 LDKRawInvoice this_arg_conv;
44593 this_arg_conv.inner = (void*)(this_arg & (~1));
44594 this_arg_conv.is_owned = false;
44595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44596 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
44597 uint32_t ret_ref = 0;
44598 if ((uintptr_t)ret_var.inner > 4096) {
44599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44602 ret_ref = (uintptr_t)ret_var.inner;
44603 if (ret_var.is_owned) {
44610 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
44611 LDKRawInvoice this_arg_conv;
44612 this_arg_conv.inner = (void*)(this_arg & (~1));
44613 this_arg_conv.is_owned = false;
44614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44615 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
44616 uint32_t ret_ref = 0;
44617 if ((uintptr_t)ret_var.inner > 4096) {
44618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44621 ret_ref = (uintptr_t)ret_var.inner;
44622 if (ret_var.is_owned) {
44629 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
44630 LDKRawInvoice this_arg_conv;
44631 this_arg_conv.inner = (void*)(this_arg & (~1));
44632 this_arg_conv.is_owned = false;
44633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44634 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
44635 uint32_t ret_ref = 0;
44636 if ((uintptr_t)ret_var.inner > 4096) {
44637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44640 ret_ref = (uintptr_t)ret_var.inner;
44641 if (ret_var.is_owned) {
44648 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
44649 LDKRawInvoice this_arg_conv;
44650 this_arg_conv.inner = (void*)(this_arg & (~1));
44651 this_arg_conv.is_owned = false;
44652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44653 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
44654 uint32_t ret_ref = 0;
44655 if ((uintptr_t)ret_var.inner > 4096) {
44656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44659 ret_ref = (uintptr_t)ret_var.inner;
44660 if (ret_var.is_owned) {
44667 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
44668 LDKRawInvoice this_arg_conv;
44669 this_arg_conv.inner = (void*)(this_arg & (~1));
44670 this_arg_conv.is_owned = false;
44671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44672 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
44673 uint32_t ret_ref = 0;
44674 if ((uintptr_t)ret_var.inner > 4096) {
44675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44678 ret_ref = (uintptr_t)ret_var.inner;
44679 if (ret_var.is_owned) {
44686 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
44687 LDKRawInvoice this_arg_conv;
44688 this_arg_conv.inner = (void*)(this_arg & (~1));
44689 this_arg_conv.is_owned = false;
44690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44691 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
44692 uint32_t ret_ref = 0;
44693 if ((uintptr_t)ret_var.inner > 4096) {
44694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44697 ret_ref = (uintptr_t)ret_var.inner;
44698 if (ret_var.is_owned) {
44705 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
44706 LDKRawInvoice this_arg_conv;
44707 this_arg_conv.inner = (void*)(this_arg & (~1));
44708 this_arg_conv.is_owned = false;
44709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44710 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44711 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
44715 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
44716 LDKRawInvoice this_arg_conv;
44717 this_arg_conv.inner = (void*)(this_arg & (~1));
44718 this_arg_conv.is_owned = false;
44719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44720 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
44721 uint32_t ret_ref = 0;
44722 if ((uintptr_t)ret_var.inner > 4096) {
44723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44726 ret_ref = (uintptr_t)ret_var.inner;
44727 if (ret_var.is_owned) {
44734 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
44735 LDKRawInvoice this_arg_conv;
44736 this_arg_conv.inner = (void*)(this_arg & (~1));
44737 this_arg_conv.is_owned = false;
44738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44739 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
44740 uint32_tArray ret_arr = NULL;
44741 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
44742 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
44743 for (size_t o = 0; o < ret_var.datalen; o++) {
44744 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44745 uint32_t ret_conv_14_ref = 0;
44746 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44747 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44749 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44750 if (ret_conv_14_var.is_owned) {
44751 ret_conv_14_ref |= 1;
44753 ret_arr_ptr[o] = ret_conv_14_ref;
44756 FREE(ret_var.data);
44760 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
44761 LDKRawInvoice this_arg_conv;
44762 this_arg_conv.inner = (void*)(this_arg & (~1));
44763 this_arg_conv.is_owned = false;
44764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44765 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44766 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
44767 uint32_t ret_ref = (uintptr_t)ret_copy;
44771 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
44772 LDKRawInvoice this_arg_conv;
44773 this_arg_conv.inner = (void*)(this_arg & (~1));
44774 this_arg_conv.is_owned = false;
44775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44776 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
44780 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
44781 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44782 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
44783 return (uint32_t)ret_conv;
44786 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
44787 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44788 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
44789 return (uint32_t)ret_conv;
44792 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
44793 LDKPositiveTimestamp this_arg_conv;
44794 this_arg_conv.inner = (void*)(this_arg & (~1));
44795 this_arg_conv.is_owned = false;
44796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44797 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
44801 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
44802 LDKPositiveTimestamp this_arg_conv;
44803 this_arg_conv.inner = (void*)(this_arg & (~1));
44804 this_arg_conv.is_owned = false;
44805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44806 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
44810 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
44811 LDKInvoice this_arg_conv;
44812 this_arg_conv.inner = (void*)(this_arg & (~1));
44813 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44815 this_arg_conv = Invoice_clone(&this_arg_conv);
44816 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
44817 uint32_t ret_ref = 0;
44818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44821 ret_ref = (uintptr_t)ret_var.inner;
44822 if (ret_var.is_owned) {
44828 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
44829 LDKInvoice this_arg_conv;
44830 this_arg_conv.inner = (void*)(this_arg & (~1));
44831 this_arg_conv.is_owned = false;
44832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44833 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
44834 *ret_conv = Invoice_check_signature(&this_arg_conv);
44835 return (uint32_t)ret_conv;
44838 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
44839 LDKSignedRawInvoice signed_invoice_conv;
44840 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
44841 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
44842 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
44843 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
44844 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
44845 *ret_conv = Invoice_from_signed(signed_invoice_conv);
44846 return (uint32_t)ret_conv;
44849 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
44850 LDKInvoice this_arg_conv;
44851 this_arg_conv.inner = (void*)(this_arg & (~1));
44852 this_arg_conv.is_owned = false;
44853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44854 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
44858 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
44859 LDKInvoice this_arg_conv;
44860 this_arg_conv.inner = (void*)(this_arg & (~1));
44861 this_arg_conv.is_owned = false;
44862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44863 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44864 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
44868 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
44869 LDKInvoice this_arg_conv;
44870 this_arg_conv.inner = (void*)(this_arg & (~1));
44871 this_arg_conv.is_owned = false;
44872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44873 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44874 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
44878 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
44879 LDKInvoice this_arg_conv;
44880 this_arg_conv.inner = (void*)(this_arg & (~1));
44881 this_arg_conv.is_owned = false;
44882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44883 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44884 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
44888 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
44889 LDKInvoice this_arg_conv;
44890 this_arg_conv.inner = (void*)(this_arg & (~1));
44891 this_arg_conv.is_owned = false;
44892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44893 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
44894 uint32_t ret_ref = 0;
44895 if ((uintptr_t)ret_var.inner > 4096) {
44896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44899 ret_ref = (uintptr_t)ret_var.inner;
44900 if (ret_var.is_owned) {
44907 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
44908 LDKInvoice this_arg_conv;
44909 this_arg_conv.inner = (void*)(this_arg & (~1));
44910 this_arg_conv.is_owned = false;
44911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44912 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44913 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
44917 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
44918 LDKInvoice this_arg_conv;
44919 this_arg_conv.inner = (void*)(this_arg & (~1));
44920 this_arg_conv.is_owned = false;
44921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44922 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
44926 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
44927 LDKInvoice this_arg_conv;
44928 this_arg_conv.inner = (void*)(this_arg & (~1));
44929 this_arg_conv.is_owned = false;
44930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44931 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
44935 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
44936 LDKInvoice this_arg_conv;
44937 this_arg_conv.inner = (void*)(this_arg & (~1));
44938 this_arg_conv.is_owned = false;
44939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44940 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
44944 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
44945 LDKInvoice this_arg_conv;
44946 this_arg_conv.inner = (void*)(this_arg & (~1));
44947 this_arg_conv.is_owned = false;
44948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44949 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
44950 uint32_tArray ret_arr = NULL;
44951 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
44952 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
44953 for (size_t o = 0; o < ret_var.datalen; o++) {
44954 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44955 uint32_t ret_conv_14_ref = 0;
44956 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44957 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44959 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44960 if (ret_conv_14_var.is_owned) {
44961 ret_conv_14_ref |= 1;
44963 ret_arr_ptr[o] = ret_conv_14_ref;
44966 FREE(ret_var.data);
44970 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
44971 LDKInvoice this_arg_conv;
44972 this_arg_conv.inner = (void*)(this_arg & (~1));
44973 this_arg_conv.is_owned = false;
44974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44975 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
44976 uint32_tArray ret_arr = NULL;
44977 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
44978 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
44979 for (size_t l = 0; l < ret_var.datalen; l++) {
44980 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44981 uint32_t ret_conv_11_ref = 0;
44982 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44983 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44985 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
44986 if (ret_conv_11_var.is_owned) {
44987 ret_conv_11_ref |= 1;
44989 ret_arr_ptr[l] = ret_conv_11_ref;
44992 FREE(ret_var.data);
44996 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
44997 LDKInvoice this_arg_conv;
44998 this_arg_conv.inner = (void*)(this_arg & (~1));
44999 this_arg_conv.is_owned = false;
45000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45001 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
45005 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
45006 LDKInvoice this_arg_conv;
45007 this_arg_conv.inner = (void*)(this_arg & (~1));
45008 this_arg_conv.is_owned = false;
45009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45010 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45011 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
45012 uint32_t ret_ref = (uintptr_t)ret_copy;
45016 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
45017 LDKStr description_conv = str_ref_to_owned_c(description);
45018 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
45019 *ret_conv = Description_new(description_conv);
45020 return (uint32_t)ret_conv;
45023 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
45024 LDKDescription this_arg_conv;
45025 this_arg_conv.inner = (void*)(this_arg & (~1));
45026 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45028 this_arg_conv = Description_clone(&this_arg_conv);
45029 LDKStr ret_str = Description_into_inner(this_arg_conv);
45030 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45035 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
45036 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
45037 uint32_t ret_ref = 0;
45038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45041 ret_ref = (uintptr_t)ret_var.inner;
45042 if (ret_var.is_owned) {
45048 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
45049 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
45050 uint32_t ret_ref = 0;
45051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45054 ret_ref = (uintptr_t)ret_var.inner;
45055 if (ret_var.is_owned) {
45061 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
45062 LDKExpiryTime this_arg_conv;
45063 this_arg_conv.inner = (void*)(this_arg & (~1));
45064 this_arg_conv.is_owned = false;
45065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45066 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
45070 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
45071 LDKExpiryTime this_arg_conv;
45072 this_arg_conv.inner = (void*)(this_arg & (~1));
45073 this_arg_conv.is_owned = false;
45074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45075 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
45079 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
45080 LDKRouteHint hops_conv;
45081 hops_conv.inner = (void*)(hops & (~1));
45082 hops_conv.is_owned = (hops & 1) || (hops == 0);
45083 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
45084 hops_conv = RouteHint_clone(&hops_conv);
45085 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
45086 *ret_conv = PrivateRoute_new(hops_conv);
45087 return (uint32_t)ret_conv;
45090 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
45091 LDKPrivateRoute this_arg_conv;
45092 this_arg_conv.inner = (void*)(this_arg & (~1));
45093 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45095 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
45096 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
45097 uint32_t ret_ref = 0;
45098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45101 ret_ref = (uintptr_t)ret_var.inner;
45102 if (ret_var.is_owned) {
45108 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
45109 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
45110 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
45114 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
45115 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
45119 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
45120 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
45124 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
45125 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
45129 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
45130 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
45134 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
45135 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
45139 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
45140 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
45141 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
45142 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
45146 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
45147 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
45148 LDKStr ret_str = CreationError_to_str(o_conv);
45149 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45154 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
45155 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
45156 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
45160 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
45161 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
45165 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
45166 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
45170 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
45171 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
45175 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
45176 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
45180 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
45181 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
45185 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
45186 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
45190 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
45191 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
45195 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
45196 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
45200 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
45201 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
45205 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
45206 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
45210 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
45211 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
45212 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
45213 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
45217 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
45218 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
45219 LDKStr ret_str = SemanticError_to_str(o_conv);
45220 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45225 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
45226 if ((this_ptr & 1) != 0) return;
45227 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45228 CHECK_ACCESS(this_ptr_ptr);
45229 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
45230 FREE((void*)this_ptr);
45231 SignOrCreationError_free(this_ptr_conv);
45234 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
45235 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45236 *ret_copy = SignOrCreationError_clone(arg);
45237 uint32_t ret_ref = (uintptr_t)ret_copy;
45240 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
45241 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
45242 uint32_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
45246 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
45247 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
45248 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45249 *ret_copy = SignOrCreationError_clone(orig_conv);
45250 uint32_t ret_ref = (uintptr_t)ret_copy;
45254 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
45255 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45256 *ret_copy = SignOrCreationError_sign_error();
45257 uint32_t ret_ref = (uintptr_t)ret_copy;
45261 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
45262 LDKCreationError a_conv = LDKCreationError_from_js(a);
45263 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45264 *ret_copy = SignOrCreationError_creation_error(a_conv);
45265 uint32_t ret_ref = (uintptr_t)ret_copy;
45269 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
45270 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
45271 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
45272 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
45276 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
45277 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
45278 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
45279 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45284 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
45285 LDKInvoicePayer this_obj_conv;
45286 this_obj_conv.inner = (void*)(this_obj & (~1));
45287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45289 InvoicePayer_free(this_obj_conv);
45292 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
45293 if ((this_ptr & 1) != 0) return;
45294 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45295 CHECK_ACCESS(this_ptr_ptr);
45296 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
45297 FREE((void*)this_ptr);
45298 Payer_free(this_ptr_conv);
45301 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
45302 if ((this_ptr & 1) != 0) return;
45303 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45304 CHECK_ACCESS(this_ptr_ptr);
45305 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45306 FREE((void*)this_ptr);
45307 Router_free(this_ptr_conv);
45310 void __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint32_t this_ptr) {
45311 if ((this_ptr & 1) != 0) return;
45312 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45313 CHECK_ACCESS(this_ptr_ptr);
45314 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
45315 FREE((void*)this_ptr);
45316 Retry_free(this_ptr_conv);
45319 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
45320 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45321 *ret_copy = Retry_clone(arg);
45322 uint32_t ret_ref = (uintptr_t)ret_copy;
45325 uint32_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint32_t arg) {
45326 LDKRetry* arg_conv = (LDKRetry*)arg;
45327 uint32_t ret_conv = Retry_clone_ptr(arg_conv);
45331 uint32_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint32_t orig) {
45332 LDKRetry* orig_conv = (LDKRetry*)orig;
45333 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45334 *ret_copy = Retry_clone(orig_conv);
45335 uint32_t ret_ref = (uintptr_t)ret_copy;
45339 uint32_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
45340 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45341 *ret_copy = Retry_attempts(a);
45342 uint32_t ret_ref = (uintptr_t)ret_copy;
45346 jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint32_t a, uint32_t b) {
45347 LDKRetry* a_conv = (LDKRetry*)a;
45348 LDKRetry* b_conv = (LDKRetry*)b;
45349 jboolean ret_conv = Retry_eq(a_conv, b_conv);
45353 int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint32_t o) {
45354 LDKRetry* o_conv = (LDKRetry*)o;
45355 int64_t ret_conv = Retry_hash(o_conv);
45359 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
45360 if ((this_ptr & 1) != 0) return;
45361 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45362 CHECK_ACCESS(this_ptr_ptr);
45363 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45364 FREE((void*)this_ptr);
45365 PaymentError_free(this_ptr_conv);
45368 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45369 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45370 *ret_copy = PaymentError_clone(arg);
45371 uint32_t ret_ref = (uintptr_t)ret_copy;
45374 uint32_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
45375 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
45376 uint32_t ret_conv = PaymentError_clone_ptr(arg_conv);
45380 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
45381 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
45382 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45383 *ret_copy = PaymentError_clone(orig_conv);
45384 uint32_t ret_ref = (uintptr_t)ret_copy;
45388 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
45389 LDKStr a_conv = str_ref_to_owned_c(a);
45390 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45391 *ret_copy = PaymentError_invoice(a_conv);
45392 uint32_t ret_ref = (uintptr_t)ret_copy;
45396 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
45397 LDKLightningError a_conv;
45398 a_conv.inner = (void*)(a & (~1));
45399 a_conv.is_owned = (a & 1) || (a == 0);
45400 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45401 a_conv = LightningError_clone(&a_conv);
45402 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45403 *ret_copy = PaymentError_routing(a_conv);
45404 uint32_t ret_ref = (uintptr_t)ret_copy;
45408 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
45409 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45410 CHECK_ACCESS(a_ptr);
45411 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45412 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
45413 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45414 *ret_copy = PaymentError_sending(a_conv);
45415 uint32_t ret_ref = (uintptr_t)ret_copy;
45419 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) {
45420 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
45421 CHECK_ACCESS(payer_ptr);
45422 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45423 if (payer_conv.free == LDKPayer_JCalls_free) {
45424 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45425 LDKPayer_JCalls_cloned(&payer_conv);
45427 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
45428 CHECK_ACCESS(router_ptr);
45429 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45430 if (router_conv.free == LDKRouter_JCalls_free) {
45431 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45432 LDKRouter_JCalls_cloned(&router_conv);
45434 LDKMultiThreadedLockableScore scorer_conv;
45435 scorer_conv.inner = (void*)(scorer & (~1));
45436 scorer_conv.is_owned = false;
45437 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45438 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45439 CHECK_ACCESS(logger_ptr);
45440 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45441 if (logger_conv.free == LDKLogger_JCalls_free) {
45442 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45443 LDKLogger_JCalls_cloned(&logger_conv);
45445 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
45446 CHECK_ACCESS(event_handler_ptr);
45447 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45448 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45449 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45450 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45452 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
45453 CHECK_ACCESS(retry_ptr);
45454 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
45455 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
45456 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
45457 uint32_t ret_ref = 0;
45458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45461 ret_ref = (uintptr_t)ret_var.inner;
45462 if (ret_var.is_owned) {
45468 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
45469 LDKInvoicePayer this_arg_conv;
45470 this_arg_conv.inner = (void*)(this_arg & (~1));
45471 this_arg_conv.is_owned = false;
45472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45473 LDKInvoice invoice_conv;
45474 invoice_conv.inner = (void*)(invoice & (~1));
45475 invoice_conv.is_owned = false;
45476 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45477 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45478 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45479 return (uint32_t)ret_conv;
45482 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) {
45483 LDKInvoicePayer this_arg_conv;
45484 this_arg_conv.inner = (void*)(this_arg & (~1));
45485 this_arg_conv.is_owned = false;
45486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45487 LDKInvoice invoice_conv;
45488 invoice_conv.inner = (void*)(invoice & (~1));
45489 invoice_conv.is_owned = false;
45490 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45491 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45492 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45493 return (uint32_t)ret_conv;
45496 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) {
45497 LDKInvoicePayer this_arg_conv;
45498 this_arg_conv.inner = (void*)(this_arg & (~1));
45499 this_arg_conv.is_owned = false;
45500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45501 LDKPublicKey pubkey_ref;
45502 CHECK(pubkey->arr_len == 33);
45503 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45504 LDKThirtyTwoBytes payment_preimage_ref;
45505 CHECK(payment_preimage->arr_len == 32);
45506 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
45507 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45508 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
45509 return (uint32_t)ret_conv;
45512 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
45513 LDKInvoicePayer this_arg_conv;
45514 this_arg_conv.inner = (void*)(this_arg & (~1));
45515 this_arg_conv.is_owned = false;
45516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45517 unsigned char payment_hash_arr[32];
45518 CHECK(payment_hash->arr_len == 32);
45519 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
45520 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
45521 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45524 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
45525 LDKInvoicePayer this_arg_conv;
45526 this_arg_conv.inner = (void*)(this_arg & (~1));
45527 this_arg_conv.is_owned = false;
45528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45529 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45530 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45531 return (uint32_t)ret_ret;
45534 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) {
45535 LDKChannelManager channelmanager_conv;
45536 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45537 channelmanager_conv.is_owned = false;
45538 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45539 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45540 CHECK_ACCESS(keys_manager_ptr);
45541 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45542 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45543 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45544 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45546 LDKCurrency network_conv = LDKCurrency_from_js(network);
45547 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45548 CHECK_ACCESS(amt_msat_ptr);
45549 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45550 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45551 LDKSha256 description_hash_conv;
45552 description_hash_conv.inner = (void*)(description_hash & (~1));
45553 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
45554 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
45555 description_hash_conv = Sha256_clone(&description_hash_conv);
45556 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45557 *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);
45558 return (uint32_t)ret_conv;
45561 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) {
45562 LDKChannelManager channelmanager_conv;
45563 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45564 channelmanager_conv.is_owned = false;
45565 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45566 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45567 CHECK_ACCESS(keys_manager_ptr);
45568 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45569 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45570 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45571 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45573 LDKCurrency network_conv = LDKCurrency_from_js(network);
45574 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45575 CHECK_ACCESS(amt_msat_ptr);
45576 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45577 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45578 LDKStr description_conv = str_ref_to_owned_c(description);
45579 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45580 *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);
45581 return (uint32_t)ret_conv;
45584 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
45585 LDKDefaultRouter this_obj_conv;
45586 this_obj_conv.inner = (void*)(this_obj & (~1));
45587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45589 DefaultRouter_free(this_obj_conv);
45592 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger, int8_tArray random_seed_bytes) {
45593 LDKNetworkGraph network_graph_conv;
45594 network_graph_conv.inner = (void*)(network_graph & (~1));
45595 network_graph_conv.is_owned = false;
45596 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45597 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45598 CHECK_ACCESS(logger_ptr);
45599 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45600 if (logger_conv.free == LDKLogger_JCalls_free) {
45601 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45602 LDKLogger_JCalls_cloned(&logger_conv);
45604 LDKThirtyTwoBytes random_seed_bytes_ref;
45605 CHECK(random_seed_bytes->arr_len == 32);
45606 memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45607 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
45608 uint32_t ret_ref = 0;
45609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45612 ret_ref = (uintptr_t)ret_var.inner;
45613 if (ret_var.is_owned) {
45619 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
45620 LDKDefaultRouter this_arg_conv;
45621 this_arg_conv.inner = (void*)(this_arg & (~1));
45622 this_arg_conv.is_owned = false;
45623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45624 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45625 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45626 return (uint32_t)ret_ret;
45629 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
45630 LDKChannelManager this_arg_conv;
45631 this_arg_conv.inner = (void*)(this_arg & (~1));
45632 this_arg_conv.is_owned = false;
45633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45634 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
45635 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
45636 return (uint32_t)ret_ret;
45639 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
45640 LDKStr s_conv = str_ref_to_owned_c(s);
45641 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
45642 *ret_conv = SiPrefix_from_str(s_conv);
45643 return (uint32_t)ret_conv;
45646 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
45647 LDKStr s_conv = str_ref_to_owned_c(s);
45648 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
45649 *ret_conv = Invoice_from_str(s_conv);
45650 return (uint32_t)ret_conv;
45653 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
45654 LDKStr s_conv = str_ref_to_owned_c(s);
45655 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
45656 *ret_conv = SignedRawInvoice_from_str(s_conv);
45657 return (uint32_t)ret_conv;
45660 jstring __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint32_t o) {
45661 LDKParseError* o_conv = (LDKParseError*)o;
45662 LDKStr ret_str = ParseError_to_str(o_conv);
45663 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45668 jstring __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint32_t o) {
45669 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
45670 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
45671 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45676 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
45678 o_conv.inner = (void*)(o & (~1));
45679 o_conv.is_owned = false;
45680 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45681 LDKStr ret_str = Invoice_to_str(&o_conv);
45682 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45687 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
45688 LDKSignedRawInvoice o_conv;
45689 o_conv.inner = (void*)(o & (~1));
45690 o_conv.is_owned = false;
45691 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45692 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
45693 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45698 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
45699 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
45700 LDKStr ret_str = Currency_to_str(o_conv);
45701 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45706 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
45707 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
45708 LDKStr ret_str = SiPrefix_to_str(o_conv);
45709 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);