1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18 return val == 0xdeadbeef0badf00dULL;
22 void *malloc(size_t size);
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
40 #define DECL_ARR_TYPE(ty, name) \
41 struct name##array { \
45 typedef struct name##array * name##Array; \
46 static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), #name" array init", lineno); \
48 arr->arr_len = arr_len; \
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(int8_t, int8_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60 charArray arr = init_charArray(len, __LINE__);
61 memcpy(arr->elems, chars, len);
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65 char* newchars = MALLOC(str->arr_len + 1, "String chars");
66 memcpy(newchars, str->elems, str->arr_len);
67 newchars[str->arr_len] = 0;
71 .chars_is_owned = true
76 typedef bool jboolean;
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79 return (uint32_t)MALLOC(size, "JS-Called malloc");
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86 const char *res = check_get_ldk_bindings_version();
87 if (res == NULL) return NULL;
88 return str_ref_to_ts(res, strlen(res));
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91 const char *res = check_get_ldk_version();
92 if (res == NULL) return NULL;
93 return str_ref_to_ts(res, strlen(res));
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
99 case 0: return LDKAccessError_UnknownChain;
100 case 1: return LDKAccessError_UnknownTx;
104 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
106 case LDKAccessError_UnknownChain: return 0;
107 case LDKAccessError_UnknownTx: return 1;
111 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
113 case 0: return LDKCOption_NoneZ_Some;
114 case 1: return LDKCOption_NoneZ_None;
118 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
120 case LDKCOption_NoneZ_Some: return 0;
121 case LDKCOption_NoneZ_None: return 1;
125 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
127 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
128 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
132 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
134 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
135 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
139 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
141 case 0: return LDKConfirmationTarget_Background;
142 case 1: return LDKConfirmationTarget_Normal;
143 case 2: return LDKConfirmationTarget_HighPriority;
147 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
149 case LDKConfirmationTarget_Background: return 0;
150 case LDKConfirmationTarget_Normal: return 1;
151 case LDKConfirmationTarget_HighPriority: return 2;
155 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
157 case 0: return LDKCreationError_DescriptionTooLong;
158 case 1: return LDKCreationError_RouteTooLong;
159 case 2: return LDKCreationError_TimestampOutOfBounds;
160 case 3: return LDKCreationError_InvalidAmount;
161 case 4: return LDKCreationError_MissingRouteHints;
165 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
167 case LDKCreationError_DescriptionTooLong: return 0;
168 case LDKCreationError_RouteTooLong: return 1;
169 case LDKCreationError_TimestampOutOfBounds: return 2;
170 case LDKCreationError_InvalidAmount: return 3;
171 case LDKCreationError_MissingRouteHints: return 4;
175 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
177 case 0: return LDKCurrency_Bitcoin;
178 case 1: return LDKCurrency_BitcoinTestnet;
179 case 2: return LDKCurrency_Regtest;
180 case 3: return LDKCurrency_Simnet;
181 case 4: return LDKCurrency_Signet;
185 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
187 case LDKCurrency_Bitcoin: return 0;
188 case LDKCurrency_BitcoinTestnet: return 1;
189 case LDKCurrency_Regtest: return 2;
190 case LDKCurrency_Simnet: return 3;
191 case LDKCurrency_Signet: return 4;
195 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
197 case 0: return LDKIOError_NotFound;
198 case 1: return LDKIOError_PermissionDenied;
199 case 2: return LDKIOError_ConnectionRefused;
200 case 3: return LDKIOError_ConnectionReset;
201 case 4: return LDKIOError_ConnectionAborted;
202 case 5: return LDKIOError_NotConnected;
203 case 6: return LDKIOError_AddrInUse;
204 case 7: return LDKIOError_AddrNotAvailable;
205 case 8: return LDKIOError_BrokenPipe;
206 case 9: return LDKIOError_AlreadyExists;
207 case 10: return LDKIOError_WouldBlock;
208 case 11: return LDKIOError_InvalidInput;
209 case 12: return LDKIOError_InvalidData;
210 case 13: return LDKIOError_TimedOut;
211 case 14: return LDKIOError_WriteZero;
212 case 15: return LDKIOError_Interrupted;
213 case 16: return LDKIOError_Other;
214 case 17: return LDKIOError_UnexpectedEof;
218 static inline int32_t LDKIOError_to_js(LDKIOError val) {
220 case LDKIOError_NotFound: return 0;
221 case LDKIOError_PermissionDenied: return 1;
222 case LDKIOError_ConnectionRefused: return 2;
223 case LDKIOError_ConnectionReset: return 3;
224 case LDKIOError_ConnectionAborted: return 4;
225 case LDKIOError_NotConnected: return 5;
226 case LDKIOError_AddrInUse: return 6;
227 case LDKIOError_AddrNotAvailable: return 7;
228 case LDKIOError_BrokenPipe: return 8;
229 case LDKIOError_AlreadyExists: return 9;
230 case LDKIOError_WouldBlock: return 10;
231 case LDKIOError_InvalidInput: return 11;
232 case LDKIOError_InvalidData: return 12;
233 case LDKIOError_TimedOut: return 13;
234 case LDKIOError_WriteZero: return 14;
235 case LDKIOError_Interrupted: return 15;
236 case LDKIOError_Other: return 16;
237 case LDKIOError_UnexpectedEof: return 17;
241 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
243 case 0: return LDKLevel_Gossip;
244 case 1: return LDKLevel_Trace;
245 case 2: return LDKLevel_Debug;
246 case 3: return LDKLevel_Info;
247 case 4: return LDKLevel_Warn;
248 case 5: return LDKLevel_Error;
252 static inline int32_t LDKLevel_to_js(LDKLevel val) {
254 case LDKLevel_Gossip: return 0;
255 case LDKLevel_Trace: return 1;
256 case LDKLevel_Debug: return 2;
257 case LDKLevel_Info: return 3;
258 case LDKLevel_Warn: return 4;
259 case LDKLevel_Error: return 5;
263 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
265 case 0: return LDKNetwork_Bitcoin;
266 case 1: return LDKNetwork_Testnet;
267 case 2: return LDKNetwork_Regtest;
268 case 3: return LDKNetwork_Signet;
272 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
274 case LDKNetwork_Bitcoin: return 0;
275 case LDKNetwork_Testnet: return 1;
276 case LDKNetwork_Regtest: return 2;
277 case LDKNetwork_Signet: return 3;
281 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
283 case 0: return LDKRecipient_Node;
284 case 1: return LDKRecipient_PhantomNode;
288 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
290 case LDKRecipient_Node: return 0;
291 case LDKRecipient_PhantomNode: return 1;
295 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
297 case 0: return LDKSecp256k1Error_IncorrectSignature;
298 case 1: return LDKSecp256k1Error_InvalidMessage;
299 case 2: return LDKSecp256k1Error_InvalidPublicKey;
300 case 3: return LDKSecp256k1Error_InvalidSignature;
301 case 4: return LDKSecp256k1Error_InvalidSecretKey;
302 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
303 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
304 case 7: return LDKSecp256k1Error_InvalidTweak;
305 case 8: return LDKSecp256k1Error_NotEnoughMemory;
306 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
307 case 10: return LDKSecp256k1Error_InvalidParityValue;
311 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
313 case LDKSecp256k1Error_IncorrectSignature: return 0;
314 case LDKSecp256k1Error_InvalidMessage: return 1;
315 case LDKSecp256k1Error_InvalidPublicKey: return 2;
316 case LDKSecp256k1Error_InvalidSignature: return 3;
317 case LDKSecp256k1Error_InvalidSecretKey: return 4;
318 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
319 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
320 case LDKSecp256k1Error_InvalidTweak: return 7;
321 case LDKSecp256k1Error_NotEnoughMemory: return 8;
322 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
323 case LDKSecp256k1Error_InvalidParityValue: return 10;
327 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
329 case 0: return LDKSemanticError_NoPaymentHash;
330 case 1: return LDKSemanticError_MultiplePaymentHashes;
331 case 2: return LDKSemanticError_NoDescription;
332 case 3: return LDKSemanticError_MultipleDescriptions;
333 case 4: return LDKSemanticError_NoPaymentSecret;
334 case 5: return LDKSemanticError_MultiplePaymentSecrets;
335 case 6: return LDKSemanticError_InvalidFeatures;
336 case 7: return LDKSemanticError_InvalidRecoveryId;
337 case 8: return LDKSemanticError_InvalidSignature;
338 case 9: return LDKSemanticError_ImpreciseAmount;
342 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
344 case LDKSemanticError_NoPaymentHash: return 0;
345 case LDKSemanticError_MultiplePaymentHashes: return 1;
346 case LDKSemanticError_NoDescription: return 2;
347 case LDKSemanticError_MultipleDescriptions: return 3;
348 case LDKSemanticError_NoPaymentSecret: return 4;
349 case LDKSemanticError_MultiplePaymentSecrets: return 5;
350 case LDKSemanticError_InvalidFeatures: return 6;
351 case LDKSemanticError_InvalidRecoveryId: return 7;
352 case LDKSemanticError_InvalidSignature: return 8;
353 case LDKSemanticError_ImpreciseAmount: return 9;
357 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
359 case 0: return LDKSiPrefix_Milli;
360 case 1: return LDKSiPrefix_Micro;
361 case 2: return LDKSiPrefix_Nano;
362 case 3: return LDKSiPrefix_Pico;
366 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
368 case LDKSiPrefix_Milli: return 0;
369 case LDKSiPrefix_Micro: return 1;
370 case LDKSiPrefix_Nano: return 2;
371 case LDKSiPrefix_Pico: return 3;
375 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint32_t ptr) {
376 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
378 case LDKBech32Error_MissingSeparator: return 0;
379 case LDKBech32Error_InvalidChecksum: return 1;
380 case LDKBech32Error_InvalidLength: return 2;
381 case LDKBech32Error_InvalidChar: return 3;
382 case LDKBech32Error_InvalidData: return 4;
383 case LDKBech32Error_InvalidPadding: return 5;
384 case LDKBech32Error_MixedCase: return 6;
388 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint32_t ptr) {
389 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
390 assert(obj->tag == LDKBech32Error_InvalidChar);
391 int32_t invalid_char_conv = obj->invalid_char;
392 return invalid_char_conv;
394 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint32_t ptr) {
395 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
396 assert(obj->tag == LDKBech32Error_InvalidData);
397 int8_t invalid_data_conv = obj->invalid_data;
398 return invalid_data_conv;
400 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
401 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
402 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
405 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
406 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
407 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
408 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
409 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
410 CVec_u8Z_free(ret_var);
414 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint32_t thing) {
415 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
416 int64_t ret_conv = TxOut_get_value(thing_conv);
420 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
421 CHECK(owner->result_ok);
422 return *owner->contents.result;
424 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
425 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
426 CResult_NoneNoneZ_get_ok(owner_conv);
429 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
430 CHECK(!owner->result_ok);
431 return *owner->contents.err;
433 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
434 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
435 CResult_NoneNoneZ_get_err(owner_conv);
438 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
439 CHECK(owner->result_ok);
440 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
442 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint32_t owner) {
443 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
444 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
445 uint32_t ret_ref = 0;
446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
449 ret_ref = (uintptr_t)ret_var.inner;
450 if (ret_var.is_owned) {
456 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
457 CHECK(!owner->result_ok);
458 return DecodeError_clone(&*owner->contents.err);
460 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint32_t owner) {
461 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
462 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
463 uint32_t ret_ref = 0;
464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
467 ret_ref = (uintptr_t)ret_var.inner;
468 if (ret_var.is_owned) {
474 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
475 CHECK(owner->result_ok);
476 return *owner->contents.result;
478 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
479 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
480 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
481 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
485 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
486 CHECK(!owner->result_ok);
487 return *owner->contents.err;
489 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
490 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
491 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
495 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
496 CHECK(owner->result_ok);
497 return *owner->contents.result;
499 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
500 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
501 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
502 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
506 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
507 CHECK(!owner->result_ok);
508 return *owner->contents.err;
510 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
511 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
512 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
516 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
517 CHECK(owner->result_ok);
518 return TxCreationKeys_clone(&*owner->contents.result);
520 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
521 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
522 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
523 uint32_t ret_ref = 0;
524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
527 ret_ref = (uintptr_t)ret_var.inner;
528 if (ret_var.is_owned) {
534 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
535 CHECK(!owner->result_ok);
536 return DecodeError_clone(&*owner->contents.err);
538 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
539 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
540 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
541 uint32_t ret_ref = 0;
542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
545 ret_ref = (uintptr_t)ret_var.inner;
546 if (ret_var.is_owned) {
552 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
553 CHECK(owner->result_ok);
554 return ChannelPublicKeys_clone(&*owner->contents.result);
556 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
557 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
558 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
559 uint32_t ret_ref = 0;
560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
563 ret_ref = (uintptr_t)ret_var.inner;
564 if (ret_var.is_owned) {
570 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
571 CHECK(!owner->result_ok);
572 return DecodeError_clone(&*owner->contents.err);
574 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
575 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
576 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
577 uint32_t ret_ref = 0;
578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
581 ret_ref = (uintptr_t)ret_var.inner;
582 if (ret_var.is_owned) {
588 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
589 CHECK(owner->result_ok);
590 return TxCreationKeys_clone(&*owner->contents.result);
592 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
593 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
594 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
595 uint32_t ret_ref = 0;
596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
599 ret_ref = (uintptr_t)ret_var.inner;
600 if (ret_var.is_owned) {
606 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
607 CHECK(!owner->result_ok);
608 return *owner->contents.err;
610 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
611 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
612 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
616 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
617 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
619 case LDKCOption_u32Z_Some: return 0;
620 case LDKCOption_u32Z_None: return 1;
624 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
625 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
626 assert(obj->tag == LDKCOption_u32Z_Some);
627 int32_t some_conv = obj->some;
630 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
631 CHECK(owner->result_ok);
632 return HTLCOutputInCommitment_clone(&*owner->contents.result);
634 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
635 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
636 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
637 uint32_t ret_ref = 0;
638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
641 ret_ref = (uintptr_t)ret_var.inner;
642 if (ret_var.is_owned) {
648 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
649 CHECK(!owner->result_ok);
650 return DecodeError_clone(&*owner->contents.err);
652 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
653 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
654 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
655 uint32_t ret_ref = 0;
656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
659 ret_ref = (uintptr_t)ret_var.inner;
660 if (ret_var.is_owned) {
666 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
667 CHECK(owner->result_ok);
668 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
670 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
671 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
672 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
673 uint32_t ret_ref = 0;
674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
677 ret_ref = (uintptr_t)ret_var.inner;
678 if (ret_var.is_owned) {
684 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
685 CHECK(!owner->result_ok);
686 return DecodeError_clone(&*owner->contents.err);
688 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
689 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
690 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
691 uint32_t ret_ref = 0;
692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
695 ret_ref = (uintptr_t)ret_var.inner;
696 if (ret_var.is_owned) {
702 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
703 CHECK(owner->result_ok);
704 return ChannelTransactionParameters_clone(&*owner->contents.result);
706 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
707 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
708 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
709 uint32_t ret_ref = 0;
710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
713 ret_ref = (uintptr_t)ret_var.inner;
714 if (ret_var.is_owned) {
720 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
721 CHECK(!owner->result_ok);
722 return DecodeError_clone(&*owner->contents.err);
724 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
725 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
726 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
727 uint32_t ret_ref = 0;
728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
731 ret_ref = (uintptr_t)ret_var.inner;
732 if (ret_var.is_owned) {
738 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
739 CHECK(owner->result_ok);
740 return HolderCommitmentTransaction_clone(&*owner->contents.result);
742 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
743 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
744 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
745 uint32_t ret_ref = 0;
746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
749 ret_ref = (uintptr_t)ret_var.inner;
750 if (ret_var.is_owned) {
756 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
757 CHECK(!owner->result_ok);
758 return DecodeError_clone(&*owner->contents.err);
760 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
761 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
762 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
763 uint32_t ret_ref = 0;
764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
767 ret_ref = (uintptr_t)ret_var.inner;
768 if (ret_var.is_owned) {
774 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
775 CHECK(owner->result_ok);
776 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
778 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
779 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
780 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
781 uint32_t ret_ref = 0;
782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
785 ret_ref = (uintptr_t)ret_var.inner;
786 if (ret_var.is_owned) {
792 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
793 CHECK(!owner->result_ok);
794 return DecodeError_clone(&*owner->contents.err);
796 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
797 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
798 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
799 uint32_t ret_ref = 0;
800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
803 ret_ref = (uintptr_t)ret_var.inner;
804 if (ret_var.is_owned) {
810 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
811 CHECK(owner->result_ok);
812 return &*owner->contents.result;
814 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
815 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
816 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
817 uint32_t ret_ref = 0;
818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
821 ret_ref = (uintptr_t)ret_var.inner & ~1;
825 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
826 CHECK(!owner->result_ok);
827 return *owner->contents.err;
829 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
830 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
831 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
834 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
835 CHECK(owner->result_ok);
836 return CommitmentTransaction_clone(&*owner->contents.result);
838 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
839 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
840 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
841 uint32_t ret_ref = 0;
842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
845 ret_ref = (uintptr_t)ret_var.inner;
846 if (ret_var.is_owned) {
852 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
853 CHECK(!owner->result_ok);
854 return DecodeError_clone(&*owner->contents.err);
856 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
857 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
858 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
859 uint32_t ret_ref = 0;
860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
863 ret_ref = (uintptr_t)ret_var.inner;
864 if (ret_var.is_owned) {
870 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
871 CHECK(owner->result_ok);
872 return &*owner->contents.result;
874 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
875 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
876 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
877 uint32_t ret_ref = 0;
878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
881 ret_ref = (uintptr_t)ret_var.inner & ~1;
885 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
886 CHECK(!owner->result_ok);
887 return *owner->contents.err;
889 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
890 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
891 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
894 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
895 CHECK(owner->result_ok);
896 return *owner->contents.result;
898 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
899 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
900 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
901 ptrArray ret_arr = NULL;
902 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
903 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
904 for (size_t m = 0; m < ret_var.datalen; m++) {
905 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
906 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
907 ret_arr_ptr[m] = ret_conv_12_arr;
913 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
914 CHECK(!owner->result_ok);
915 return *owner->contents.err;
917 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
918 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
919 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
922 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
923 CHECK(owner->result_ok);
924 return ShutdownScript_clone(&*owner->contents.result);
926 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
927 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
928 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
929 uint32_t ret_ref = 0;
930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
933 ret_ref = (uintptr_t)ret_var.inner;
934 if (ret_var.is_owned) {
940 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
941 CHECK(!owner->result_ok);
942 return DecodeError_clone(&*owner->contents.err);
944 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
945 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
946 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
947 uint32_t ret_ref = 0;
948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
951 ret_ref = (uintptr_t)ret_var.inner;
952 if (ret_var.is_owned) {
958 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
959 CHECK(owner->result_ok);
960 return ShutdownScript_clone(&*owner->contents.result);
962 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
963 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
964 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
965 uint32_t ret_ref = 0;
966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
969 ret_ref = (uintptr_t)ret_var.inner;
970 if (ret_var.is_owned) {
976 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
977 CHECK(!owner->result_ok);
978 return InvalidShutdownScript_clone(&*owner->contents.err);
980 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
981 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
982 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
983 uint32_t ret_ref = 0;
984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
987 ret_ref = (uintptr_t)ret_var.inner;
988 if (ret_var.is_owned) {
994 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
995 CHECK(owner->result_ok);
996 return RouteHop_clone(&*owner->contents.result);
998 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
999 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1000 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1001 uint32_t ret_ref = 0;
1002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1005 ret_ref = (uintptr_t)ret_var.inner;
1006 if (ret_var.is_owned) {
1012 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1013 CHECK(!owner->result_ok);
1014 return DecodeError_clone(&*owner->contents.err);
1016 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
1017 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1018 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1019 uint32_t ret_ref = 0;
1020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1023 ret_ref = (uintptr_t)ret_var.inner;
1024 if (ret_var.is_owned) {
1030 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1031 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1032 for (size_t i = 0; i < ret.datalen; i++) {
1033 ret.data[i] = RouteHop_clone(&orig->data[i]);
1037 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1038 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1039 for (size_t i = 0; i < ret.datalen; i++) {
1040 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1044 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1045 CHECK(owner->result_ok);
1046 return Route_clone(&*owner->contents.result);
1048 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
1049 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1050 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1051 uint32_t ret_ref = 0;
1052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1055 ret_ref = (uintptr_t)ret_var.inner;
1056 if (ret_var.is_owned) {
1062 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1063 CHECK(!owner->result_ok);
1064 return DecodeError_clone(&*owner->contents.err);
1066 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
1067 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1068 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1069 uint32_t ret_ref = 0;
1070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1073 ret_ref = (uintptr_t)ret_var.inner;
1074 if (ret_var.is_owned) {
1080 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1081 CHECK(owner->result_ok);
1082 return RouteParameters_clone(&*owner->contents.result);
1084 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
1085 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1086 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1087 uint32_t ret_ref = 0;
1088 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1089 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1091 ret_ref = (uintptr_t)ret_var.inner;
1092 if (ret_var.is_owned) {
1098 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1099 CHECK(!owner->result_ok);
1100 return DecodeError_clone(&*owner->contents.err);
1102 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
1103 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1104 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1105 uint32_t ret_ref = 0;
1106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1109 ret_ref = (uintptr_t)ret_var.inner;
1110 if (ret_var.is_owned) {
1116 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1117 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1118 for (size_t i = 0; i < ret.datalen; i++) {
1119 ret.data[i] = RouteHint_clone(&orig->data[i]);
1123 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1124 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1126 case LDKCOption_u64Z_Some: return 0;
1127 case LDKCOption_u64Z_None: return 1;
1131 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1132 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1133 assert(obj->tag == LDKCOption_u64Z_Some);
1134 int64_t some_conv = obj->some;
1137 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1138 CHECK(owner->result_ok);
1139 return PaymentParameters_clone(&*owner->contents.result);
1141 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint32_t owner) {
1142 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1143 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1144 uint32_t ret_ref = 0;
1145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1148 ret_ref = (uintptr_t)ret_var.inner;
1149 if (ret_var.is_owned) {
1155 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1156 CHECK(!owner->result_ok);
1157 return DecodeError_clone(&*owner->contents.err);
1159 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint32_t owner) {
1160 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1161 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1162 uint32_t ret_ref = 0;
1163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1166 ret_ref = (uintptr_t)ret_var.inner;
1167 if (ret_var.is_owned) {
1173 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1174 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1175 for (size_t i = 0; i < ret.datalen; i++) {
1176 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1180 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1181 CHECK(owner->result_ok);
1182 return RouteHint_clone(&*owner->contents.result);
1184 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
1185 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1186 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1187 uint32_t ret_ref = 0;
1188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1191 ret_ref = (uintptr_t)ret_var.inner;
1192 if (ret_var.is_owned) {
1198 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1199 CHECK(!owner->result_ok);
1200 return DecodeError_clone(&*owner->contents.err);
1202 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
1203 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1204 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1205 uint32_t ret_ref = 0;
1206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1209 ret_ref = (uintptr_t)ret_var.inner;
1210 if (ret_var.is_owned) {
1216 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1217 CHECK(owner->result_ok);
1218 return RouteHintHop_clone(&*owner->contents.result);
1220 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
1221 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1222 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1223 uint32_t ret_ref = 0;
1224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1227 ret_ref = (uintptr_t)ret_var.inner;
1228 if (ret_var.is_owned) {
1234 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1235 CHECK(!owner->result_ok);
1236 return DecodeError_clone(&*owner->contents.err);
1238 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
1239 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1240 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1241 uint32_t ret_ref = 0;
1242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1245 ret_ref = (uintptr_t)ret_var.inner;
1246 if (ret_var.is_owned) {
1252 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1253 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1254 for (size_t i = 0; i < ret.datalen; i++) {
1255 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1259 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1260 CHECK(owner->result_ok);
1261 return Route_clone(&*owner->contents.result);
1263 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
1264 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1265 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1266 uint32_t ret_ref = 0;
1267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1270 ret_ref = (uintptr_t)ret_var.inner;
1271 if (ret_var.is_owned) {
1277 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1278 CHECK(!owner->result_ok);
1279 return LightningError_clone(&*owner->contents.err);
1281 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
1282 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1283 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1284 uint32_t ret_ref = 0;
1285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1288 ret_ref = (uintptr_t)ret_var.inner;
1289 if (ret_var.is_owned) {
1295 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1296 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1298 case LDKPaymentPurpose_InvoicePayment: return 0;
1299 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1303 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1304 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1305 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1306 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1307 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1308 return payment_preimage_arr;
1310 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1311 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1312 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1313 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1314 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1315 return payment_secret_arr;
1317 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1318 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1319 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1320 int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1321 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1322 return spontaneous_payment_arr;
1324 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1325 CHECK(owner->result_ok);
1326 return PaymentPurpose_clone(&*owner->contents.result);
1328 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint32_t owner) {
1329 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1330 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1331 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1332 uint32_t ret_ref = (uintptr_t)ret_copy;
1336 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1337 CHECK(!owner->result_ok);
1338 return DecodeError_clone(&*owner->contents.err);
1340 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint32_t owner) {
1341 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1342 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1343 uint32_t ret_ref = 0;
1344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1347 ret_ref = (uintptr_t)ret_var.inner;
1348 if (ret_var.is_owned) {
1354 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1355 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1357 case LDKClosureReason_CounterpartyForceClosed: return 0;
1358 case LDKClosureReason_HolderForceClosed: return 1;
1359 case LDKClosureReason_CooperativeClosure: return 2;
1360 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1361 case LDKClosureReason_FundingTimedOut: return 4;
1362 case LDKClosureReason_ProcessingError: return 5;
1363 case LDKClosureReason_DisconnectedPeer: return 6;
1364 case LDKClosureReason_OutdatedChannelManager: return 7;
1368 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1369 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1370 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1371 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1372 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1373 return peer_msg_conv;
1375 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1376 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1377 assert(obj->tag == LDKClosureReason_ProcessingError);
1378 LDKStr err_str = obj->processing_error.err;
1379 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1382 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
1383 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1385 case LDKCOption_ClosureReasonZ_Some: return 0;
1386 case LDKCOption_ClosureReasonZ_None: return 1;
1390 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
1391 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1392 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1393 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1396 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1397 CHECK(owner->result_ok);
1398 return COption_ClosureReasonZ_clone(&*owner->contents.result);
1400 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
1401 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1402 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1403 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1404 uint32_t ret_ref = (uintptr_t)ret_copy;
1408 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1409 CHECK(!owner->result_ok);
1410 return DecodeError_clone(&*owner->contents.err);
1412 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
1413 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1414 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1415 uint32_t ret_ref = 0;
1416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1419 ret_ref = (uintptr_t)ret_var.inner;
1420 if (ret_var.is_owned) {
1426 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1427 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1429 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1430 case LDKNetworkUpdate_ChannelFailure: return 1;
1431 case LDKNetworkUpdate_NodeFailure: return 2;
1435 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1436 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1437 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1438 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1439 uint32_t msg_ref = 0;
1440 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1441 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1442 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1443 msg_ref = (uintptr_t)msg_var.inner & ~1;
1446 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint32_t ptr) {
1447 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1448 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1449 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1450 return short_channel_id_conv;
1452 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint32_t ptr) {
1453 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1454 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1455 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1456 return is_permanent_conv;
1458 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1459 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1460 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1461 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1462 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1465 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1466 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1467 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1468 jboolean is_permanent_conv = obj->node_failure.is_permanent;
1469 return is_permanent_conv;
1471 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1472 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1474 case LDKCOption_NetworkUpdateZ_Some: return 0;
1475 case LDKCOption_NetworkUpdateZ_None: return 1;
1479 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1480 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1481 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1482 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1485 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1486 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1488 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1489 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1490 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1494 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1495 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1496 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1497 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1498 uint32_t outpoint_ref = 0;
1499 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1500 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1501 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1502 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
1503 return outpoint_ref;
1505 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1506 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1507 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1508 uint32_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1509 return (uint32_t)output_ref;
1511 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1512 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1513 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1514 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1515 uint32_t delayed_payment_output_ref = 0;
1516 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1517 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1518 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1519 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
1520 return delayed_payment_output_ref;
1522 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1523 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1524 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1525 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1526 uint32_t static_payment_output_ref = 0;
1527 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1528 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1529 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1530 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
1531 return static_payment_output_ref;
1533 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1534 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1535 for (size_t i = 0; i < ret.datalen; i++) {
1536 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1540 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1541 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1543 case LDKEvent_FundingGenerationReady: return 0;
1544 case LDKEvent_PaymentReceived: return 1;
1545 case LDKEvent_PaymentClaimed: return 2;
1546 case LDKEvent_PaymentSent: return 3;
1547 case LDKEvent_PaymentFailed: return 4;
1548 case LDKEvent_PaymentPathSuccessful: return 5;
1549 case LDKEvent_PaymentPathFailed: return 6;
1550 case LDKEvent_PendingHTLCsForwardable: return 7;
1551 case LDKEvent_SpendableOutputs: return 8;
1552 case LDKEvent_PaymentForwarded: return 9;
1553 case LDKEvent_ChannelClosed: return 10;
1554 case LDKEvent_DiscardFunding: return 11;
1555 case LDKEvent_OpenChannelRequest: return 12;
1559 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1560 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1561 assert(obj->tag == LDKEvent_FundingGenerationReady);
1562 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1563 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1564 return temporary_channel_id_arr;
1566 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint32_t ptr) {
1567 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1568 assert(obj->tag == LDKEvent_FundingGenerationReady);
1569 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1570 memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1571 return counterparty_node_id_arr;
1573 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1574 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1575 assert(obj->tag == LDKEvent_FundingGenerationReady);
1576 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1577 return channel_value_satoshis_conv;
1579 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1580 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1581 assert(obj->tag == LDKEvent_FundingGenerationReady);
1582 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1583 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1584 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1585 return output_script_arr;
1587 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1588 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1589 assert(obj->tag == LDKEvent_FundingGenerationReady);
1590 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1591 return user_channel_id_conv;
1593 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1594 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1595 assert(obj->tag == LDKEvent_PaymentReceived);
1596 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1597 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1598 return payment_hash_arr;
1600 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint32_t ptr) {
1601 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1602 assert(obj->tag == LDKEvent_PaymentReceived);
1603 int64_t amount_msat_conv = obj->payment_received.amount_msat;
1604 return amount_msat_conv;
1606 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1607 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1608 assert(obj->tag == LDKEvent_PaymentReceived);
1609 uint32_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
1612 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint32_t ptr) {
1613 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1614 assert(obj->tag == LDKEvent_PaymentClaimed);
1615 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1616 memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1617 return payment_hash_arr;
1619 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint32_t ptr) {
1620 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1621 assert(obj->tag == LDKEvent_PaymentClaimed);
1622 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1623 return amount_msat_conv;
1625 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint32_t ptr) {
1626 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1627 assert(obj->tag == LDKEvent_PaymentClaimed);
1628 uint32_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
1631 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1632 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1633 assert(obj->tag == LDKEvent_PaymentSent);
1634 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1635 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1636 return payment_id_arr;
1638 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1639 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1640 assert(obj->tag == LDKEvent_PaymentSent);
1641 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1642 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1643 return payment_preimage_arr;
1645 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1646 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1647 assert(obj->tag == LDKEvent_PaymentSent);
1648 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1649 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1650 return payment_hash_arr;
1652 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1653 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1654 assert(obj->tag == LDKEvent_PaymentSent);
1655 uint32_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
1656 return fee_paid_msat_ref;
1658 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1659 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1660 assert(obj->tag == LDKEvent_PaymentFailed);
1661 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1662 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1663 return payment_id_arr;
1665 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1666 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1667 assert(obj->tag == LDKEvent_PaymentFailed);
1668 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1669 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1670 return payment_hash_arr;
1672 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1673 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1674 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1675 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1676 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1677 return payment_id_arr;
1679 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1680 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1681 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1682 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1683 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1684 return payment_hash_arr;
1686 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1687 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1688 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1689 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1690 uint32_tArray path_arr = NULL;
1691 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1692 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1693 for (size_t k = 0; k < path_var.datalen; k++) {
1694 LDKRouteHop path_conv_10_var = path_var.data[k];
1695 uint32_t path_conv_10_ref = 0;
1696 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1697 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1698 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1699 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1700 path_arr_ptr[k] = path_conv_10_ref;
1705 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1706 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1707 assert(obj->tag == LDKEvent_PaymentPathFailed);
1708 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1709 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1710 return payment_id_arr;
1712 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1713 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1714 assert(obj->tag == LDKEvent_PaymentPathFailed);
1715 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1716 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1717 return payment_hash_arr;
1719 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1720 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1721 assert(obj->tag == LDKEvent_PaymentPathFailed);
1722 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1723 return rejected_by_dest_conv;
1725 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1726 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1727 assert(obj->tag == LDKEvent_PaymentPathFailed);
1728 uint32_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
1729 return network_update_ref;
1731 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1732 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1733 assert(obj->tag == LDKEvent_PaymentPathFailed);
1734 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1735 return all_paths_failed_conv;
1737 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1738 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1739 assert(obj->tag == LDKEvent_PaymentPathFailed);
1740 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1741 uint32_tArray path_arr = NULL;
1742 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1743 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1744 for (size_t k = 0; k < path_var.datalen; k++) {
1745 LDKRouteHop path_conv_10_var = path_var.data[k];
1746 uint32_t path_conv_10_ref = 0;
1747 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1748 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1749 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1750 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1751 path_arr_ptr[k] = path_conv_10_ref;
1756 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1757 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1758 assert(obj->tag == LDKEvent_PaymentPathFailed);
1759 uint32_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
1760 return short_channel_id_ref;
1762 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1763 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1764 assert(obj->tag == LDKEvent_PaymentPathFailed);
1765 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1766 uint32_t retry_ref = 0;
1767 if ((uintptr_t)retry_var.inner > 4096) {
1768 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1771 retry_ref = (uintptr_t)retry_var.inner & ~1;
1775 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1776 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1777 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1778 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1779 return time_forwardable_conv;
1781 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1782 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1783 assert(obj->tag == LDKEvent_SpendableOutputs);
1784 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1785 uint32_tArray outputs_arr = NULL;
1786 outputs_arr = init_uint32_tArray(outputs_var.datalen, __LINE__);
1787 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1788 for (size_t b = 0; b < outputs_var.datalen; b++) {
1789 uint32_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
1790 outputs_arr_ptr[b] = outputs_conv_27_ref;
1795 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint32_t ptr) {
1796 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1797 assert(obj->tag == LDKEvent_PaymentForwarded);
1798 int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1799 memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1800 return prev_channel_id_arr;
1802 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint32_t ptr) {
1803 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1804 assert(obj->tag == LDKEvent_PaymentForwarded);
1805 int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1806 memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1807 return next_channel_id_arr;
1809 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1810 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1811 assert(obj->tag == LDKEvent_PaymentForwarded);
1812 uint32_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1813 return fee_earned_msat_ref;
1815 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1816 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1817 assert(obj->tag == LDKEvent_PaymentForwarded);
1818 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1819 return claim_from_onchain_tx_conv;
1821 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1822 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1823 assert(obj->tag == LDKEvent_ChannelClosed);
1824 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1825 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1826 return channel_id_arr;
1828 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1829 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1830 assert(obj->tag == LDKEvent_ChannelClosed);
1831 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1832 return user_channel_id_conv;
1834 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1835 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1836 assert(obj->tag == LDKEvent_ChannelClosed);
1837 uint32_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
1840 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1841 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1842 assert(obj->tag == LDKEvent_DiscardFunding);
1843 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1844 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1845 return channel_id_arr;
1847 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1848 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1849 assert(obj->tag == LDKEvent_DiscardFunding);
1850 LDKTransaction transaction_var = obj->discard_funding.transaction;
1851 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1852 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1853 return transaction_arr;
1855 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint32_t ptr) {
1856 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1857 assert(obj->tag == LDKEvent_OpenChannelRequest);
1858 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1859 memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1860 return temporary_channel_id_arr;
1862 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint32_t ptr) {
1863 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1864 assert(obj->tag == LDKEvent_OpenChannelRequest);
1865 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1866 memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1867 return counterparty_node_id_arr;
1869 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint32_t ptr) {
1870 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1871 assert(obj->tag == LDKEvent_OpenChannelRequest);
1872 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1873 return funding_satoshis_conv;
1875 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint32_t ptr) {
1876 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1877 assert(obj->tag == LDKEvent_OpenChannelRequest);
1878 int64_t push_msat_conv = obj->open_channel_request.push_msat;
1879 return push_msat_conv;
1881 uint32_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint32_t ptr) {
1882 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1883 assert(obj->tag == LDKEvent_OpenChannelRequest);
1884 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1885 uint32_t channel_type_ref = 0;
1886 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1889 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
1890 return channel_type_ref;
1892 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
1893 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1895 case LDKCOption_EventZ_Some: return 0;
1896 case LDKCOption_EventZ_None: return 1;
1900 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
1901 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1902 assert(obj->tag == LDKCOption_EventZ_Some);
1903 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1906 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1907 CHECK(owner->result_ok);
1908 return COption_EventZ_clone(&*owner->contents.result);
1910 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
1911 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1912 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1913 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1914 uint32_t ret_ref = (uintptr_t)ret_copy;
1918 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1919 CHECK(!owner->result_ok);
1920 return DecodeError_clone(&*owner->contents.err);
1922 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
1923 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1924 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1925 uint32_t ret_ref = 0;
1926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1929 ret_ref = (uintptr_t)ret_var.inner;
1930 if (ret_var.is_owned) {
1936 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
1937 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1939 case LDKErrorAction_DisconnectPeer: return 0;
1940 case LDKErrorAction_IgnoreError: return 1;
1941 case LDKErrorAction_IgnoreAndLog: return 2;
1942 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1943 case LDKErrorAction_SendErrorMessage: return 4;
1944 case LDKErrorAction_SendWarningMessage: return 5;
1948 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
1949 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1950 assert(obj->tag == LDKErrorAction_DisconnectPeer);
1951 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1952 uint32_t msg_ref = 0;
1953 if ((uintptr_t)msg_var.inner > 4096) {
1954 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1957 msg_ref = (uintptr_t)msg_var.inner & ~1;
1961 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
1962 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1963 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
1964 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1965 return ignore_and_log_conv;
1967 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
1968 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1969 assert(obj->tag == LDKErrorAction_SendErrorMessage);
1970 LDKErrorMessage msg_var = obj->send_error_message.msg;
1971 uint32_t msg_ref = 0;
1972 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1975 msg_ref = (uintptr_t)msg_var.inner & ~1;
1978 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint32_t ptr) {
1979 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1980 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1981 LDKWarningMessage msg_var = obj->send_warning_message.msg;
1982 uint32_t msg_ref = 0;
1983 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1984 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1985 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1986 msg_ref = (uintptr_t)msg_var.inner & ~1;
1989 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint32_t ptr) {
1990 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1991 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1992 uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
1993 return log_level_conv;
1995 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
1996 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1998 case LDKMessageSendEvent_SendAcceptChannel: return 0;
1999 case LDKMessageSendEvent_SendOpenChannel: return 1;
2000 case LDKMessageSendEvent_SendFundingCreated: return 2;
2001 case LDKMessageSendEvent_SendFundingSigned: return 3;
2002 case LDKMessageSendEvent_SendChannelReady: return 4;
2003 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2004 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2005 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2006 case LDKMessageSendEvent_SendClosingSigned: return 8;
2007 case LDKMessageSendEvent_SendShutdown: return 9;
2008 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2009 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2010 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2011 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2012 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2013 case LDKMessageSendEvent_HandleError: return 15;
2014 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2015 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2016 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2017 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2021 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2022 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2023 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2024 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2025 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2028 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2029 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2030 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2031 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2032 uint32_t msg_ref = 0;
2033 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2036 msg_ref = (uintptr_t)msg_var.inner & ~1;
2039 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2040 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2041 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2042 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2043 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2046 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2047 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2048 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2049 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2050 uint32_t msg_ref = 0;
2051 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2052 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2053 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2054 msg_ref = (uintptr_t)msg_var.inner & ~1;
2057 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2058 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2059 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2060 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2061 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2064 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2065 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2066 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2067 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2068 uint32_t msg_ref = 0;
2069 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2070 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2072 msg_ref = (uintptr_t)msg_var.inner & ~1;
2075 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2076 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2077 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2078 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2079 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2082 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2083 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2084 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2085 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2086 uint32_t msg_ref = 0;
2087 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2088 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2090 msg_ref = (uintptr_t)msg_var.inner & ~1;
2093 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint32_t ptr) {
2094 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2095 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2096 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2097 memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2100 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint32_t ptr) {
2101 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2102 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2103 LDKChannelReady msg_var = obj->send_channel_ready.msg;
2104 uint32_t msg_ref = 0;
2105 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2106 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2107 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2108 msg_ref = (uintptr_t)msg_var.inner & ~1;
2111 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2112 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2113 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2114 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2115 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2118 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2119 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2120 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2121 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2122 uint32_t msg_ref = 0;
2123 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2124 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2125 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2126 msg_ref = (uintptr_t)msg_var.inner & ~1;
2129 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
2130 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2131 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2132 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2133 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2136 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
2137 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2138 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2139 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2140 uint32_t updates_ref = 0;
2141 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2144 updates_ref = (uintptr_t)updates_var.inner & ~1;
2147 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
2148 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2149 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2150 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2151 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2154 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
2155 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2156 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2157 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2158 uint32_t msg_ref = 0;
2159 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2160 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2161 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2162 msg_ref = (uintptr_t)msg_var.inner & ~1;
2165 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
2166 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2167 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2168 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2169 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2172 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
2173 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2174 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2175 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2176 uint32_t msg_ref = 0;
2177 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2178 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2180 msg_ref = (uintptr_t)msg_var.inner & ~1;
2183 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
2184 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2185 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2186 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2187 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2190 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
2191 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2192 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2193 LDKShutdown msg_var = obj->send_shutdown.msg;
2194 uint32_t msg_ref = 0;
2195 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2196 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2197 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2198 msg_ref = (uintptr_t)msg_var.inner & ~1;
2201 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
2202 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2203 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2204 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2205 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2208 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
2209 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2210 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2211 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2212 uint32_t msg_ref = 0;
2213 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2214 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2215 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2216 msg_ref = (uintptr_t)msg_var.inner & ~1;
2219 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
2220 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2221 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2222 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2223 uint32_t msg_ref = 0;
2224 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2225 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2226 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2227 msg_ref = (uintptr_t)msg_var.inner & ~1;
2230 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
2231 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2232 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2233 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2234 uint32_t update_msg_ref = 0;
2235 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2236 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2237 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2238 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2239 return update_msg_ref;
2241 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
2242 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2243 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2244 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2245 uint32_t msg_ref = 0;
2246 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2247 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2248 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2249 msg_ref = (uintptr_t)msg_var.inner & ~1;
2252 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
2253 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2254 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2255 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2256 uint32_t msg_ref = 0;
2257 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2258 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2259 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2260 msg_ref = (uintptr_t)msg_var.inner & ~1;
2263 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
2264 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2265 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2266 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2267 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2270 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
2271 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2272 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2273 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2274 uint32_t msg_ref = 0;
2275 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2276 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2277 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2278 msg_ref = (uintptr_t)msg_var.inner & ~1;
2281 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
2282 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2283 assert(obj->tag == LDKMessageSendEvent_HandleError);
2284 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2285 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2288 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
2289 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2290 assert(obj->tag == LDKMessageSendEvent_HandleError);
2291 uint32_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2294 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
2295 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2296 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2297 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2298 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2301 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
2302 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2303 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2304 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2305 uint32_t msg_ref = 0;
2306 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2307 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2308 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2309 msg_ref = (uintptr_t)msg_var.inner & ~1;
2312 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
2313 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2314 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2315 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2316 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2319 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
2320 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2321 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2322 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2323 uint32_t msg_ref = 0;
2324 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2327 msg_ref = (uintptr_t)msg_var.inner & ~1;
2330 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
2331 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2332 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2333 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2334 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2337 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
2338 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2339 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2340 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2341 uint32_t msg_ref = 0;
2342 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2343 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2344 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2345 msg_ref = (uintptr_t)msg_var.inner & ~1;
2348 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint32_t ptr) {
2349 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2350 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2351 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2352 memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2355 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint32_t ptr) {
2356 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2357 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2358 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2359 uint32_t msg_ref = 0;
2360 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2361 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2362 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2363 msg_ref = (uintptr_t)msg_var.inner & ~1;
2366 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2367 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2368 for (size_t i = 0; i < ret.datalen; i++) {
2369 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2373 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2374 CHECK(owner->result_ok);
2375 return TxOut_clone(&*owner->contents.result);
2377 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
2378 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2379 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2380 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2381 return (uint32_t)ret_ref;
2384 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2385 CHECK(!owner->result_ok);
2386 return AccessError_clone(&*owner->contents.err);
2388 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
2389 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2390 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2394 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2397 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
2398 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2399 uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2403 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2406 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
2407 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2408 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2409 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2410 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2414 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2415 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2416 for (size_t i = 0; i < ret.datalen; i++) {
2417 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2421 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2422 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2423 for (size_t i = 0; i < ret.datalen; i++) {
2424 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2428 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2429 CHECK(owner->result_ok);
2430 return *owner->contents.result;
2432 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
2433 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2434 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2437 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2438 CHECK(!owner->result_ok);
2439 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2441 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
2442 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2443 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2447 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
2448 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2450 case LDKMonitorEvent_HTLCEvent: return 0;
2451 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2452 case LDKMonitorEvent_UpdateCompleted: return 2;
2453 case LDKMonitorEvent_UpdateFailed: return 3;
2457 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
2458 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2459 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2460 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2461 uint32_t htlc_event_ref = 0;
2462 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2463 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2464 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2465 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2466 return htlc_event_ref;
2468 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
2469 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2470 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2471 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2472 uint32_t commitment_tx_confirmed_ref = 0;
2473 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2474 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2475 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2476 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2477 return commitment_tx_confirmed_ref;
2479 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
2480 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2481 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2482 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2483 uint32_t funding_txo_ref = 0;
2484 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2485 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2486 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2487 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2488 return funding_txo_ref;
2490 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
2491 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2492 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2493 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2494 return monitor_update_id_conv;
2496 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
2497 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2498 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2499 LDKOutPoint update_failed_var = obj->update_failed;
2500 uint32_t update_failed_ref = 0;
2501 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2502 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2503 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2504 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2505 return update_failed_ref;
2507 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2508 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2509 for (size_t i = 0; i < ret.datalen; i++) {
2510 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2514 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2515 return OutPoint_clone(&owner->a);
2517 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a(uint32_t owner) {
2518 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2519 LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv);
2520 uint32_t ret_ref = 0;
2521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2524 ret_ref = (uintptr_t)ret_var.inner;
2525 if (ret_var.is_owned) {
2531 static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2532 return CVec_MonitorEventZ_clone(&owner->b);
2534 uint32_tArray __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b(uint32_t owner) {
2535 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2536 LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv);
2537 uint32_tArray ret_arr = NULL;
2538 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
2539 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
2540 for (size_t o = 0; o < ret_var.datalen; o++) {
2541 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2542 *ret_conv_14_copy = ret_var.data[o];
2543 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
2544 ret_arr_ptr[o] = ret_conv_14_ref;
2551 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) {
2552 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen };
2553 for (size_t i = 0; i < ret.datalen; i++) {
2554 ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]);
2558 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
2559 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2561 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2562 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2566 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
2567 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2568 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2569 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2570 *some_conv = obj->some;
2571 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2572 return ((uint32_t)some_conv);
2574 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2575 CHECK(owner->result_ok);
2576 return FixedPenaltyScorer_clone(&*owner->contents.result);
2578 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint32_t owner) {
2579 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2580 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2581 uint32_t ret_ref = 0;
2582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2585 ret_ref = (uintptr_t)ret_var.inner;
2586 if (ret_var.is_owned) {
2592 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2593 CHECK(!owner->result_ok);
2594 return DecodeError_clone(&*owner->contents.err);
2596 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint32_t owner) {
2597 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2598 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2599 uint32_t ret_ref = 0;
2600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2603 ret_ref = (uintptr_t)ret_var.inner;
2604 if (ret_var.is_owned) {
2610 typedef struct LDKLogger_JCalls {
2611 atomic_size_t refcnt;
2612 uint32_t instance_ptr;
2614 static void LDKLogger_JCalls_free(void* this_arg) {
2615 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2616 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2620 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2621 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2622 LDKRecord record_var = *record;
2623 uint32_t record_ref = 0;
2624 record_var = Record_clone(&record_var);
2625 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2626 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2627 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2628 record_ref = (uintptr_t)record_var.inner;
2629 if (record_var.is_owned) {
2632 js_invoke_function_1(j_calls->instance_ptr, 0, (uint32_t)record_ref);
2634 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2635 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2636 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2638 static inline LDKLogger LDKLogger_init (JSValue o) {
2639 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2640 atomic_init(&calls->refcnt, 1);
2641 calls->instance_ptr = o;
2644 .this_arg = (void*) calls,
2645 .log = log_LDKLogger_jcall,
2646 .free = LDKLogger_JCalls_free,
2650 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2651 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2652 *res_ptr = LDKLogger_init(o);
2653 return (long)res_ptr;
2655 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2656 CHECK(owner->result_ok);
2657 return &*owner->contents.result;
2659 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint32_t owner) {
2660 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2661 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2662 uint32_t ret_ref = 0;
2663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2666 ret_ref = (uintptr_t)ret_var.inner & ~1;
2670 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2671 CHECK(!owner->result_ok);
2672 return DecodeError_clone(&*owner->contents.err);
2674 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint32_t owner) {
2675 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2676 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2677 uint32_t ret_ref = 0;
2678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2681 ret_ref = (uintptr_t)ret_var.inner;
2682 if (ret_var.is_owned) {
2688 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2689 CHECK(owner->result_ok);
2690 return InitFeatures_clone(&*owner->contents.result);
2692 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2693 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2694 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2695 uint32_t ret_ref = 0;
2696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2699 ret_ref = (uintptr_t)ret_var.inner;
2700 if (ret_var.is_owned) {
2706 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2707 CHECK(!owner->result_ok);
2708 return DecodeError_clone(&*owner->contents.err);
2710 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2711 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2712 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2713 uint32_t ret_ref = 0;
2714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2717 ret_ref = (uintptr_t)ret_var.inner;
2718 if (ret_var.is_owned) {
2724 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2725 CHECK(owner->result_ok);
2726 return ChannelFeatures_clone(&*owner->contents.result);
2728 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2729 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2730 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2731 uint32_t ret_ref = 0;
2732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2735 ret_ref = (uintptr_t)ret_var.inner;
2736 if (ret_var.is_owned) {
2742 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2743 CHECK(!owner->result_ok);
2744 return DecodeError_clone(&*owner->contents.err);
2746 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2747 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2748 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2749 uint32_t ret_ref = 0;
2750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2753 ret_ref = (uintptr_t)ret_var.inner;
2754 if (ret_var.is_owned) {
2760 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2761 CHECK(owner->result_ok);
2762 return NodeFeatures_clone(&*owner->contents.result);
2764 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2765 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2766 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2767 uint32_t ret_ref = 0;
2768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2771 ret_ref = (uintptr_t)ret_var.inner;
2772 if (ret_var.is_owned) {
2778 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2779 CHECK(!owner->result_ok);
2780 return DecodeError_clone(&*owner->contents.err);
2782 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2783 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2784 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2785 uint32_t ret_ref = 0;
2786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2789 ret_ref = (uintptr_t)ret_var.inner;
2790 if (ret_var.is_owned) {
2796 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2797 CHECK(owner->result_ok);
2798 return InvoiceFeatures_clone(&*owner->contents.result);
2800 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2801 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2802 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2803 uint32_t ret_ref = 0;
2804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2807 ret_ref = (uintptr_t)ret_var.inner;
2808 if (ret_var.is_owned) {
2814 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2815 CHECK(!owner->result_ok);
2816 return DecodeError_clone(&*owner->contents.err);
2818 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2819 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2820 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2821 uint32_t ret_ref = 0;
2822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2825 ret_ref = (uintptr_t)ret_var.inner;
2826 if (ret_var.is_owned) {
2832 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2833 CHECK(owner->result_ok);
2834 return ChannelTypeFeatures_clone(&*owner->contents.result);
2836 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2837 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2838 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2839 uint32_t ret_ref = 0;
2840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2843 ret_ref = (uintptr_t)ret_var.inner;
2844 if (ret_var.is_owned) {
2850 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2851 CHECK(!owner->result_ok);
2852 return DecodeError_clone(&*owner->contents.err);
2854 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2855 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2856 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2857 uint32_t ret_ref = 0;
2858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2861 ret_ref = (uintptr_t)ret_var.inner;
2862 if (ret_var.is_owned) {
2868 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2869 CHECK(owner->result_ok);
2870 return NodeId_clone(&*owner->contents.result);
2872 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
2873 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2874 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2875 uint32_t ret_ref = 0;
2876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2879 ret_ref = (uintptr_t)ret_var.inner;
2880 if (ret_var.is_owned) {
2886 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2887 CHECK(!owner->result_ok);
2888 return DecodeError_clone(&*owner->contents.err);
2890 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
2891 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2892 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2893 uint32_t ret_ref = 0;
2894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2897 ret_ref = (uintptr_t)ret_var.inner;
2898 if (ret_var.is_owned) {
2904 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2905 CHECK(owner->result_ok);
2906 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2908 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
2909 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2910 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2911 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2912 uint32_t ret_ref = (uintptr_t)ret_copy;
2916 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2917 CHECK(!owner->result_ok);
2918 return DecodeError_clone(&*owner->contents.err);
2920 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
2921 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2922 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2923 uint32_t ret_ref = 0;
2924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2927 ret_ref = (uintptr_t)ret_var.inner;
2928 if (ret_var.is_owned) {
2934 typedef struct LDKAccess_JCalls {
2935 atomic_size_t refcnt;
2936 uint32_t instance_ptr;
2938 static void LDKAccess_JCalls_free(void* this_arg) {
2939 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2940 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2944 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2945 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2946 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2947 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2948 int64_t short_channel_id_conv = short_channel_id;
2949 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id_conv);
2950 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2951 CHECK_ACCESS(ret_ptr);
2952 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2956 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2957 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2958 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2960 static inline LDKAccess LDKAccess_init (JSValue o) {
2961 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2962 atomic_init(&calls->refcnt, 1);
2963 calls->instance_ptr = o;
2966 .this_arg = (void*) calls,
2967 .get_utxo = get_utxo_LDKAccess_jcall,
2968 .free = LDKAccess_JCalls_free,
2972 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2973 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2974 *res_ptr = LDKAccess_init(o);
2975 return (long)res_ptr;
2977 uint32_t __attribute__((export_name("TS_Access_get_utxo"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
2978 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
2979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2980 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2981 unsigned char genesis_hash_arr[32];
2982 CHECK(genesis_hash->arr_len == 32);
2983 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2984 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2985 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2986 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2987 return (uint32_t)ret_conv;
2990 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
2991 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
2993 case LDKCOption_AccessZ_Some: return 0;
2994 case LDKCOption_AccessZ_None: return 1;
2998 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
2999 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3000 assert(obj->tag == LDKCOption_AccessZ_Some);
3001 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3002 *some_ret = obj->some;
3003 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3004 if ((*some_ret).free == LDKAccess_JCalls_free) {
3005 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3006 LDKAccess_JCalls_cloned(&(*some_ret));
3008 return (uint32_t)some_ret;
3010 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3011 CHECK(owner->result_ok);
3012 return *owner->contents.result;
3014 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3015 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3016 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3020 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3021 CHECK(!owner->result_ok);
3022 return LightningError_clone(&*owner->contents.err);
3024 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3025 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3026 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3027 uint32_t ret_ref = 0;
3028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3031 ret_ref = (uintptr_t)ret_var.inner;
3032 if (ret_var.is_owned) {
3038 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3039 return ChannelAnnouncement_clone(&owner->a);
3041 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3042 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3043 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3044 uint32_t ret_ref = 0;
3045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3048 ret_ref = (uintptr_t)ret_var.inner;
3049 if (ret_var.is_owned) {
3055 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3056 return ChannelUpdate_clone(&owner->b);
3058 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3059 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3060 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3061 uint32_t ret_ref = 0;
3062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3065 ret_ref = (uintptr_t)ret_var.inner;
3066 if (ret_var.is_owned) {
3072 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3073 return ChannelUpdate_clone(&owner->c);
3075 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3076 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3077 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3078 uint32_t ret_ref = 0;
3079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3082 ret_ref = (uintptr_t)ret_var.inner;
3083 if (ret_var.is_owned) {
3089 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3090 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3091 for (size_t i = 0; i < ret.datalen; i++) {
3092 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3096 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3097 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3098 for (size_t i = 0; i < ret.datalen; i++) {
3099 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3103 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3104 CHECK(owner->result_ok);
3105 return *owner->contents.result;
3107 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
3108 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3109 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3112 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3113 CHECK(!owner->result_ok);
3114 return LightningError_clone(&*owner->contents.err);
3116 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
3117 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3118 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3119 uint32_t ret_ref = 0;
3120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3123 ret_ref = (uintptr_t)ret_var.inner;
3124 if (ret_var.is_owned) {
3130 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3131 CHECK(owner->result_ok);
3132 return ChannelUpdateInfo_clone(&*owner->contents.result);
3134 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
3135 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3136 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3137 uint32_t ret_ref = 0;
3138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3141 ret_ref = (uintptr_t)ret_var.inner;
3142 if (ret_var.is_owned) {
3148 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3149 CHECK(!owner->result_ok);
3150 return DecodeError_clone(&*owner->contents.err);
3152 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
3153 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3154 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3155 uint32_t ret_ref = 0;
3156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3159 ret_ref = (uintptr_t)ret_var.inner;
3160 if (ret_var.is_owned) {
3166 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3167 CHECK(owner->result_ok);
3168 return ChannelInfo_clone(&*owner->contents.result);
3170 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3171 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3172 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3173 uint32_t ret_ref = 0;
3174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3177 ret_ref = (uintptr_t)ret_var.inner;
3178 if (ret_var.is_owned) {
3184 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3185 CHECK(!owner->result_ok);
3186 return DecodeError_clone(&*owner->contents.err);
3188 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3189 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3190 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3191 uint32_t ret_ref = 0;
3192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3195 ret_ref = (uintptr_t)ret_var.inner;
3196 if (ret_var.is_owned) {
3202 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3203 CHECK(owner->result_ok);
3204 return RoutingFees_clone(&*owner->contents.result);
3206 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3207 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3208 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3209 uint32_t ret_ref = 0;
3210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3213 ret_ref = (uintptr_t)ret_var.inner;
3214 if (ret_var.is_owned) {
3220 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3221 CHECK(!owner->result_ok);
3222 return DecodeError_clone(&*owner->contents.err);
3224 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3225 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3226 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3227 uint32_t ret_ref = 0;
3228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3231 ret_ref = (uintptr_t)ret_var.inner;
3232 if (ret_var.is_owned) {
3238 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3239 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3241 case LDKNetAddress_IPv4: return 0;
3242 case LDKNetAddress_IPv6: return 1;
3243 case LDKNetAddress_OnionV2: return 2;
3244 case LDKNetAddress_OnionV3: return 3;
3248 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3249 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3250 assert(obj->tag == LDKNetAddress_IPv4);
3251 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3252 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3255 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3256 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3257 assert(obj->tag == LDKNetAddress_IPv4);
3258 int16_t port_conv = obj->i_pv4.port;
3261 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3262 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3263 assert(obj->tag == LDKNetAddress_IPv6);
3264 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3265 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3268 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3269 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3270 assert(obj->tag == LDKNetAddress_IPv6);
3271 int16_t port_conv = obj->i_pv6.port;
3274 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3275 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3276 assert(obj->tag == LDKNetAddress_OnionV2);
3277 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3278 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3279 return onion_v2_arr;
3281 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3282 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3283 assert(obj->tag == LDKNetAddress_OnionV3);
3284 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3285 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3286 return ed25519_pubkey_arr;
3288 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3289 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3290 assert(obj->tag == LDKNetAddress_OnionV3);
3291 int16_t checksum_conv = obj->onion_v3.checksum;
3292 return checksum_conv;
3294 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3295 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3296 assert(obj->tag == LDKNetAddress_OnionV3);
3297 int8_t version_conv = obj->onion_v3.version;
3298 return version_conv;
3300 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3301 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3302 assert(obj->tag == LDKNetAddress_OnionV3);
3303 int16_t port_conv = obj->onion_v3.port;
3306 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3307 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3308 for (size_t i = 0; i < ret.datalen; i++) {
3309 ret.data[i] = NetAddress_clone(&orig->data[i]);
3313 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3314 CHECK(owner->result_ok);
3315 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3317 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3318 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3319 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3320 uint32_t ret_ref = 0;
3321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3324 ret_ref = (uintptr_t)ret_var.inner;
3325 if (ret_var.is_owned) {
3331 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3332 CHECK(!owner->result_ok);
3333 return DecodeError_clone(&*owner->contents.err);
3335 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3336 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3337 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3338 uint32_t ret_ref = 0;
3339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3342 ret_ref = (uintptr_t)ret_var.inner;
3343 if (ret_var.is_owned) {
3349 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3350 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3351 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3354 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3355 CHECK(owner->result_ok);
3356 return NodeInfo_clone(&*owner->contents.result);
3358 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3359 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3360 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3361 uint32_t ret_ref = 0;
3362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3365 ret_ref = (uintptr_t)ret_var.inner;
3366 if (ret_var.is_owned) {
3372 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3373 CHECK(!owner->result_ok);
3374 return DecodeError_clone(&*owner->contents.err);
3376 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3377 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3378 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3379 uint32_t ret_ref = 0;
3380 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3381 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3383 ret_ref = (uintptr_t)ret_var.inner;
3384 if (ret_var.is_owned) {
3390 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3391 CHECK(owner->result_ok);
3392 return &*owner->contents.result;
3394 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3395 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3396 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3397 uint32_t ret_ref = 0;
3398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3401 ret_ref = (uintptr_t)ret_var.inner & ~1;
3405 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3406 CHECK(!owner->result_ok);
3407 return DecodeError_clone(&*owner->contents.err);
3409 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3410 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3411 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3412 uint32_t ret_ref = 0;
3413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3416 ret_ref = (uintptr_t)ret_var.inner;
3417 if (ret_var.is_owned) {
3423 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3424 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3426 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3427 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3431 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3432 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3433 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3434 LDKCVec_NetAddressZ some_var = obj->some;
3435 uint32_tArray some_arr = NULL;
3436 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
3437 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3438 for (size_t m = 0; m < some_var.datalen; m++) {
3439 uint32_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
3440 some_arr_ptr[m] = some_conv_12_ref;
3445 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3446 CHECK(owner->result_ok);
3447 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3449 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3450 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3451 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3452 uint32_t ret_ref = 0;
3453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3456 ret_ref = (uintptr_t)ret_var.inner;
3457 if (ret_var.is_owned) {
3463 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3464 CHECK(!owner->result_ok);
3465 return DecodeError_clone(&*owner->contents.err);
3467 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3468 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3469 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3470 uint32_t ret_ref = 0;
3471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3474 ret_ref = (uintptr_t)ret_var.inner;
3475 if (ret_var.is_owned) {
3481 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3482 CHECK(owner->result_ok);
3483 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3485 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3486 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3487 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3488 uint32_t ret_ref = 0;
3489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3492 ret_ref = (uintptr_t)ret_var.inner;
3493 if (ret_var.is_owned) {
3499 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3500 CHECK(!owner->result_ok);
3501 return DecodeError_clone(&*owner->contents.err);
3503 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3504 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3505 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3506 uint32_t ret_ref = 0;
3507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3510 ret_ref = (uintptr_t)ret_var.inner;
3511 if (ret_var.is_owned) {
3517 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3518 CHECK(owner->result_ok);
3519 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3521 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3522 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3523 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3524 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3525 uint32_t ret_ref = (uintptr_t)ret_copy;
3529 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3530 CHECK(!owner->result_ok);
3531 return DecodeError_clone(&*owner->contents.err);
3533 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3534 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3535 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3536 uint32_t ret_ref = 0;
3537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3540 ret_ref = (uintptr_t)ret_var.inner;
3541 if (ret_var.is_owned) {
3547 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3548 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3549 for (size_t i = 0; i < ret.datalen; i++) {
3550 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3554 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3557 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
3558 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3559 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3560 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3564 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3567 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
3568 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3569 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3570 ptrArray ret_arr = NULL;
3571 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3572 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3573 for (size_t m = 0; m < ret_var.datalen; m++) {
3574 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3575 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3576 ret_arr_ptr[m] = ret_conv_12_arr;
3582 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3583 CHECK(owner->result_ok);
3584 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3586 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
3587 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3588 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3589 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3590 return ((uint32_t)ret_conv);
3593 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3594 CHECK(!owner->result_ok);
3595 return *owner->contents.err;
3597 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
3598 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3599 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3602 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3603 CHECK(owner->result_ok);
3604 return *owner->contents.result;
3606 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
3607 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3608 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3609 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3613 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3614 CHECK(!owner->result_ok);
3615 return *owner->contents.err;
3617 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
3618 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3619 CResult_SignatureNoneZ_get_err(owner_conv);
3622 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3625 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
3626 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3627 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3628 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3632 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3635 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
3636 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3637 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3638 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3642 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3643 CHECK(owner->result_ok);
3644 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3646 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
3647 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3648 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3649 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3650 return ((uint32_t)ret_conv);
3653 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3654 CHECK(!owner->result_ok);
3655 return *owner->contents.err;
3657 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
3658 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3659 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3662 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3663 CHECK(owner->result_ok);
3664 return *owner->contents.result;
3666 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
3667 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3668 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3669 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3673 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3674 CHECK(!owner->result_ok);
3675 return *owner->contents.err;
3677 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
3678 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3679 CResult_SecretKeyNoneZ_get_err(owner_conv);
3682 typedef struct LDKBaseSign_JCalls {
3683 atomic_size_t refcnt;
3684 uint32_t instance_ptr;
3685 } LDKBaseSign_JCalls;
3686 static void LDKBaseSign_JCalls_free(void* this_arg) {
3687 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3688 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3692 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3693 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3694 int64_t idx_conv = idx;
3695 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 2, (uint32_t)idx_conv);
3696 LDKPublicKey ret_ref;
3697 CHECK(ret->arr_len == 33);
3698 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3701 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3702 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3703 int64_t idx_conv = idx;
3704 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 3, (uint32_t)idx_conv);
3705 LDKThirtyTwoBytes ret_ref;
3706 CHECK(ret->arr_len == 32);
3707 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3710 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3711 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3712 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3713 uint32_t holder_tx_ref = 0;
3714 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3715 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3716 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3717 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3718 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3719 if (holder_tx_var.is_owned) {
3722 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3723 ptrArray preimages_arr = NULL;
3724 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3725 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3726 for (size_t m = 0; m < preimages_var.datalen; m++) {
3727 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3728 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3729 preimages_arr_ptr[m] = preimages_conv_12_arr;
3732 FREE(preimages_var.data);
3733 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 4, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
3734 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3735 CHECK_ACCESS(ret_ptr);
3736 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3740 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3741 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3742 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 5);
3743 LDKThirtyTwoBytes ret_ref;
3744 CHECK(ret->arr_len == 32);
3745 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3748 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3749 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3750 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3751 uint32_t commitment_tx_ref = 0;
3752 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3753 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3756 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3757 if (commitment_tx_var.is_owned) {
3758 commitment_tx_ref |= 1;
3760 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3761 ptrArray preimages_arr = NULL;
3762 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3763 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3764 for (size_t m = 0; m < preimages_var.datalen; m++) {
3765 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3766 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3767 preimages_arr_ptr[m] = preimages_conv_12_arr;
3770 FREE(preimages_var.data);
3771 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
3772 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3773 CHECK_ACCESS(ret_ptr);
3774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3778 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3779 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3780 int64_t idx_conv = idx;
3781 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3782 memcpy(secret_arr->elems, *secret, 32);
3783 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 7, (uint32_t)idx_conv, (uint32_t)secret_arr);
3784 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3785 CHECK_ACCESS(ret_ptr);
3786 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3790 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3791 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3792 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3793 uint32_t commitment_tx_ref = 0;
3794 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3795 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3796 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3797 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3798 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3799 if (commitment_tx_var.is_owned) {
3800 commitment_tx_ref |= 1;
3802 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 8, (uint32_t)commitment_tx_ref);
3803 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3804 CHECK_ACCESS(ret_ptr);
3805 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3809 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
3810 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3811 LDKTransaction justice_tx_var = justice_tx;
3812 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3813 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3814 Transaction_free(justice_tx_var);
3815 uint32_t input_conv = input;
3816 int64_t amount_conv = amount;
3817 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3818 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3819 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr);
3820 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3821 CHECK_ACCESS(ret_ptr);
3822 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3826 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
3827 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3828 LDKTransaction justice_tx_var = justice_tx;
3829 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3830 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3831 Transaction_free(justice_tx_var);
3832 uint32_t input_conv = input;
3833 int64_t amount_conv = amount;
3834 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3835 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3836 LDKHTLCOutputInCommitment htlc_var = *htlc;
3837 uint32_t htlc_ref = 0;
3838 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3839 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3840 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3841 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3842 htlc_ref = (uintptr_t)htlc_var.inner;
3843 if (htlc_var.is_owned) {
3846 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
3847 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3848 CHECK_ACCESS(ret_ptr);
3849 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3853 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
3854 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3855 LDKTransaction htlc_tx_var = htlc_tx;
3856 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3857 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3858 Transaction_free(htlc_tx_var);
3859 uint32_t input_conv = input;
3860 int64_t amount_conv = amount;
3861 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3862 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3863 LDKHTLCOutputInCommitment htlc_var = *htlc;
3864 uint32_t htlc_ref = 0;
3865 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3866 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3867 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3868 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3869 htlc_ref = (uintptr_t)htlc_var.inner;
3870 if (htlc_var.is_owned) {
3873 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
3874 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3875 CHECK_ACCESS(ret_ptr);
3876 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3880 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3881 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3882 LDKClosingTransaction closing_tx_var = *closing_tx;
3883 uint32_t closing_tx_ref = 0;
3884 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3885 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3886 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3887 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3888 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3889 if (closing_tx_var.is_owned) {
3890 closing_tx_ref |= 1;
3892 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 12, (uint32_t)closing_tx_ref);
3893 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3894 CHECK_ACCESS(ret_ptr);
3895 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3899 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3900 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3901 LDKUnsignedChannelAnnouncement msg_var = *msg;
3902 uint32_t msg_ref = 0;
3903 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3904 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3905 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3906 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3907 msg_ref = (uintptr_t)msg_var.inner;
3908 if (msg_var.is_owned) {
3911 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 13, (uint32_t)msg_ref);
3912 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3913 CHECK_ACCESS(ret_ptr);
3914 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3918 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3919 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3920 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3921 uint32_t channel_parameters_ref = 0;
3922 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3923 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3924 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3925 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3926 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3927 if (channel_parameters_var.is_owned) {
3928 channel_parameters_ref |= 1;
3930 js_invoke_function_1(j_calls->instance_ptr, 14, (uint32_t)channel_parameters_ref);
3932 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3933 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3934 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3936 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
3937 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3938 atomic_init(&calls->refcnt, 1);
3939 calls->instance_ptr = o;
3941 LDKChannelPublicKeys pubkeys_conv;
3942 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3943 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3944 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3947 .this_arg = (void*) calls,
3948 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3949 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3950 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3951 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3952 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3953 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3954 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3955 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3956 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3957 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3958 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3959 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3960 .ready_channel = ready_channel_LDKBaseSign_jcall,
3961 .free = LDKBaseSign_JCalls_free,
3962 .pubkeys = pubkeys_conv,
3963 .set_pubkeys = NULL,
3967 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
3968 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3969 *res_ptr = LDKBaseSign_init(o, pubkeys);
3970 return (long)res_ptr;
3972 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
3973 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3974 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3975 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3976 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3977 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3981 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
3982 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3983 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3984 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3985 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3986 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3990 uint32_t __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx, ptrArray preimages) {
3991 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3992 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3993 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3994 LDKHolderCommitmentTransaction holder_tx_conv;
3995 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3996 holder_tx_conv.is_owned = false;
3997 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3998 LDKCVec_PaymentPreimageZ preimages_constr;
3999 preimages_constr.datalen = preimages->arr_len;
4000 if (preimages_constr.datalen > 0)
4001 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4003 preimages_constr.data = NULL;
4004 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
4005 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4006 int8_tArray preimages_conv_12 = preimages_vals[m];
4007 LDKThirtyTwoBytes preimages_conv_12_ref;
4008 CHECK(preimages_conv_12->arr_len == 32);
4009 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4010 preimages_constr.data[m] = preimages_conv_12_ref;
4012 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4013 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4014 return (uint32_t)ret_conv;
4017 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
4018 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4020 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4021 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4022 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4026 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) {
4027 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4028 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4029 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4030 LDKCommitmentTransaction commitment_tx_conv;
4031 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4032 commitment_tx_conv.is_owned = false;
4033 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4034 LDKCVec_PaymentPreimageZ preimages_constr;
4035 preimages_constr.datalen = preimages->arr_len;
4036 if (preimages_constr.datalen > 0)
4037 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4039 preimages_constr.data = NULL;
4040 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
4041 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4042 int8_tArray preimages_conv_12 = preimages_vals[m];
4043 LDKThirtyTwoBytes preimages_conv_12_ref;
4044 CHECK(preimages_conv_12->arr_len == 32);
4045 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4046 preimages_constr.data[m] = preimages_conv_12_ref;
4048 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4049 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4050 return (uint32_t)ret_conv;
4053 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) {
4054 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4055 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4056 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4057 unsigned char secret_arr[32];
4058 CHECK(secret->arr_len == 32);
4059 memcpy(secret_arr, secret->elems, 32); FREE(secret);
4060 unsigned char (*secret_ref)[32] = &secret_arr;
4061 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4062 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4063 return (uint32_t)ret_conv;
4066 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) {
4067 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4068 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4069 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4070 LDKHolderCommitmentTransaction commitment_tx_conv;
4071 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4072 commitment_tx_conv.is_owned = false;
4073 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4074 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4075 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4076 return (uint32_t)ret_conv;
4079 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) {
4080 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4081 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4082 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4083 LDKTransaction justice_tx_ref;
4084 justice_tx_ref.datalen = justice_tx->arr_len;
4085 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4086 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4087 justice_tx_ref.data_is_owned = true;
4088 unsigned char per_commitment_key_arr[32];
4089 CHECK(per_commitment_key->arr_len == 32);
4090 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4091 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4092 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4093 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4094 return (uint32_t)ret_conv;
4097 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) {
4098 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4099 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4100 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4101 LDKTransaction justice_tx_ref;
4102 justice_tx_ref.datalen = justice_tx->arr_len;
4103 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4104 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4105 justice_tx_ref.data_is_owned = true;
4106 unsigned char per_commitment_key_arr[32];
4107 CHECK(per_commitment_key->arr_len == 32);
4108 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4109 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4110 LDKHTLCOutputInCommitment htlc_conv;
4111 htlc_conv.inner = (void*)(htlc & (~1));
4112 htlc_conv.is_owned = false;
4113 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4114 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4115 *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);
4116 return (uint32_t)ret_conv;
4119 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) {
4120 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4121 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4122 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4123 LDKTransaction htlc_tx_ref;
4124 htlc_tx_ref.datalen = htlc_tx->arr_len;
4125 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4126 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4127 htlc_tx_ref.data_is_owned = true;
4128 LDKPublicKey per_commitment_point_ref;
4129 CHECK(per_commitment_point->arr_len == 33);
4130 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4131 LDKHTLCOutputInCommitment htlc_conv;
4132 htlc_conv.inner = (void*)(htlc & (~1));
4133 htlc_conv.is_owned = false;
4134 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4135 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4136 *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);
4137 return (uint32_t)ret_conv;
4140 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
4141 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4142 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4143 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4144 LDKClosingTransaction closing_tx_conv;
4145 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4146 closing_tx_conv.is_owned = false;
4147 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4148 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4149 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4150 return (uint32_t)ret_conv;
4153 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
4154 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4155 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4156 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4157 LDKUnsignedChannelAnnouncement msg_conv;
4158 msg_conv.inner = (void*)(msg & (~1));
4159 msg_conv.is_owned = false;
4160 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4161 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4162 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4163 return (uint32_t)ret_conv;
4166 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
4167 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4168 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4169 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4170 LDKChannelTransactionParameters channel_parameters_conv;
4171 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4172 channel_parameters_conv.is_owned = false;
4173 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4174 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4177 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4178 if (this_arg->set_pubkeys != NULL)
4179 this_arg->set_pubkeys(this_arg);
4180 return this_arg->pubkeys;
4182 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
4183 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4184 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4185 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4186 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4187 uint32_t ret_ref = 0;
4188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4191 ret_ref = (uintptr_t)ret_var.inner;
4192 if (ret_var.is_owned) {
4198 typedef struct LDKSign_JCalls {
4199 atomic_size_t refcnt;
4200 uint32_t instance_ptr;
4201 LDKBaseSign_JCalls* BaseSign;
4203 static void LDKSign_JCalls_free(void* this_arg) {
4204 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4205 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4209 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4210 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4211 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 15);
4212 LDKCVec_u8Z ret_ref;
4213 ret_ref.datalen = ret->arr_len;
4214 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4215 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4218 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4219 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4220 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4221 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4223 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4224 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4225 atomic_init(&calls->refcnt, 1);
4226 calls->instance_ptr = o;
4228 LDKChannelPublicKeys pubkeys_conv;
4229 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4230 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4231 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4234 .this_arg = (void*) calls,
4235 .write = write_LDKSign_jcall,
4236 .cloned = LDKSign_JCalls_cloned,
4237 .free = LDKSign_JCalls_free,
4238 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4240 calls->BaseSign = ret.BaseSign.this_arg;
4243 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
4244 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4245 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4246 return (long)res_ptr;
4248 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
4249 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4250 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4251 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4252 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4253 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4254 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4255 CVec_u8Z_free(ret_var);
4259 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4260 CHECK(owner->result_ok);
4261 return Sign_clone(&*owner->contents.result);
4263 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
4264 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4265 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4266 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4267 return (uint32_t)ret_ret;
4270 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4271 CHECK(!owner->result_ok);
4272 return DecodeError_clone(&*owner->contents.err);
4274 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
4275 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4276 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4277 uint32_t ret_ref = 0;
4278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4281 ret_ref = (uintptr_t)ret_var.inner;
4282 if (ret_var.is_owned) {
4288 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4289 CHECK(owner->result_ok);
4290 return *owner->contents.result;
4292 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
4293 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4294 int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4295 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4299 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4300 CHECK(!owner->result_ok);
4301 return *owner->contents.err;
4303 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
4304 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4305 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4308 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4309 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4310 for (size_t i = 0; i < ret.datalen; i++) {
4311 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4315 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4316 CHECK(owner->result_ok);
4317 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4319 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
4320 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4321 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4322 ptrArray ret_arr = NULL;
4323 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4324 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
4325 for (size_t m = 0; m < ret_var.datalen; m++) {
4326 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4327 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4328 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4329 CVec_u8Z_free(ret_conv_12_var);
4330 ret_arr_ptr[m] = ret_conv_12_arr;
4337 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4338 CHECK(!owner->result_ok);
4339 return *owner->contents.err;
4341 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
4342 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4343 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4346 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4347 CHECK(owner->result_ok);
4348 return InMemorySigner_clone(&*owner->contents.result);
4350 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
4351 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4352 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4353 uint32_t ret_ref = 0;
4354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4357 ret_ref = (uintptr_t)ret_var.inner;
4358 if (ret_var.is_owned) {
4364 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4365 CHECK(!owner->result_ok);
4366 return DecodeError_clone(&*owner->contents.err);
4368 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
4369 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4370 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4371 uint32_t ret_ref = 0;
4372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4375 ret_ref = (uintptr_t)ret_var.inner;
4376 if (ret_var.is_owned) {
4382 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4383 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4384 for (size_t i = 0; i < ret.datalen; i++) {
4385 ret.data[i] = TxOut_clone(&orig->data[i]);
4389 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4390 CHECK(owner->result_ok);
4391 return *owner->contents.result;
4393 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
4394 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4395 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4396 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4397 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4401 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4402 CHECK(!owner->result_ok);
4403 return *owner->contents.err;
4405 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
4406 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4407 CResult_TransactionNoneZ_get_err(owner_conv);
4410 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
4411 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4413 case LDKCOption_u16Z_Some: return 0;
4414 case LDKCOption_u16Z_None: return 1;
4418 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
4419 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4420 assert(obj->tag == LDKCOption_u16Z_Some);
4421 int16_t some_conv = obj->some;
4424 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
4425 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4427 case LDKAPIError_APIMisuseError: return 0;
4428 case LDKAPIError_FeeRateTooHigh: return 1;
4429 case LDKAPIError_RouteError: return 2;
4430 case LDKAPIError_ChannelUnavailable: return 3;
4431 case LDKAPIError_MonitorUpdateFailed: return 4;
4432 case LDKAPIError_IncompatibleShutdownScript: return 5;
4436 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
4437 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4438 assert(obj->tag == LDKAPIError_APIMisuseError);
4439 LDKStr err_str = obj->api_misuse_error.err;
4440 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4443 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
4444 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4445 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4446 LDKStr err_str = obj->fee_rate_too_high.err;
4447 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4450 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
4451 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4452 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4453 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4454 return feerate_conv;
4456 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
4457 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4458 assert(obj->tag == LDKAPIError_RouteError);
4459 LDKStr err_str = obj->route_error.err;
4460 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4463 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
4464 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4465 assert(obj->tag == LDKAPIError_ChannelUnavailable);
4466 LDKStr err_str = obj->channel_unavailable.err;
4467 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4470 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
4471 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4472 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4473 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4474 uint32_t script_ref = 0;
4475 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4476 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4477 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4478 script_ref = (uintptr_t)script_var.inner & ~1;
4481 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4482 CHECK(owner->result_ok);
4483 return *owner->contents.result;
4485 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
4486 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4487 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4490 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4491 CHECK(!owner->result_ok);
4492 return APIError_clone(&*owner->contents.err);
4494 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
4495 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4496 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4497 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4498 uint32_t ret_ref = (uintptr_t)ret_copy;
4502 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4503 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4504 for (size_t i = 0; i < ret.datalen; i++) {
4505 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4509 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4510 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4511 for (size_t i = 0; i < ret.datalen; i++) {
4512 ret.data[i] = APIError_clone(&orig->data[i]);
4516 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4517 CHECK(owner->result_ok);
4518 return ThirtyTwoBytes_clone(&*owner->contents.result);
4520 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
4521 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4522 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4523 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4527 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4528 CHECK(!owner->result_ok);
4529 return APIError_clone(&*owner->contents.err);
4531 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
4532 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4533 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4534 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4535 uint32_t ret_ref = (uintptr_t)ret_copy;
4539 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
4540 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4542 case LDKPaymentSendFailure_ParameterError: return 0;
4543 case LDKPaymentSendFailure_PathParameterError: return 1;
4544 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4545 case LDKPaymentSendFailure_PartialFailure: return 3;
4549 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
4550 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4551 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4552 uint32_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4553 return parameter_error_ref;
4555 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
4556 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4557 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4558 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4559 uint32_tArray path_parameter_error_arr = NULL;
4560 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen, __LINE__);
4561 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
4562 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4563 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4564 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4565 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4566 path_parameter_error_arr_ptr[w] = (uint32_t)path_parameter_error_conv_22_conv;
4569 return path_parameter_error_arr;
4571 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
4572 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4573 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4574 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4575 uint32_tArray all_failed_retry_safe_arr = NULL;
4576 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4577 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
4578 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4579 uint32_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4580 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4583 return all_failed_retry_safe_arr;
4585 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
4586 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4587 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4588 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4589 uint32_tArray results_arr = NULL;
4590 results_arr = init_uint32_tArray(results_var.datalen, __LINE__);
4591 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
4592 for (size_t w = 0; w < results_var.datalen; w++) {
4593 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4594 *results_conv_22_conv = results_var.data[w];
4595 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4596 results_arr_ptr[w] = (uint32_t)results_conv_22_conv;
4601 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
4602 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4603 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4604 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4605 uint32_t failed_paths_retry_ref = 0;
4606 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4607 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4608 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4609 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4610 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4612 return failed_paths_retry_ref;
4614 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
4615 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4616 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4617 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4618 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4619 return payment_id_arr;
4621 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4622 CHECK(owner->result_ok);
4623 return ThirtyTwoBytes_clone(&*owner->contents.result);
4625 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
4626 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4627 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4628 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4632 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4633 CHECK(!owner->result_ok);
4634 return PaymentSendFailure_clone(&*owner->contents.err);
4636 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
4637 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4638 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4639 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4640 uint32_t ret_ref = (uintptr_t)ret_copy;
4644 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4645 CHECK(owner->result_ok);
4646 return *owner->contents.result;
4648 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
4649 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4650 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4653 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4654 CHECK(!owner->result_ok);
4655 return PaymentSendFailure_clone(&*owner->contents.err);
4657 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
4658 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4659 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4660 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4661 uint32_t ret_ref = (uintptr_t)ret_copy;
4665 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4666 return ThirtyTwoBytes_clone(&owner->a);
4668 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
4669 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4670 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4671 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4675 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4676 return ThirtyTwoBytes_clone(&owner->b);
4678 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
4679 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4680 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4681 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4685 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4686 CHECK(owner->result_ok);
4687 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4689 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
4690 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4691 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4692 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4693 return ((uint32_t)ret_conv);
4696 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4697 CHECK(!owner->result_ok);
4698 return PaymentSendFailure_clone(&*owner->contents.err);
4700 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
4701 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4702 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4703 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4704 uint32_t ret_ref = (uintptr_t)ret_copy;
4708 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4709 return ThirtyTwoBytes_clone(&owner->a);
4711 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
4712 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4713 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4714 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4718 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4719 return ThirtyTwoBytes_clone(&owner->b);
4721 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
4722 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4723 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4724 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4728 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4729 CHECK(owner->result_ok);
4730 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4732 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
4733 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4734 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4735 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4736 return ((uint32_t)ret_conv);
4739 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4740 CHECK(!owner->result_ok);
4741 return *owner->contents.err;
4743 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
4744 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4745 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4748 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4749 CHECK(owner->result_ok);
4750 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4752 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
4753 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4754 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4755 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4756 return ((uint32_t)ret_conv);
4759 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4760 CHECK(!owner->result_ok);
4761 return APIError_clone(&*owner->contents.err);
4763 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
4764 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4765 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4766 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4767 uint32_t ret_ref = (uintptr_t)ret_copy;
4771 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4772 CHECK(owner->result_ok);
4773 return ThirtyTwoBytes_clone(&*owner->contents.result);
4775 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
4776 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4777 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4778 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4782 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4783 CHECK(!owner->result_ok);
4784 return *owner->contents.err;
4786 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
4787 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4788 CResult_PaymentSecretNoneZ_get_err(owner_conv);
4791 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4792 CHECK(owner->result_ok);
4793 return ThirtyTwoBytes_clone(&*owner->contents.result);
4795 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
4796 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4797 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4798 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4802 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4803 CHECK(!owner->result_ok);
4804 return APIError_clone(&*owner->contents.err);
4806 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
4807 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4808 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4809 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4810 uint32_t ret_ref = (uintptr_t)ret_copy;
4814 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4815 CHECK(owner->result_ok);
4816 return ThirtyTwoBytes_clone(&*owner->contents.result);
4818 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
4819 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4820 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4821 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4825 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4826 CHECK(!owner->result_ok);
4827 return APIError_clone(&*owner->contents.err);
4829 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
4830 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4831 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4832 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4833 uint32_t ret_ref = (uintptr_t)ret_copy;
4837 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4838 CHECK(owner->result_ok);
4839 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
4841 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint32_t owner) {
4842 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4843 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4844 uint32_t ret_ref = 0;
4845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4848 ret_ref = (uintptr_t)ret_var.inner;
4849 if (ret_var.is_owned) {
4855 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4856 CHECK(!owner->result_ok);
4857 return DecodeError_clone(&*owner->contents.err);
4859 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint32_t owner) {
4860 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4861 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4862 uint32_t ret_ref = 0;
4863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4866 ret_ref = (uintptr_t)ret_var.inner;
4867 if (ret_var.is_owned) {
4873 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4874 CHECK(owner->result_ok);
4875 return ChannelCounterparty_clone(&*owner->contents.result);
4877 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint32_t owner) {
4878 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4879 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4880 uint32_t ret_ref = 0;
4881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4884 ret_ref = (uintptr_t)ret_var.inner;
4885 if (ret_var.is_owned) {
4891 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4892 CHECK(!owner->result_ok);
4893 return DecodeError_clone(&*owner->contents.err);
4895 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint32_t owner) {
4896 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4897 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4898 uint32_t ret_ref = 0;
4899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4902 ret_ref = (uintptr_t)ret_var.inner;
4903 if (ret_var.is_owned) {
4909 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4910 CHECK(owner->result_ok);
4911 return ChannelDetails_clone(&*owner->contents.result);
4913 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint32_t owner) {
4914 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4915 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4916 uint32_t ret_ref = 0;
4917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4920 ret_ref = (uintptr_t)ret_var.inner;
4921 if (ret_var.is_owned) {
4927 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4928 CHECK(!owner->result_ok);
4929 return DecodeError_clone(&*owner->contents.err);
4931 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint32_t owner) {
4932 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4933 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4934 uint32_t ret_ref = 0;
4935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4938 ret_ref = (uintptr_t)ret_var.inner;
4939 if (ret_var.is_owned) {
4945 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4946 CHECK(owner->result_ok);
4947 return PhantomRouteHints_clone(&*owner->contents.result);
4949 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint32_t owner) {
4950 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4951 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4952 uint32_t ret_ref = 0;
4953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4956 ret_ref = (uintptr_t)ret_var.inner;
4957 if (ret_var.is_owned) {
4963 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4964 CHECK(!owner->result_ok);
4965 return DecodeError_clone(&*owner->contents.err);
4967 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint32_t owner) {
4968 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4969 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4970 uint32_t ret_ref = 0;
4971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4974 ret_ref = (uintptr_t)ret_var.inner;
4975 if (ret_var.is_owned) {
4981 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4982 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4983 for (size_t i = 0; i < ret.datalen; i++) {
4984 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4988 typedef struct LDKWatch_JCalls {
4989 atomic_size_t refcnt;
4990 uint32_t instance_ptr;
4992 static void LDKWatch_JCalls_free(void* this_arg) {
4993 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4994 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4998 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4999 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5000 LDKOutPoint funding_txo_var = funding_txo;
5001 uint32_t funding_txo_ref = 0;
5002 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5003 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5004 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5005 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5006 if (funding_txo_var.is_owned) {
5007 funding_txo_ref |= 1;
5009 LDKChannelMonitor monitor_var = monitor;
5010 uint32_t monitor_ref = 0;
5011 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5012 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5013 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5014 monitor_ref = (uintptr_t)monitor_var.inner;
5015 if (monitor_var.is_owned) {
5018 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 16, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
5019 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5020 CHECK_ACCESS(ret_ptr);
5021 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5025 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5026 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5027 LDKOutPoint funding_txo_var = funding_txo;
5028 uint32_t funding_txo_ref = 0;
5029 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5030 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5031 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5032 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5033 if (funding_txo_var.is_owned) {
5034 funding_txo_ref |= 1;
5036 LDKChannelMonitorUpdate update_var = update;
5037 uint32_t update_ref = 0;
5038 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5039 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5040 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5041 update_ref = (uintptr_t)update_var.inner;
5042 if (update_var.is_owned) {
5045 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 17, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
5046 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5047 CHECK_ACCESS(ret_ptr);
5048 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5052 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5053 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5054 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 18);
5055 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr;
5056 ret_constr.datalen = ret->arr_len;
5057 if (ret_constr.datalen > 0)
5058 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
5060 ret_constr.data = NULL;
5061 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
5062 for (size_t m = 0; m < ret_constr.datalen; m++) {
5063 uint32_t ret_conv_38 = ret_vals[m];
5064 void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1);
5065 CHECK_ACCESS(ret_conv_38_ptr);
5066 LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr);
5067 FREE((void*)ret_conv_38);
5068 ret_constr.data[m] = ret_conv_38_conv;
5072 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5073 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5074 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5076 static inline LDKWatch LDKWatch_init (JSValue o) {
5077 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5078 atomic_init(&calls->refcnt, 1);
5079 calls->instance_ptr = o;
5082 .this_arg = (void*) calls,
5083 .watch_channel = watch_channel_LDKWatch_jcall,
5084 .update_channel = update_channel_LDKWatch_jcall,
5085 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5086 .free = LDKWatch_JCalls_free,
5090 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5091 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5092 *res_ptr = LDKWatch_init(o);
5093 return (long)res_ptr;
5095 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5096 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5097 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5098 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5099 LDKOutPoint funding_txo_conv;
5100 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5101 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5102 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5103 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5104 LDKChannelMonitor monitor_conv;
5105 monitor_conv.inner = (void*)(monitor & (~1));
5106 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5107 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5108 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5109 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5110 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5111 return (uint32_t)ret_conv;
5114 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5115 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5116 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5117 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5118 LDKOutPoint funding_txo_conv;
5119 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5120 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5121 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5122 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5123 LDKChannelMonitorUpdate update_conv;
5124 update_conv.inner = (void*)(update & (~1));
5125 update_conv.is_owned = (update & 1) || (update == 0);
5126 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5127 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5128 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5129 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5130 return (uint32_t)ret_conv;
5133 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5134 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5136 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5137 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5138 uint32_tArray ret_arr = NULL;
5139 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5140 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5141 for (size_t m = 0; m < ret_var.datalen; m++) {
5142 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
5143 *ret_conv_38_conv = ret_var.data[m];
5144 ret_arr_ptr[m] = ((uint32_t)ret_conv_38_conv);
5151 typedef struct LDKBroadcasterInterface_JCalls {
5152 atomic_size_t refcnt;
5153 uint32_t instance_ptr;
5154 } LDKBroadcasterInterface_JCalls;
5155 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5156 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5157 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5161 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5162 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5163 LDKTransaction tx_var = tx;
5164 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5165 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5166 Transaction_free(tx_var);
5167 js_invoke_function_1(j_calls->instance_ptr, 19, (uint32_t)tx_arr);
5169 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5170 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5171 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5173 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5174 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5175 atomic_init(&calls->refcnt, 1);
5176 calls->instance_ptr = o;
5178 LDKBroadcasterInterface ret = {
5179 .this_arg = (void*) calls,
5180 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5181 .free = LDKBroadcasterInterface_JCalls_free,
5185 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5186 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5187 *res_ptr = LDKBroadcasterInterface_init(o);
5188 return (long)res_ptr;
5190 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
5191 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5192 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5193 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5194 LDKTransaction tx_ref;
5195 tx_ref.datalen = tx->arr_len;
5196 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5197 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5198 tx_ref.data_is_owned = true;
5199 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5202 typedef struct LDKKeysInterface_JCalls {
5203 atomic_size_t refcnt;
5204 uint32_t instance_ptr;
5205 } LDKKeysInterface_JCalls;
5206 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5207 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5208 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5212 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5213 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5214 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5215 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 20, (uint32_t)recipient_conv);
5216 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5217 CHECK_ACCESS(ret_ptr);
5218 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5222 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5223 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5224 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 21);
5225 LDKCVec_u8Z ret_ref;
5226 ret_ref.datalen = ret->arr_len;
5227 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5228 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5231 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5232 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5233 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 22);
5234 LDKShutdownScript ret_conv;
5235 ret_conv.inner = (void*)(ret & (~1));
5236 ret_conv.is_owned = (ret & 1) || (ret == 0);
5237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5240 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5241 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5242 jboolean inbound_conv = inbound;
5243 int64_t channel_value_satoshis_conv = channel_value_satoshis;
5244 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 23, (uint32_t)inbound_conv, (uint32_t)channel_value_satoshis_conv);
5245 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5246 CHECK_ACCESS(ret_ptr);
5247 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5251 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5252 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5253 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 24);
5254 LDKThirtyTwoBytes ret_ref;
5255 CHECK(ret->arr_len == 32);
5256 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5259 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5260 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5261 LDKu8slice reader_var = reader;
5262 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5263 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5264 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 25, (uint32_t)reader_arr);
5265 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5266 CHECK_ACCESS(ret_ptr);
5267 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5271 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5272 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5273 LDKu8slice hrp_bytes_var = hrp_bytes;
5274 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5275 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5276 LDKCVec_u5Z invoice_data_var = invoice_data;
5277 ptrArray invoice_data_arr = NULL;
5278 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5279 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
5280 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5281 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5282 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5285 FREE(invoice_data_var.data);
5286 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5287 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 26, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, (uint32_t)receipient_conv);
5288 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5289 CHECK_ACCESS(ret_ptr);
5290 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5294 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5295 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5296 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 27);
5297 LDKThirtyTwoBytes ret_ref;
5298 CHECK(ret->arr_len == 32);
5299 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5302 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5303 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5304 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5306 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5307 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5308 atomic_init(&calls->refcnt, 1);
5309 calls->instance_ptr = o;
5311 LDKKeysInterface ret = {
5312 .this_arg = (void*) calls,
5313 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5314 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5315 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5316 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5317 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5318 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5319 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5320 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5321 .free = LDKKeysInterface_JCalls_free,
5325 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5326 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5327 *res_ptr = LDKKeysInterface_init(o);
5328 return (long)res_ptr;
5330 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
5331 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5332 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5333 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5334 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5335 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5336 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5337 return (uint32_t)ret_conv;
5340 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
5341 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5342 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5343 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5344 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5345 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5346 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5347 CVec_u8Z_free(ret_var);
5351 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
5352 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5353 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5354 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5355 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5356 uint32_t ret_ref = 0;
5357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5360 ret_ref = (uintptr_t)ret_var.inner;
5361 if (ret_var.is_owned) {
5367 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) {
5368 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5369 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5370 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5371 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5372 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5373 return (uint32_t)ret_ret;
5376 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
5377 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5378 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5379 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5380 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5381 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5385 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
5386 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5387 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5388 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5389 LDKu8slice reader_ref;
5390 reader_ref.datalen = reader->arr_len;
5391 reader_ref.data = reader->elems /* XXX reader leaks */;
5392 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5393 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5394 return (uint32_t)ret_conv;
5397 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) {
5398 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5399 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5400 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5401 LDKu8slice hrp_bytes_ref;
5402 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5403 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
5404 LDKCVec_u5Z invoice_data_constr;
5405 invoice_data_constr.datalen = invoice_data->arr_len;
5406 if (invoice_data_constr.datalen > 0)
5407 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5409 invoice_data_constr.data = NULL;
5410 int8_t* invoice_data_vals = (void*) invoice_data->elems /* XXX invoice_data leaks */;
5411 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5412 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5414 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5416 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5417 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5418 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5419 return (uint32_t)ret_conv;
5422 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
5423 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5424 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5425 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5426 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5427 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5431 typedef struct LDKFeeEstimator_JCalls {
5432 atomic_size_t refcnt;
5433 uint32_t instance_ptr;
5434 } LDKFeeEstimator_JCalls;
5435 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5436 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5441 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5442 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5443 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5444 return js_invoke_function_1(j_calls->instance_ptr, 28, (uint32_t)confirmation_target_conv);
5446 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5447 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5448 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5450 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5451 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5452 atomic_init(&calls->refcnt, 1);
5453 calls->instance_ptr = o;
5455 LDKFeeEstimator ret = {
5456 .this_arg = (void*) calls,
5457 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5458 .free = LDKFeeEstimator_JCalls_free,
5462 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5463 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5464 *res_ptr = LDKFeeEstimator_init(o);
5465 return (long)res_ptr;
5467 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) {
5468 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5469 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5470 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5471 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5472 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5476 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5477 return ThirtyTwoBytes_clone(&owner->a);
5479 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
5480 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5481 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5482 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5486 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5489 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
5490 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5491 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5492 uint32_t ret_ref = 0;
5493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5496 ret_ref = (uintptr_t)ret_var.inner & ~1;
5500 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5501 CHECK(owner->result_ok);
5502 return &*owner->contents.result;
5504 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
5505 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5506 uint32_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
5510 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5511 CHECK(!owner->result_ok);
5512 return DecodeError_clone(&*owner->contents.err);
5514 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
5515 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5516 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5517 uint32_t ret_ref = 0;
5518 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5519 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5521 ret_ref = (uintptr_t)ret_var.inner;
5522 if (ret_var.is_owned) {
5528 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5529 CHECK(owner->result_ok);
5530 return ChannelConfig_clone(&*owner->contents.result);
5532 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
5533 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5534 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5535 uint32_t ret_ref = 0;
5536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5539 ret_ref = (uintptr_t)ret_var.inner;
5540 if (ret_var.is_owned) {
5546 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5547 CHECK(!owner->result_ok);
5548 return DecodeError_clone(&*owner->contents.err);
5550 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
5551 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5552 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5553 uint32_t ret_ref = 0;
5554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5557 ret_ref = (uintptr_t)ret_var.inner;
5558 if (ret_var.is_owned) {
5564 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5565 CHECK(owner->result_ok);
5566 return OutPoint_clone(&*owner->contents.result);
5568 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
5569 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5570 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5571 uint32_t ret_ref = 0;
5572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5575 ret_ref = (uintptr_t)ret_var.inner;
5576 if (ret_var.is_owned) {
5582 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5583 CHECK(!owner->result_ok);
5584 return DecodeError_clone(&*owner->contents.err);
5586 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
5587 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5588 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5589 uint32_t ret_ref = 0;
5590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5593 ret_ref = (uintptr_t)ret_var.inner;
5594 if (ret_var.is_owned) {
5600 typedef struct LDKType_JCalls {
5601 atomic_size_t refcnt;
5602 uint32_t instance_ptr;
5604 static void LDKType_JCalls_free(void* this_arg) {
5605 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5606 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5610 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5611 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5612 return js_invoke_function_0(j_calls->instance_ptr, 29);
5614 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5615 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5616 jstring ret = (jstring)js_invoke_function_0(j_calls->instance_ptr, 30);
5617 LDKStr ret_conv = str_ref_to_owned_c(ret);
5620 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5621 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5622 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 31);
5623 LDKCVec_u8Z ret_ref;
5624 ret_ref.datalen = ret->arr_len;
5625 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5626 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5629 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5630 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5631 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5633 static inline LDKType LDKType_init (JSValue o) {
5634 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5635 atomic_init(&calls->refcnt, 1);
5636 calls->instance_ptr = o;
5639 .this_arg = (void*) calls,
5640 .type_id = type_id_LDKType_jcall,
5641 .debug_str = debug_str_LDKType_jcall,
5642 .write = write_LDKType_jcall,
5643 .cloned = LDKType_JCalls_cloned,
5644 .free = LDKType_JCalls_free,
5648 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5649 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5650 *res_ptr = LDKType_init(o);
5651 return (long)res_ptr;
5653 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
5654 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5655 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5656 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5657 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5661 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
5662 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5663 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5664 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5665 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5666 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5671 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
5672 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5673 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5674 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5675 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5676 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5677 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5678 CVec_u8Z_free(ret_var);
5682 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5683 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5685 case LDKCOption_TypeZ_Some: return 0;
5686 case LDKCOption_TypeZ_None: return 1;
5690 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5691 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5692 assert(obj->tag == LDKCOption_TypeZ_Some);
5693 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5694 *some_ret = Type_clone(&obj->some);
5695 return (uint32_t)some_ret;
5697 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5698 CHECK(owner->result_ok);
5699 return COption_TypeZ_clone(&*owner->contents.result);
5701 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5702 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5703 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5704 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5705 uint32_t ret_ref = (uintptr_t)ret_copy;
5709 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5710 CHECK(!owner->result_ok);
5711 return DecodeError_clone(&*owner->contents.err);
5713 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
5714 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5715 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5716 uint32_t ret_ref = 0;
5717 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5718 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5720 ret_ref = (uintptr_t)ret_var.inner;
5721 if (ret_var.is_owned) {
5727 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
5728 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5730 case LDKPaymentError_Invoice: return 0;
5731 case LDKPaymentError_Routing: return 1;
5732 case LDKPaymentError_Sending: return 2;
5736 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
5737 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5738 assert(obj->tag == LDKPaymentError_Invoice);
5739 LDKStr invoice_str = obj->invoice;
5740 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5741 return invoice_conv;
5743 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
5744 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5745 assert(obj->tag == LDKPaymentError_Routing);
5746 LDKLightningError routing_var = obj->routing;
5747 uint32_t routing_ref = 0;
5748 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5749 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5750 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5751 routing_ref = (uintptr_t)routing_var.inner & ~1;
5754 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
5755 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5756 assert(obj->tag == LDKPaymentError_Sending);
5757 uint32_t sending_ref = ((uintptr_t)&obj->sending) | 1;
5760 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5761 CHECK(owner->result_ok);
5762 return ThirtyTwoBytes_clone(&*owner->contents.result);
5764 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
5765 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5766 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5767 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5771 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5772 CHECK(!owner->result_ok);
5773 return PaymentError_clone(&*owner->contents.err);
5775 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
5776 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5777 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5778 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5779 uint32_t ret_ref = (uintptr_t)ret_copy;
5783 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint32_t ptr) {
5784 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5786 case LDKParseError_Bech32Error: return 0;
5787 case LDKParseError_ParseAmountError: return 1;
5788 case LDKParseError_MalformedSignature: return 2;
5789 case LDKParseError_BadPrefix: return 3;
5790 case LDKParseError_UnknownCurrency: return 4;
5791 case LDKParseError_UnknownSiPrefix: return 5;
5792 case LDKParseError_MalformedHRP: return 6;
5793 case LDKParseError_TooShortDataPart: return 7;
5794 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5795 case LDKParseError_DescriptionDecodeError: return 9;
5796 case LDKParseError_PaddingError: return 10;
5797 case LDKParseError_IntegerOverflowError: return 11;
5798 case LDKParseError_InvalidSegWitProgramLength: return 12;
5799 case LDKParseError_InvalidPubKeyHashLength: return 13;
5800 case LDKParseError_InvalidScriptHashLength: return 14;
5801 case LDKParseError_InvalidRecoveryId: return 15;
5802 case LDKParseError_InvalidSliceLength: return 16;
5803 case LDKParseError_Skip: return 17;
5807 uint32_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint32_t ptr) {
5808 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5809 assert(obj->tag == LDKParseError_Bech32Error);
5810 uint32_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
5811 return bech32_error_ref;
5813 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint32_t ptr) {
5814 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5815 assert(obj->tag == LDKParseError_ParseAmountError);
5816 /*obj->parse_amount_error*/
5819 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint32_t ptr) {
5820 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5821 assert(obj->tag == LDKParseError_MalformedSignature);
5822 uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5823 return malformed_signature_conv;
5825 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint32_t ptr) {
5826 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5827 assert(obj->tag == LDKParseError_DescriptionDecodeError);
5828 /*obj->description_decode_error*/
5831 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint32_t ptr) {
5832 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5833 assert(obj->tag == LDKParseError_InvalidSliceLength);
5834 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5835 jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5836 return invalid_slice_length_conv;
5838 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5839 CHECK(owner->result_ok);
5840 return SiPrefix_clone(&*owner->contents.result);
5842 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint32_t owner) {
5843 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5844 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5848 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5849 CHECK(!owner->result_ok);
5850 return ParseError_clone(&*owner->contents.err);
5852 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint32_t owner) {
5853 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5854 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5855 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5856 uint32_t ret_ref = (uintptr_t)ret_copy;
5860 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint32_t ptr) {
5861 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5863 case LDKParseOrSemanticError_ParseError: return 0;
5864 case LDKParseOrSemanticError_SemanticError: return 1;
5868 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint32_t ptr) {
5869 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5870 assert(obj->tag == LDKParseOrSemanticError_ParseError);
5871 uint32_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
5872 return parse_error_ref;
5874 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint32_t ptr) {
5875 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5876 assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5877 uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5878 return semantic_error_conv;
5880 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5881 CHECK(owner->result_ok);
5882 return Invoice_clone(&*owner->contents.result);
5884 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint32_t owner) {
5885 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5886 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5887 uint32_t ret_ref = 0;
5888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5891 ret_ref = (uintptr_t)ret_var.inner;
5892 if (ret_var.is_owned) {
5898 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5899 CHECK(!owner->result_ok);
5900 return ParseOrSemanticError_clone(&*owner->contents.err);
5902 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint32_t owner) {
5903 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5904 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5905 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5906 uint32_t ret_ref = (uintptr_t)ret_copy;
5910 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5911 CHECK(owner->result_ok);
5912 return SignedRawInvoice_clone(&*owner->contents.result);
5914 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint32_t owner) {
5915 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5916 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5917 uint32_t ret_ref = 0;
5918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5921 ret_ref = (uintptr_t)ret_var.inner;
5922 if (ret_var.is_owned) {
5928 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5929 CHECK(!owner->result_ok);
5930 return ParseError_clone(&*owner->contents.err);
5932 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint32_t owner) {
5933 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5934 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5935 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5936 uint32_t ret_ref = (uintptr_t)ret_copy;
5940 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5941 return RawInvoice_clone(&owner->a);
5943 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
5944 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5945 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5946 uint32_t ret_ref = 0;
5947 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5948 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5950 ret_ref = (uintptr_t)ret_var.inner;
5951 if (ret_var.is_owned) {
5957 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5958 return ThirtyTwoBytes_clone(&owner->b);
5960 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
5961 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5962 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5963 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5967 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5968 return InvoiceSignature_clone(&owner->c);
5970 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
5971 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5972 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5973 uint32_t ret_ref = 0;
5974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5977 ret_ref = (uintptr_t)ret_var.inner;
5978 if (ret_var.is_owned) {
5984 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5985 CHECK(owner->result_ok);
5986 return PayeePubKey_clone(&*owner->contents.result);
5988 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
5989 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5990 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5991 uint32_t ret_ref = 0;
5992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5995 ret_ref = (uintptr_t)ret_var.inner;
5996 if (ret_var.is_owned) {
6002 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6003 CHECK(!owner->result_ok);
6004 return *owner->contents.err;
6006 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
6007 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6008 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6012 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6013 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6014 for (size_t i = 0; i < ret.datalen; i++) {
6015 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6019 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6020 CHECK(owner->result_ok);
6021 return PositiveTimestamp_clone(&*owner->contents.result);
6023 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
6024 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6025 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6026 uint32_t ret_ref = 0;
6027 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6028 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6030 ret_ref = (uintptr_t)ret_var.inner;
6031 if (ret_var.is_owned) {
6037 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6038 CHECK(!owner->result_ok);
6039 return CreationError_clone(&*owner->contents.err);
6041 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
6042 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6043 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6047 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6048 CHECK(owner->result_ok);
6049 return *owner->contents.result;
6051 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
6052 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6053 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6056 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6057 CHECK(!owner->result_ok);
6058 return SemanticError_clone(&*owner->contents.err);
6060 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
6061 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6062 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6066 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6067 CHECK(owner->result_ok);
6068 return Invoice_clone(&*owner->contents.result);
6070 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
6071 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6072 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6073 uint32_t ret_ref = 0;
6074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6077 ret_ref = (uintptr_t)ret_var.inner;
6078 if (ret_var.is_owned) {
6084 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6085 CHECK(!owner->result_ok);
6086 return SemanticError_clone(&*owner->contents.err);
6088 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
6089 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6090 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6094 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6095 CHECK(owner->result_ok);
6096 return Description_clone(&*owner->contents.result);
6098 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
6099 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6100 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6101 uint32_t ret_ref = 0;
6102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6105 ret_ref = (uintptr_t)ret_var.inner;
6106 if (ret_var.is_owned) {
6112 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6113 CHECK(!owner->result_ok);
6114 return CreationError_clone(&*owner->contents.err);
6116 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
6117 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6118 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6122 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6123 CHECK(owner->result_ok);
6124 return PrivateRoute_clone(&*owner->contents.result);
6126 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
6127 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6128 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6129 uint32_t ret_ref = 0;
6130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6133 ret_ref = (uintptr_t)ret_var.inner;
6134 if (ret_var.is_owned) {
6140 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6141 CHECK(!owner->result_ok);
6142 return CreationError_clone(&*owner->contents.err);
6144 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
6145 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6146 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6150 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6151 CHECK(owner->result_ok);
6152 return *owner->contents.result;
6154 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
6155 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6156 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6157 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6161 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6162 CHECK(!owner->result_ok);
6163 return *owner->contents.err;
6165 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
6166 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6167 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6171 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6172 CHECK(owner->result_ok);
6173 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6175 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6176 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6177 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6178 uint32_t ret_ref = 0;
6179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6182 ret_ref = (uintptr_t)ret_var.inner;
6183 if (ret_var.is_owned) {
6189 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6190 CHECK(!owner->result_ok);
6191 return DecodeError_clone(&*owner->contents.err);
6193 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
6194 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6195 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6196 uint32_t ret_ref = 0;
6197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6200 ret_ref = (uintptr_t)ret_var.inner;
6201 if (ret_var.is_owned) {
6207 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
6208 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6210 case LDKCOption_MonitorEventZ_Some: return 0;
6211 case LDKCOption_MonitorEventZ_None: return 1;
6215 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
6216 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6217 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6218 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6221 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6222 CHECK(owner->result_ok);
6223 return COption_MonitorEventZ_clone(&*owner->contents.result);
6225 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
6226 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6227 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6228 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6229 uint32_t ret_ref = (uintptr_t)ret_copy;
6233 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6234 CHECK(!owner->result_ok);
6235 return DecodeError_clone(&*owner->contents.err);
6237 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
6238 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6239 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6240 uint32_t ret_ref = 0;
6241 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6242 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6244 ret_ref = (uintptr_t)ret_var.inner;
6245 if (ret_var.is_owned) {
6251 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6252 CHECK(owner->result_ok);
6253 return HTLCUpdate_clone(&*owner->contents.result);
6255 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6256 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6257 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6258 uint32_t ret_ref = 0;
6259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6262 ret_ref = (uintptr_t)ret_var.inner;
6263 if (ret_var.is_owned) {
6269 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6270 CHECK(!owner->result_ok);
6271 return DecodeError_clone(&*owner->contents.err);
6273 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
6274 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6275 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6276 uint32_t ret_ref = 0;
6277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6280 ret_ref = (uintptr_t)ret_var.inner;
6281 if (ret_var.is_owned) {
6287 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6288 return OutPoint_clone(&owner->a);
6290 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
6291 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6292 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6293 uint32_t ret_ref = 0;
6294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6297 ret_ref = (uintptr_t)ret_var.inner;
6298 if (ret_var.is_owned) {
6304 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6305 return CVec_u8Z_clone(&owner->b);
6307 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
6308 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6309 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6310 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6311 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6312 CVec_u8Z_free(ret_var);
6316 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6319 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
6320 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6321 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6325 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6326 return CVec_u8Z_clone(&owner->b);
6328 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
6329 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6330 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6331 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6332 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6333 CVec_u8Z_free(ret_var);
6337 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6338 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6339 for (size_t i = 0; i < ret.datalen; i++) {
6340 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6344 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6345 return ThirtyTwoBytes_clone(&owner->a);
6347 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
6348 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6349 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6350 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6354 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6355 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6357 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
6358 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6359 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6360 uint32_tArray ret_arr = NULL;
6361 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6362 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6363 for (size_t v = 0; v < ret_var.datalen; v++) {
6364 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6365 *ret_conv_21_conv = ret_var.data[v];
6366 ret_arr_ptr[v] = ((uint32_t)ret_conv_21_conv);
6373 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6374 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 };
6375 for (size_t i = 0; i < ret.datalen; i++) {
6376 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6380 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6381 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6382 for (size_t i = 0; i < ret.datalen; i++) {
6383 ret.data[i] = Event_clone(&orig->data[i]);
6387 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6390 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
6391 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6392 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6396 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6397 return TxOut_clone(&owner->b);
6399 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
6400 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6401 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6402 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6403 return (uint32_t)ret_ref;
6406 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6407 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6408 for (size_t i = 0; i < ret.datalen; i++) {
6409 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6413 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6414 return ThirtyTwoBytes_clone(&owner->a);
6416 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
6417 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6418 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6419 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6423 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6424 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6426 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
6427 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6428 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6429 uint32_tArray ret_arr = NULL;
6430 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6431 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6432 for (size_t u = 0; u < ret_var.datalen; u++) {
6433 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6434 *ret_conv_20_conv = ret_var.data[u];
6435 ret_arr_ptr[u] = ((uint32_t)ret_conv_20_conv);
6442 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6443 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 };
6444 for (size_t i = 0; i < ret.datalen; i++) {
6445 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6449 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
6450 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6452 case LDKBalance_ClaimableOnChannelClose: return 0;
6453 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6454 case LDKBalance_ContentiousClaimable: return 2;
6455 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6459 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
6460 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6461 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6462 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6463 return claimable_amount_satoshis_conv;
6465 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
6466 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6467 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6468 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6469 return claimable_amount_satoshis_conv;
6471 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
6472 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6473 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6474 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6475 return confirmation_height_conv;
6477 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
6478 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6479 assert(obj->tag == LDKBalance_ContentiousClaimable);
6480 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6481 return claimable_amount_satoshis_conv;
6483 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
6484 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6485 assert(obj->tag == LDKBalance_ContentiousClaimable);
6486 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6487 return timeout_height_conv;
6489 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
6490 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6491 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6492 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6493 return claimable_amount_satoshis_conv;
6495 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
6496 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6497 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6498 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6499 return claimable_height_conv;
6501 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6502 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6503 for (size_t i = 0; i < ret.datalen; i++) {
6504 ret.data[i] = Balance_clone(&orig->data[i]);
6508 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6509 return ThirtyTwoBytes_clone(&owner->a);
6511 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
6512 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6513 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6514 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6518 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6519 return ChannelMonitor_clone(&owner->b);
6521 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
6522 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6523 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6524 uint32_t ret_ref = 0;
6525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6528 ret_ref = (uintptr_t)ret_var.inner;
6529 if (ret_var.is_owned) {
6535 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6536 CHECK(owner->result_ok);
6537 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6539 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
6540 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6541 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6542 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6543 return ((uint32_t)ret_conv);
6546 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6547 CHECK(!owner->result_ok);
6548 return DecodeError_clone(&*owner->contents.err);
6550 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
6551 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6552 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6553 uint32_t ret_ref = 0;
6554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6557 ret_ref = (uintptr_t)ret_var.inner;
6558 if (ret_var.is_owned) {
6564 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6567 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
6568 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6569 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6570 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6574 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6575 return Type_clone(&owner->b);
6577 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
6578 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6579 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6580 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6581 return (uint32_t)ret_ret;
6584 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6585 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6586 for (size_t i = 0; i < ret.datalen; i++) {
6587 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6591 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint32_t ptr) {
6592 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6594 case LDKCOption_NetAddressZ_Some: return 0;
6595 case LDKCOption_NetAddressZ_None: return 1;
6599 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint32_t ptr) {
6600 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6601 assert(obj->tag == LDKCOption_NetAddressZ_Some);
6602 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6605 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6606 CHECK(owner->result_ok);
6607 return CVec_u8Z_clone(&*owner->contents.result);
6609 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
6610 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6611 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6612 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6613 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6614 CVec_u8Z_free(ret_var);
6618 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6619 CHECK(!owner->result_ok);
6620 return PeerHandleError_clone(&*owner->contents.err);
6622 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
6623 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6624 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6625 uint32_t ret_ref = 0;
6626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6629 ret_ref = (uintptr_t)ret_var.inner;
6630 if (ret_var.is_owned) {
6636 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6637 CHECK(owner->result_ok);
6638 return *owner->contents.result;
6640 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
6641 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6642 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6645 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6646 CHECK(!owner->result_ok);
6647 return PeerHandleError_clone(&*owner->contents.err);
6649 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
6650 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6651 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6652 uint32_t ret_ref = 0;
6653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6656 ret_ref = (uintptr_t)ret_var.inner;
6657 if (ret_var.is_owned) {
6663 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6664 CHECK(owner->result_ok);
6665 return *owner->contents.result;
6667 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6668 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6669 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6673 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6674 CHECK(!owner->result_ok);
6675 return PeerHandleError_clone(&*owner->contents.err);
6677 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6678 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6679 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6680 uint32_t ret_ref = 0;
6681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6684 ret_ref = (uintptr_t)ret_var.inner;
6685 if (ret_var.is_owned) {
6691 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6692 CHECK(owner->result_ok);
6693 return *owner->contents.result;
6695 void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint32_t owner) {
6696 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6697 CResult_NoneErrorZ_get_ok(owner_conv);
6700 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6701 CHECK(!owner->result_ok);
6702 return *owner->contents.err;
6704 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint32_t owner) {
6705 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6706 uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6710 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6711 CHECK(owner->result_ok);
6712 return NetAddress_clone(&*owner->contents.result);
6714 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
6715 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6716 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6717 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6718 uint32_t ret_ref = (uintptr_t)ret_copy;
6722 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6723 CHECK(!owner->result_ok);
6724 return DecodeError_clone(&*owner->contents.err);
6726 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
6727 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6728 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6729 uint32_t ret_ref = 0;
6730 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6731 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6733 ret_ref = (uintptr_t)ret_var.inner;
6734 if (ret_var.is_owned) {
6740 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6741 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6742 for (size_t i = 0; i < ret.datalen; i++) {
6743 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6747 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6748 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6749 for (size_t i = 0; i < ret.datalen; i++) {
6750 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6754 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6755 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6756 for (size_t i = 0; i < ret.datalen; i++) {
6757 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6761 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6762 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6763 for (size_t i = 0; i < ret.datalen; i++) {
6764 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6768 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6769 CHECK(owner->result_ok);
6770 return AcceptChannel_clone(&*owner->contents.result);
6772 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
6773 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6774 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6775 uint32_t ret_ref = 0;
6776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6779 ret_ref = (uintptr_t)ret_var.inner;
6780 if (ret_var.is_owned) {
6786 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6787 CHECK(!owner->result_ok);
6788 return DecodeError_clone(&*owner->contents.err);
6790 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
6791 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6792 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6793 uint32_t ret_ref = 0;
6794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6797 ret_ref = (uintptr_t)ret_var.inner;
6798 if (ret_var.is_owned) {
6804 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6805 CHECK(owner->result_ok);
6806 return AnnouncementSignatures_clone(&*owner->contents.result);
6808 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
6809 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6810 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6811 uint32_t ret_ref = 0;
6812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6815 ret_ref = (uintptr_t)ret_var.inner;
6816 if (ret_var.is_owned) {
6822 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6823 CHECK(!owner->result_ok);
6824 return DecodeError_clone(&*owner->contents.err);
6826 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
6827 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6828 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6829 uint32_t ret_ref = 0;
6830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6833 ret_ref = (uintptr_t)ret_var.inner;
6834 if (ret_var.is_owned) {
6840 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6841 CHECK(owner->result_ok);
6842 return ChannelReestablish_clone(&*owner->contents.result);
6844 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
6845 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6846 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6847 uint32_t ret_ref = 0;
6848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6851 ret_ref = (uintptr_t)ret_var.inner;
6852 if (ret_var.is_owned) {
6858 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6859 CHECK(!owner->result_ok);
6860 return DecodeError_clone(&*owner->contents.err);
6862 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
6863 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6864 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6865 uint32_t ret_ref = 0;
6866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6869 ret_ref = (uintptr_t)ret_var.inner;
6870 if (ret_var.is_owned) {
6876 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6877 CHECK(owner->result_ok);
6878 return ClosingSigned_clone(&*owner->contents.result);
6880 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6881 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6882 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6883 uint32_t ret_ref = 0;
6884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6887 ret_ref = (uintptr_t)ret_var.inner;
6888 if (ret_var.is_owned) {
6894 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6895 CHECK(!owner->result_ok);
6896 return DecodeError_clone(&*owner->contents.err);
6898 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
6899 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6900 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6901 uint32_t ret_ref = 0;
6902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6905 ret_ref = (uintptr_t)ret_var.inner;
6906 if (ret_var.is_owned) {
6912 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6913 CHECK(owner->result_ok);
6914 return ClosingSignedFeeRange_clone(&*owner->contents.result);
6916 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
6917 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6918 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6919 uint32_t ret_ref = 0;
6920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6923 ret_ref = (uintptr_t)ret_var.inner;
6924 if (ret_var.is_owned) {
6930 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6931 CHECK(!owner->result_ok);
6932 return DecodeError_clone(&*owner->contents.err);
6934 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
6935 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6936 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6937 uint32_t ret_ref = 0;
6938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6941 ret_ref = (uintptr_t)ret_var.inner;
6942 if (ret_var.is_owned) {
6948 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6949 CHECK(owner->result_ok);
6950 return CommitmentSigned_clone(&*owner->contents.result);
6952 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
6953 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6954 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6955 uint32_t ret_ref = 0;
6956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6957 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6959 ret_ref = (uintptr_t)ret_var.inner;
6960 if (ret_var.is_owned) {
6966 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6967 CHECK(!owner->result_ok);
6968 return DecodeError_clone(&*owner->contents.err);
6970 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
6971 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6972 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6973 uint32_t ret_ref = 0;
6974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6977 ret_ref = (uintptr_t)ret_var.inner;
6978 if (ret_var.is_owned) {
6984 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6985 CHECK(owner->result_ok);
6986 return FundingCreated_clone(&*owner->contents.result);
6988 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
6989 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6990 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6991 uint32_t ret_ref = 0;
6992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6995 ret_ref = (uintptr_t)ret_var.inner;
6996 if (ret_var.is_owned) {
7002 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7003 CHECK(!owner->result_ok);
7004 return DecodeError_clone(&*owner->contents.err);
7006 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
7007 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7008 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7009 uint32_t ret_ref = 0;
7010 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7011 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7013 ret_ref = (uintptr_t)ret_var.inner;
7014 if (ret_var.is_owned) {
7020 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7021 CHECK(owner->result_ok);
7022 return FundingSigned_clone(&*owner->contents.result);
7024 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
7025 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7026 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7027 uint32_t ret_ref = 0;
7028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7031 ret_ref = (uintptr_t)ret_var.inner;
7032 if (ret_var.is_owned) {
7038 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7039 CHECK(!owner->result_ok);
7040 return DecodeError_clone(&*owner->contents.err);
7042 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
7043 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7044 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7045 uint32_t ret_ref = 0;
7046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7049 ret_ref = (uintptr_t)ret_var.inner;
7050 if (ret_var.is_owned) {
7056 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7057 CHECK(owner->result_ok);
7058 return ChannelReady_clone(&*owner->contents.result);
7060 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint32_t owner) {
7061 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7062 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7063 uint32_t ret_ref = 0;
7064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7067 ret_ref = (uintptr_t)ret_var.inner;
7068 if (ret_var.is_owned) {
7074 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7075 CHECK(!owner->result_ok);
7076 return DecodeError_clone(&*owner->contents.err);
7078 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint32_t owner) {
7079 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7080 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7081 uint32_t ret_ref = 0;
7082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7085 ret_ref = (uintptr_t)ret_var.inner;
7086 if (ret_var.is_owned) {
7092 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7093 CHECK(owner->result_ok);
7094 return Init_clone(&*owner->contents.result);
7096 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
7097 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7098 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7099 uint32_t ret_ref = 0;
7100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7103 ret_ref = (uintptr_t)ret_var.inner;
7104 if (ret_var.is_owned) {
7110 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7111 CHECK(!owner->result_ok);
7112 return DecodeError_clone(&*owner->contents.err);
7114 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
7115 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7116 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7117 uint32_t ret_ref = 0;
7118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7121 ret_ref = (uintptr_t)ret_var.inner;
7122 if (ret_var.is_owned) {
7128 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7129 CHECK(owner->result_ok);
7130 return OpenChannel_clone(&*owner->contents.result);
7132 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
7133 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7134 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7135 uint32_t ret_ref = 0;
7136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7139 ret_ref = (uintptr_t)ret_var.inner;
7140 if (ret_var.is_owned) {
7146 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7147 CHECK(!owner->result_ok);
7148 return DecodeError_clone(&*owner->contents.err);
7150 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
7151 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7152 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7153 uint32_t ret_ref = 0;
7154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7157 ret_ref = (uintptr_t)ret_var.inner;
7158 if (ret_var.is_owned) {
7164 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7165 CHECK(owner->result_ok);
7166 return RevokeAndACK_clone(&*owner->contents.result);
7168 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
7169 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7170 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7171 uint32_t ret_ref = 0;
7172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7175 ret_ref = (uintptr_t)ret_var.inner;
7176 if (ret_var.is_owned) {
7182 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7183 CHECK(!owner->result_ok);
7184 return DecodeError_clone(&*owner->contents.err);
7186 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
7187 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7188 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7189 uint32_t ret_ref = 0;
7190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7193 ret_ref = (uintptr_t)ret_var.inner;
7194 if (ret_var.is_owned) {
7200 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7201 CHECK(owner->result_ok);
7202 return Shutdown_clone(&*owner->contents.result);
7204 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
7205 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7206 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7207 uint32_t ret_ref = 0;
7208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7211 ret_ref = (uintptr_t)ret_var.inner;
7212 if (ret_var.is_owned) {
7218 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7219 CHECK(!owner->result_ok);
7220 return DecodeError_clone(&*owner->contents.err);
7222 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
7223 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7224 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7225 uint32_t ret_ref = 0;
7226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7229 ret_ref = (uintptr_t)ret_var.inner;
7230 if (ret_var.is_owned) {
7236 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7237 CHECK(owner->result_ok);
7238 return UpdateFailHTLC_clone(&*owner->contents.result);
7240 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7241 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7242 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7243 uint32_t ret_ref = 0;
7244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7247 ret_ref = (uintptr_t)ret_var.inner;
7248 if (ret_var.is_owned) {
7254 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7255 CHECK(!owner->result_ok);
7256 return DecodeError_clone(&*owner->contents.err);
7258 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
7259 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7260 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7261 uint32_t ret_ref = 0;
7262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7265 ret_ref = (uintptr_t)ret_var.inner;
7266 if (ret_var.is_owned) {
7272 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7273 CHECK(owner->result_ok);
7274 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
7276 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7277 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7278 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7279 uint32_t ret_ref = 0;
7280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7283 ret_ref = (uintptr_t)ret_var.inner;
7284 if (ret_var.is_owned) {
7290 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7291 CHECK(!owner->result_ok);
7292 return DecodeError_clone(&*owner->contents.err);
7294 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
7295 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7296 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7297 uint32_t ret_ref = 0;
7298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7301 ret_ref = (uintptr_t)ret_var.inner;
7302 if (ret_var.is_owned) {
7308 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7309 CHECK(owner->result_ok);
7310 return UpdateFee_clone(&*owner->contents.result);
7312 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7313 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7314 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7315 uint32_t ret_ref = 0;
7316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7319 ret_ref = (uintptr_t)ret_var.inner;
7320 if (ret_var.is_owned) {
7326 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7327 CHECK(!owner->result_ok);
7328 return DecodeError_clone(&*owner->contents.err);
7330 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7331 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7332 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7333 uint32_t ret_ref = 0;
7334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7337 ret_ref = (uintptr_t)ret_var.inner;
7338 if (ret_var.is_owned) {
7344 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7345 CHECK(owner->result_ok);
7346 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7348 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7349 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7350 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7351 uint32_t ret_ref = 0;
7352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7355 ret_ref = (uintptr_t)ret_var.inner;
7356 if (ret_var.is_owned) {
7362 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7363 CHECK(!owner->result_ok);
7364 return DecodeError_clone(&*owner->contents.err);
7366 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7367 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7368 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7369 uint32_t ret_ref = 0;
7370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7373 ret_ref = (uintptr_t)ret_var.inner;
7374 if (ret_var.is_owned) {
7380 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7381 CHECK(owner->result_ok);
7382 return UpdateAddHTLC_clone(&*owner->contents.result);
7384 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7385 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7386 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7387 uint32_t ret_ref = 0;
7388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7391 ret_ref = (uintptr_t)ret_var.inner;
7392 if (ret_var.is_owned) {
7398 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7399 CHECK(!owner->result_ok);
7400 return DecodeError_clone(&*owner->contents.err);
7402 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7403 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7404 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7405 uint32_t ret_ref = 0;
7406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7409 ret_ref = (uintptr_t)ret_var.inner;
7410 if (ret_var.is_owned) {
7416 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7417 CHECK(owner->result_ok);
7418 return Ping_clone(&*owner->contents.result);
7420 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7421 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7422 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7423 uint32_t ret_ref = 0;
7424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7427 ret_ref = (uintptr_t)ret_var.inner;
7428 if (ret_var.is_owned) {
7434 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7435 CHECK(!owner->result_ok);
7436 return DecodeError_clone(&*owner->contents.err);
7438 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7439 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7440 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7441 uint32_t ret_ref = 0;
7442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7445 ret_ref = (uintptr_t)ret_var.inner;
7446 if (ret_var.is_owned) {
7452 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7453 CHECK(owner->result_ok);
7454 return Pong_clone(&*owner->contents.result);
7456 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7457 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7458 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7459 uint32_t ret_ref = 0;
7460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7463 ret_ref = (uintptr_t)ret_var.inner;
7464 if (ret_var.is_owned) {
7470 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7471 CHECK(!owner->result_ok);
7472 return DecodeError_clone(&*owner->contents.err);
7474 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7475 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7476 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7477 uint32_t ret_ref = 0;
7478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7481 ret_ref = (uintptr_t)ret_var.inner;
7482 if (ret_var.is_owned) {
7488 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7489 CHECK(owner->result_ok);
7490 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7492 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7493 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7494 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7495 uint32_t ret_ref = 0;
7496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7499 ret_ref = (uintptr_t)ret_var.inner;
7500 if (ret_var.is_owned) {
7506 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7507 CHECK(!owner->result_ok);
7508 return DecodeError_clone(&*owner->contents.err);
7510 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7511 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7512 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7513 uint32_t ret_ref = 0;
7514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7517 ret_ref = (uintptr_t)ret_var.inner;
7518 if (ret_var.is_owned) {
7524 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7525 CHECK(owner->result_ok);
7526 return ChannelAnnouncement_clone(&*owner->contents.result);
7528 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7529 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7530 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7531 uint32_t ret_ref = 0;
7532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7535 ret_ref = (uintptr_t)ret_var.inner;
7536 if (ret_var.is_owned) {
7542 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7543 CHECK(!owner->result_ok);
7544 return DecodeError_clone(&*owner->contents.err);
7546 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7547 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7548 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7549 uint32_t ret_ref = 0;
7550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7553 ret_ref = (uintptr_t)ret_var.inner;
7554 if (ret_var.is_owned) {
7560 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7561 CHECK(owner->result_ok);
7562 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7564 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7565 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7566 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7567 uint32_t ret_ref = 0;
7568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7571 ret_ref = (uintptr_t)ret_var.inner;
7572 if (ret_var.is_owned) {
7578 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7579 CHECK(!owner->result_ok);
7580 return DecodeError_clone(&*owner->contents.err);
7582 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7583 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7584 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7585 uint32_t ret_ref = 0;
7586 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7587 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7589 ret_ref = (uintptr_t)ret_var.inner;
7590 if (ret_var.is_owned) {
7596 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7597 CHECK(owner->result_ok);
7598 return ChannelUpdate_clone(&*owner->contents.result);
7600 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7601 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7602 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7603 uint32_t ret_ref = 0;
7604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7607 ret_ref = (uintptr_t)ret_var.inner;
7608 if (ret_var.is_owned) {
7614 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7615 CHECK(!owner->result_ok);
7616 return DecodeError_clone(&*owner->contents.err);
7618 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7619 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7620 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7621 uint32_t ret_ref = 0;
7622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7625 ret_ref = (uintptr_t)ret_var.inner;
7626 if (ret_var.is_owned) {
7632 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7633 CHECK(owner->result_ok);
7634 return ErrorMessage_clone(&*owner->contents.result);
7636 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7637 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7638 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7639 uint32_t ret_ref = 0;
7640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7643 ret_ref = (uintptr_t)ret_var.inner;
7644 if (ret_var.is_owned) {
7650 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7651 CHECK(!owner->result_ok);
7652 return DecodeError_clone(&*owner->contents.err);
7654 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7655 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7656 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7657 uint32_t ret_ref = 0;
7658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7661 ret_ref = (uintptr_t)ret_var.inner;
7662 if (ret_var.is_owned) {
7668 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7669 CHECK(owner->result_ok);
7670 return WarningMessage_clone(&*owner->contents.result);
7672 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7673 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7674 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7675 uint32_t ret_ref = 0;
7676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7679 ret_ref = (uintptr_t)ret_var.inner;
7680 if (ret_var.is_owned) {
7686 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7687 CHECK(!owner->result_ok);
7688 return DecodeError_clone(&*owner->contents.err);
7690 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7691 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7692 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7693 uint32_t ret_ref = 0;
7694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7697 ret_ref = (uintptr_t)ret_var.inner;
7698 if (ret_var.is_owned) {
7704 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7705 CHECK(owner->result_ok);
7706 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7708 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7709 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7710 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7711 uint32_t ret_ref = 0;
7712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7715 ret_ref = (uintptr_t)ret_var.inner;
7716 if (ret_var.is_owned) {
7722 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7723 CHECK(!owner->result_ok);
7724 return DecodeError_clone(&*owner->contents.err);
7726 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7727 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7728 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7729 uint32_t ret_ref = 0;
7730 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7731 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7733 ret_ref = (uintptr_t)ret_var.inner;
7734 if (ret_var.is_owned) {
7740 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7741 CHECK(owner->result_ok);
7742 return NodeAnnouncement_clone(&*owner->contents.result);
7744 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7745 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7746 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7747 uint32_t ret_ref = 0;
7748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7751 ret_ref = (uintptr_t)ret_var.inner;
7752 if (ret_var.is_owned) {
7758 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7759 CHECK(!owner->result_ok);
7760 return DecodeError_clone(&*owner->contents.err);
7762 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7763 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7764 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7765 uint32_t ret_ref = 0;
7766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7769 ret_ref = (uintptr_t)ret_var.inner;
7770 if (ret_var.is_owned) {
7776 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7777 CHECK(owner->result_ok);
7778 return QueryShortChannelIds_clone(&*owner->contents.result);
7780 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
7781 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7782 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7783 uint32_t ret_ref = 0;
7784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7787 ret_ref = (uintptr_t)ret_var.inner;
7788 if (ret_var.is_owned) {
7794 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7795 CHECK(!owner->result_ok);
7796 return DecodeError_clone(&*owner->contents.err);
7798 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
7799 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7800 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7801 uint32_t ret_ref = 0;
7802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7805 ret_ref = (uintptr_t)ret_var.inner;
7806 if (ret_var.is_owned) {
7812 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7813 CHECK(owner->result_ok);
7814 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7816 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
7817 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7818 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7819 uint32_t ret_ref = 0;
7820 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7821 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7823 ret_ref = (uintptr_t)ret_var.inner;
7824 if (ret_var.is_owned) {
7830 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7831 CHECK(!owner->result_ok);
7832 return DecodeError_clone(&*owner->contents.err);
7834 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
7835 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7836 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7837 uint32_t ret_ref = 0;
7838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7841 ret_ref = (uintptr_t)ret_var.inner;
7842 if (ret_var.is_owned) {
7848 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7849 CHECK(owner->result_ok);
7850 return QueryChannelRange_clone(&*owner->contents.result);
7852 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7853 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7854 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7855 uint32_t ret_ref = 0;
7856 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7857 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7859 ret_ref = (uintptr_t)ret_var.inner;
7860 if (ret_var.is_owned) {
7866 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7867 CHECK(!owner->result_ok);
7868 return DecodeError_clone(&*owner->contents.err);
7870 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7871 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7872 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7873 uint32_t ret_ref = 0;
7874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7877 ret_ref = (uintptr_t)ret_var.inner;
7878 if (ret_var.is_owned) {
7884 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7885 CHECK(owner->result_ok);
7886 return ReplyChannelRange_clone(&*owner->contents.result);
7888 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7889 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7890 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7891 uint32_t ret_ref = 0;
7892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7895 ret_ref = (uintptr_t)ret_var.inner;
7896 if (ret_var.is_owned) {
7902 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7903 CHECK(!owner->result_ok);
7904 return DecodeError_clone(&*owner->contents.err);
7906 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7907 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7908 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7909 uint32_t ret_ref = 0;
7910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7913 ret_ref = (uintptr_t)ret_var.inner;
7914 if (ret_var.is_owned) {
7920 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7921 CHECK(owner->result_ok);
7922 return GossipTimestampFilter_clone(&*owner->contents.result);
7924 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
7925 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7926 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7927 uint32_t ret_ref = 0;
7928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7931 ret_ref = (uintptr_t)ret_var.inner;
7932 if (ret_var.is_owned) {
7938 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7939 CHECK(!owner->result_ok);
7940 return DecodeError_clone(&*owner->contents.err);
7942 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
7943 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7944 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7945 uint32_t ret_ref = 0;
7946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7949 ret_ref = (uintptr_t)ret_var.inner;
7950 if (ret_var.is_owned) {
7956 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
7957 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7959 case LDKSignOrCreationError_SignError: return 0;
7960 case LDKSignOrCreationError_CreationError: return 1;
7964 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
7965 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7966 assert(obj->tag == LDKSignOrCreationError_CreationError);
7967 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7968 return creation_error_conv;
7970 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7971 CHECK(owner->result_ok);
7972 return Invoice_clone(&*owner->contents.result);
7974 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
7975 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7976 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7977 uint32_t ret_ref = 0;
7978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7981 ret_ref = (uintptr_t)ret_var.inner;
7982 if (ret_var.is_owned) {
7988 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7989 CHECK(!owner->result_ok);
7990 return SignOrCreationError_clone(&*owner->contents.err);
7992 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
7993 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7994 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7995 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7996 uint32_t ret_ref = (uintptr_t)ret_copy;
8000 typedef struct LDKFilter_JCalls {
8001 atomic_size_t refcnt;
8002 uint32_t instance_ptr;
8004 static void LDKFilter_JCalls_free(void* this_arg) {
8005 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8006 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8010 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8011 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8012 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8013 memcpy(txid_arr->elems, *txid, 32);
8014 LDKu8slice script_pubkey_var = script_pubkey;
8015 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8016 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8017 js_invoke_function_2(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
8019 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8020 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8021 LDKWatchedOutput output_var = output;
8022 uint32_t output_ref = 0;
8023 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8024 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8025 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8026 output_ref = (uintptr_t)output_var.inner;
8027 if (output_var.is_owned) {
8030 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 33, (uint32_t)output_ref);
8031 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8032 CHECK_ACCESS(ret_ptr);
8033 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
8037 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8038 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8039 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8041 static inline LDKFilter LDKFilter_init (JSValue o) {
8042 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8043 atomic_init(&calls->refcnt, 1);
8044 calls->instance_ptr = o;
8047 .this_arg = (void*) calls,
8048 .register_tx = register_tx_LDKFilter_jcall,
8049 .register_output = register_output_LDKFilter_jcall,
8050 .free = LDKFilter_JCalls_free,
8054 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8055 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8056 *res_ptr = LDKFilter_init(o);
8057 return (long)res_ptr;
8059 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8060 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8061 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8062 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8063 unsigned char txid_arr[32];
8064 CHECK(txid->arr_len == 32);
8065 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8066 unsigned char (*txid_ref)[32] = &txid_arr;
8067 LDKu8slice script_pubkey_ref;
8068 script_pubkey_ref.datalen = script_pubkey->arr_len;
8069 script_pubkey_ref.data = script_pubkey->elems /* XXX script_pubkey leaks */;
8070 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8073 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
8074 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8075 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8076 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8077 LDKWatchedOutput output_conv;
8078 output_conv.inner = (void*)(output & (~1));
8079 output_conv.is_owned = (output & 1) || (output == 0);
8080 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8081 output_conv = WatchedOutput_clone(&output_conv);
8082 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8083 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8084 uint32_t ret_ref = (uintptr_t)ret_copy;
8088 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
8089 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8091 case LDKCOption_FilterZ_Some: return 0;
8092 case LDKCOption_FilterZ_None: return 1;
8096 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
8097 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8098 assert(obj->tag == LDKCOption_FilterZ_Some);
8099 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8100 *some_ret = obj->some;
8101 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8102 if ((*some_ret).free == LDKFilter_JCalls_free) {
8103 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8104 LDKFilter_JCalls_cloned(&(*some_ret));
8106 return (uint32_t)some_ret;
8108 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8109 CHECK(owner->result_ok);
8110 return &*owner->contents.result;
8112 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
8113 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8114 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8115 uint32_t ret_ref = 0;
8116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8119 ret_ref = (uintptr_t)ret_var.inner & ~1;
8123 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8124 CHECK(!owner->result_ok);
8125 return *owner->contents.err;
8127 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
8128 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8129 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8132 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8133 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8134 for (size_t i = 0; i < ret.datalen; i++) {
8135 ret.data[i] = OutPoint_clone(&orig->data[i]);
8139 typedef struct LDKMessageSendEventsProvider_JCalls {
8140 atomic_size_t refcnt;
8141 uint32_t instance_ptr;
8142 } LDKMessageSendEventsProvider_JCalls;
8143 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8144 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8145 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8149 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8150 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8151 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 34);
8152 LDKCVec_MessageSendEventZ ret_constr;
8153 ret_constr.datalen = ret->arr_len;
8154 if (ret_constr.datalen > 0)
8155 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8157 ret_constr.data = NULL;
8158 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
8159 for (size_t s = 0; s < ret_constr.datalen; s++) {
8160 uint32_t ret_conv_18 = ret_vals[s];
8161 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
8162 CHECK_ACCESS(ret_conv_18_ptr);
8163 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8164 FREE((void*)ret_conv_18);
8165 ret_constr.data[s] = ret_conv_18_conv;
8169 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8170 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8171 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8173 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8174 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8175 atomic_init(&calls->refcnt, 1);
8176 calls->instance_ptr = o;
8178 LDKMessageSendEventsProvider ret = {
8179 .this_arg = (void*) calls,
8180 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8181 .free = LDKMessageSendEventsProvider_JCalls_free,
8185 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8186 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8187 *res_ptr = LDKMessageSendEventsProvider_init(o);
8188 return (long)res_ptr;
8190 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) {
8191 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8192 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8193 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8194 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8195 uint32_tArray ret_arr = NULL;
8196 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
8197 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8198 for (size_t s = 0; s < ret_var.datalen; s++) {
8199 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8200 *ret_conv_18_copy = ret_var.data[s];
8201 uint32_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
8202 ret_arr_ptr[s] = ret_conv_18_ref;
8209 typedef struct LDKEventHandler_JCalls {
8210 atomic_size_t refcnt;
8211 uint32_t instance_ptr;
8212 } LDKEventHandler_JCalls;
8213 static void LDKEventHandler_JCalls_free(void* this_arg) {
8214 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8215 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8219 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8220 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8221 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8222 *ret_event = Event_clone(event);
8223 js_invoke_function_1(j_calls->instance_ptr, 35, (uint32_t)(uint32_t)ret_event);
8225 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8226 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8227 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8229 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8230 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8231 atomic_init(&calls->refcnt, 1);
8232 calls->instance_ptr = o;
8234 LDKEventHandler ret = {
8235 .this_arg = (void*) calls,
8236 .handle_event = handle_event_LDKEventHandler_jcall,
8237 .free = LDKEventHandler_JCalls_free,
8241 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8242 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8243 *res_ptr = LDKEventHandler_init(o);
8244 return (long)res_ptr;
8246 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
8247 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8248 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8249 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8250 LDKEvent* event_conv = (LDKEvent*)event;
8251 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8254 typedef struct LDKEventsProvider_JCalls {
8255 atomic_size_t refcnt;
8256 uint32_t instance_ptr;
8257 } LDKEventsProvider_JCalls;
8258 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8259 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8260 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8264 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8265 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8266 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8267 *handler_ret = handler;
8268 js_invoke_function_1(j_calls->instance_ptr, 36, (uint32_t)(uint32_t)handler_ret);
8270 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8271 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8272 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8274 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8275 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8276 atomic_init(&calls->refcnt, 1);
8277 calls->instance_ptr = o;
8279 LDKEventsProvider ret = {
8280 .this_arg = (void*) calls,
8281 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8282 .free = LDKEventsProvider_JCalls_free,
8286 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8287 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8288 *res_ptr = LDKEventsProvider_init(o);
8289 return (long)res_ptr;
8291 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
8292 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8294 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8295 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
8296 CHECK_ACCESS(handler_ptr);
8297 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8298 if (handler_conv.free == LDKEventHandler_JCalls_free) {
8299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8300 LDKEventHandler_JCalls_cloned(&handler_conv);
8302 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8305 typedef struct LDKScore_JCalls {
8306 atomic_size_t refcnt;
8307 uint32_t instance_ptr;
8309 static void LDKScore_JCalls_free(void* this_arg) {
8310 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8311 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8315 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8316 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8317 int64_t short_channel_id_conv = short_channel_id;
8318 LDKNodeId source_var = *source;
8319 uint32_t source_ref = 0;
8320 source_var = NodeId_clone(&source_var);
8321 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8322 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8323 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8324 source_ref = (uintptr_t)source_var.inner;
8325 if (source_var.is_owned) {
8328 LDKNodeId target_var = *target;
8329 uint32_t target_ref = 0;
8330 target_var = NodeId_clone(&target_var);
8331 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8332 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8333 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8334 target_ref = (uintptr_t)target_var.inner;
8335 if (target_var.is_owned) {
8338 LDKChannelUsage usage_var = usage;
8339 uint32_t usage_ref = 0;
8340 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8341 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8342 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8343 usage_ref = (uintptr_t)usage_var.inner;
8344 if (usage_var.is_owned) {
8347 return js_invoke_function_4(j_calls->instance_ptr, 37, (uint32_t)short_channel_id_conv, (uint32_t)source_ref, (uint32_t)target_ref, (uint32_t)usage_ref);
8349 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8350 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8351 LDKCVec_RouteHopZ path_var = path;
8352 uint32_tArray path_arr = NULL;
8353 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8354 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8355 for (size_t k = 0; k < path_var.datalen; k++) {
8356 LDKRouteHop path_conv_10_var = path_var.data[k];
8357 uint32_t path_conv_10_ref = 0;
8358 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8359 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8360 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8361 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8362 if (path_conv_10_var.is_owned) {
8363 path_conv_10_ref |= 1;
8365 path_arr_ptr[k] = path_conv_10_ref;
8368 FREE(path_var.data);
8369 int64_t short_channel_id_conv = short_channel_id;
8370 js_invoke_function_2(j_calls->instance_ptr, 38, (uint32_t)path_arr, (uint32_t)short_channel_id_conv);
8372 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8373 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8374 LDKCVec_RouteHopZ path_var = path;
8375 uint32_tArray path_arr = NULL;
8376 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8377 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8378 for (size_t k = 0; k < path_var.datalen; k++) {
8379 LDKRouteHop path_conv_10_var = path_var.data[k];
8380 uint32_t path_conv_10_ref = 0;
8381 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8382 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8383 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8384 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8385 if (path_conv_10_var.is_owned) {
8386 path_conv_10_ref |= 1;
8388 path_arr_ptr[k] = path_conv_10_ref;
8391 FREE(path_var.data);
8392 js_invoke_function_1(j_calls->instance_ptr, 39, (uint32_t)path_arr);
8394 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8395 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8396 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 40);
8397 LDKCVec_u8Z ret_ref;
8398 ret_ref.datalen = ret->arr_len;
8399 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8400 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8403 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8404 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8405 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8407 static inline LDKScore LDKScore_init (JSValue o) {
8408 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8409 atomic_init(&calls->refcnt, 1);
8410 calls->instance_ptr = o;
8413 .this_arg = (void*) calls,
8414 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8415 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8416 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8417 .write = write_LDKScore_jcall,
8418 .free = LDKScore_JCalls_free,
8422 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8423 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8424 *res_ptr = LDKScore_init(o);
8425 return (long)res_ptr;
8427 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) {
8428 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8429 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8430 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8431 LDKNodeId source_conv;
8432 source_conv.inner = (void*)(source & (~1));
8433 source_conv.is_owned = false;
8434 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8435 LDKNodeId target_conv;
8436 target_conv.inner = (void*)(target & (~1));
8437 target_conv.is_owned = false;
8438 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8439 LDKChannelUsage usage_conv;
8440 usage_conv.inner = (void*)(usage & (~1));
8441 usage_conv.is_owned = (usage & 1) || (usage == 0);
8442 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8443 usage_conv = ChannelUsage_clone(&usage_conv);
8444 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8448 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) {
8449 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8450 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8451 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8452 LDKCVec_RouteHopZ path_constr;
8453 path_constr.datalen = path->arr_len;
8454 if (path_constr.datalen > 0)
8455 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8457 path_constr.data = NULL;
8458 uint32_t* path_vals = path->elems /* XXX path leaks */;
8459 for (size_t k = 0; k < path_constr.datalen; k++) {
8460 uint32_t path_conv_10 = path_vals[k];
8461 LDKRouteHop path_conv_10_conv;
8462 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8463 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8464 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8465 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8466 path_constr.data[k] = path_conv_10_conv;
8468 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8471 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8472 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8473 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8474 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8475 LDKCVec_RouteHopZ path_constr;
8476 path_constr.datalen = path->arr_len;
8477 if (path_constr.datalen > 0)
8478 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8480 path_constr.data = NULL;
8481 uint32_t* path_vals = path->elems /* XXX path leaks */;
8482 for (size_t k = 0; k < path_constr.datalen; k++) {
8483 uint32_t path_conv_10 = path_vals[k];
8484 LDKRouteHop path_conv_10_conv;
8485 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8486 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8487 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8488 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8489 path_constr.data[k] = path_conv_10_conv;
8491 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8494 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8495 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8496 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8497 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8498 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8499 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8500 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8501 CVec_u8Z_free(ret_var);
8505 typedef struct LDKPersister_JCalls {
8506 atomic_size_t refcnt;
8507 uint32_t instance_ptr;
8508 } LDKPersister_JCalls;
8509 static void LDKPersister_JCalls_free(void* this_arg) {
8510 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8511 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8515 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8516 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8517 LDKChannelManager channel_manager_var = *channel_manager;
8518 uint32_t channel_manager_ref = 0;
8519 // WARNING: we may need a move here but no clone is available for LDKChannelManager
8520 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8521 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8522 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8523 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
8524 if (channel_manager_var.is_owned) {
8525 channel_manager_ref |= 1;
8527 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 41, (uint32_t)channel_manager_ref);
8528 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8529 CHECK_ACCESS(ret_ptr);
8530 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8534 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8535 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8536 LDKNetworkGraph network_graph_var = *network_graph;
8537 uint32_t network_graph_ref = 0;
8538 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8539 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8540 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8541 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8542 network_graph_ref = (uintptr_t)network_graph_var.inner;
8543 if (network_graph_var.is_owned) {
8544 network_graph_ref |= 1;
8546 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 42, (uint32_t)network_graph_ref);
8547 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8548 CHECK_ACCESS(ret_ptr);
8549 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8553 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
8554 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8555 LDKMultiThreadedLockableScore scorer_var = *scorer;
8556 uint32_t scorer_ref = 0;
8557 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
8558 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8559 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8560 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
8561 scorer_ref = (uintptr_t)scorer_var.inner;
8562 if (scorer_var.is_owned) {
8565 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 43, (uint32_t)scorer_ref);
8566 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8567 CHECK_ACCESS(ret_ptr);
8568 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8572 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8573 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8574 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8576 static inline LDKPersister LDKPersister_init (JSValue o) {
8577 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8578 atomic_init(&calls->refcnt, 1);
8579 calls->instance_ptr = o;
8581 LDKPersister ret = {
8582 .this_arg = (void*) calls,
8583 .persist_manager = persist_manager_LDKPersister_jcall,
8584 .persist_graph = persist_graph_LDKPersister_jcall,
8585 .persist_scorer = persist_scorer_LDKPersister_jcall,
8586 .free = LDKPersister_JCalls_free,
8590 long __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8591 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8592 *res_ptr = LDKPersister_init(o);
8593 return (long)res_ptr;
8595 uint32_t __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
8596 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8597 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8598 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8599 LDKChannelManager channel_manager_conv;
8600 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8601 channel_manager_conv.is_owned = false;
8602 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8603 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8604 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8605 return (uint32_t)ret_conv;
8608 uint32_t __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint32_t this_arg, uint32_t network_graph) {
8609 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8610 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8611 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8612 LDKNetworkGraph network_graph_conv;
8613 network_graph_conv.inner = (void*)(network_graph & (~1));
8614 network_graph_conv.is_owned = false;
8615 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8616 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8617 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8618 return (uint32_t)ret_conv;
8621 uint32_t __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint32_t this_arg, uint32_t scorer) {
8622 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8623 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8624 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8625 LDKMultiThreadedLockableScore scorer_conv;
8626 scorer_conv.inner = (void*)(scorer & (~1));
8627 scorer_conv.is_owned = false;
8628 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
8629 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8630 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
8631 return (uint32_t)ret_conv;
8634 typedef struct LDKListen_JCalls {
8635 atomic_size_t refcnt;
8636 uint32_t instance_ptr;
8638 static void LDKListen_JCalls_free(void* this_arg) {
8639 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8640 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8644 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8645 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8646 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8647 memcpy(header_arr->elems, *header, 80);
8648 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8649 uint32_tArray txdata_arr = NULL;
8650 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8651 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8652 for (size_t c = 0; c < txdata_var.datalen; c++) {
8653 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8654 *txdata_conv_28_conv = txdata_var.data[c];
8655 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8658 FREE(txdata_var.data);
8659 int32_t height_conv = height;
8660 js_invoke_function_3(j_calls->instance_ptr, 44, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8662 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8663 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8664 LDKu8slice block_var = block;
8665 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8666 memcpy(block_arr->elems, block_var.data, block_var.datalen);
8667 int32_t height_conv = height;
8668 js_invoke_function_2(j_calls->instance_ptr, 45, (uint32_t)block_arr, (uint32_t)height_conv);
8670 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8671 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8672 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8673 memcpy(header_arr->elems, *header, 80);
8674 int32_t height_conv = height;
8675 js_invoke_function_2(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)height_conv);
8677 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8678 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8679 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8681 static inline LDKListen LDKListen_init (JSValue o) {
8682 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8683 atomic_init(&calls->refcnt, 1);
8684 calls->instance_ptr = o;
8687 .this_arg = (void*) calls,
8688 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8689 .block_connected = block_connected_LDKListen_jcall,
8690 .block_disconnected = block_disconnected_LDKListen_jcall,
8691 .free = LDKListen_JCalls_free,
8695 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8696 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8697 *res_ptr = LDKListen_init(o);
8698 return (long)res_ptr;
8700 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) {
8701 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8702 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8703 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8704 unsigned char header_arr[80];
8705 CHECK(header->arr_len == 80);
8706 memcpy(header_arr, header->elems, 80); FREE(header);
8707 unsigned char (*header_ref)[80] = &header_arr;
8708 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8709 txdata_constr.datalen = txdata->arr_len;
8710 if (txdata_constr.datalen > 0)
8711 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8713 txdata_constr.data = NULL;
8714 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
8715 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8716 uint32_t txdata_conv_28 = txdata_vals[c];
8717 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8718 CHECK_ACCESS(txdata_conv_28_ptr);
8719 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8720 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8721 txdata_constr.data[c] = txdata_conv_28_conv;
8723 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8726 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
8727 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8728 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8729 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8730 LDKu8slice block_ref;
8731 block_ref.datalen = block->arr_len;
8732 block_ref.data = block->elems /* XXX block leaks */;
8733 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8736 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
8737 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8738 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8739 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8740 unsigned char header_arr[80];
8741 CHECK(header->arr_len == 80);
8742 memcpy(header_arr, header->elems, 80); FREE(header);
8743 unsigned char (*header_ref)[80] = &header_arr;
8744 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8747 typedef struct LDKConfirm_JCalls {
8748 atomic_size_t refcnt;
8749 uint32_t instance_ptr;
8750 } LDKConfirm_JCalls;
8751 static void LDKConfirm_JCalls_free(void* this_arg) {
8752 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8753 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8757 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8758 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8759 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8760 memcpy(header_arr->elems, *header, 80);
8761 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8762 uint32_tArray txdata_arr = NULL;
8763 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8764 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8765 for (size_t c = 0; c < txdata_var.datalen; c++) {
8766 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8767 *txdata_conv_28_conv = txdata_var.data[c];
8768 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8771 FREE(txdata_var.data);
8772 int32_t height_conv = height;
8773 js_invoke_function_3(j_calls->instance_ptr, 47, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8775 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8776 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8777 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8778 memcpy(txid_arr->elems, *txid, 32);
8779 js_invoke_function_1(j_calls->instance_ptr, 48, (uint32_t)txid_arr);
8781 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8782 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8783 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8784 memcpy(header_arr->elems, *header, 80);
8785 int32_t height_conv = height;
8786 js_invoke_function_2(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)height_conv);
8788 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8789 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8790 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->instance_ptr, 50);
8791 LDKCVec_TxidZ ret_constr;
8792 ret_constr.datalen = ret->arr_len;
8793 if (ret_constr.datalen > 0)
8794 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8796 ret_constr.data = NULL;
8797 int8_tArray* ret_vals = (void*) ret->elems /* XXX ret leaks */;
8798 for (size_t m = 0; m < ret_constr.datalen; m++) {
8799 int8_tArray ret_conv_12 = ret_vals[m];
8800 LDKThirtyTwoBytes ret_conv_12_ref;
8801 CHECK(ret_conv_12->arr_len == 32);
8802 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8803 ret_constr.data[m] = ret_conv_12_ref;
8807 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8808 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8809 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8811 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8812 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8813 atomic_init(&calls->refcnt, 1);
8814 calls->instance_ptr = o;
8817 .this_arg = (void*) calls,
8818 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8819 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8820 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8821 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8822 .free = LDKConfirm_JCalls_free,
8826 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8827 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8828 *res_ptr = LDKConfirm_init(o);
8829 return (long)res_ptr;
8831 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) {
8832 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8833 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8834 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8835 unsigned char header_arr[80];
8836 CHECK(header->arr_len == 80);
8837 memcpy(header_arr, header->elems, 80); FREE(header);
8838 unsigned char (*header_ref)[80] = &header_arr;
8839 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8840 txdata_constr.datalen = txdata->arr_len;
8841 if (txdata_constr.datalen > 0)
8842 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8844 txdata_constr.data = NULL;
8845 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
8846 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8847 uint32_t txdata_conv_28 = txdata_vals[c];
8848 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8849 CHECK_ACCESS(txdata_conv_28_ptr);
8850 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8851 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8852 txdata_constr.data[c] = txdata_conv_28_conv;
8854 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8857 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
8858 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8859 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8860 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8861 unsigned char txid_arr[32];
8862 CHECK(txid->arr_len == 32);
8863 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8864 unsigned char (*txid_ref)[32] = &txid_arr;
8865 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8868 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
8869 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8870 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8871 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8872 unsigned char header_arr[80];
8873 CHECK(header->arr_len == 80);
8874 memcpy(header_arr, header->elems, 80); FREE(header);
8875 unsigned char (*header_ref)[80] = &header_arr;
8876 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8879 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(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 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8883 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8884 ptrArray ret_arr = NULL;
8885 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8886 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
8887 for (size_t m = 0; m < ret_var.datalen; m++) {
8888 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8889 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8890 ret_arr_ptr[m] = ret_conv_12_arr;
8897 typedef struct LDKPersist_JCalls {
8898 atomic_size_t refcnt;
8899 uint32_t instance_ptr;
8900 } LDKPersist_JCalls;
8901 static void LDKPersist_JCalls_free(void* this_arg) {
8902 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8903 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8907 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8908 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8909 LDKOutPoint channel_id_var = channel_id;
8910 uint32_t channel_id_ref = 0;
8911 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8912 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8913 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8914 channel_id_ref = (uintptr_t)channel_id_var.inner;
8915 if (channel_id_var.is_owned) {
8916 channel_id_ref |= 1;
8918 LDKChannelMonitor data_var = *data;
8919 uint32_t data_ref = 0;
8920 data_var = ChannelMonitor_clone(&data_var);
8921 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8922 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8923 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8924 data_ref = (uintptr_t)data_var.inner;
8925 if (data_var.is_owned) {
8928 LDKMonitorUpdateId update_id_var = update_id;
8929 uint32_t update_id_ref = 0;
8930 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8931 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8932 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8933 update_id_ref = (uintptr_t)update_id_var.inner;
8934 if (update_id_var.is_owned) {
8937 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 51, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8938 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8939 CHECK_ACCESS(ret_ptr);
8940 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8944 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8945 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8946 LDKOutPoint channel_id_var = channel_id;
8947 uint32_t channel_id_ref = 0;
8948 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8949 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8950 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8951 channel_id_ref = (uintptr_t)channel_id_var.inner;
8952 if (channel_id_var.is_owned) {
8953 channel_id_ref |= 1;
8955 LDKChannelMonitorUpdate update_var = *update;
8956 uint32_t update_ref = 0;
8957 if ((uintptr_t)update_var.inner > 4096) {
8958 update_var = ChannelMonitorUpdate_clone(&update_var);
8959 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8960 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8961 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8962 update_ref = (uintptr_t)update_var.inner;
8963 if (update_var.is_owned) {
8967 LDKChannelMonitor data_var = *data;
8968 uint32_t data_ref = 0;
8969 data_var = ChannelMonitor_clone(&data_var);
8970 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8971 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8972 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8973 data_ref = (uintptr_t)data_var.inner;
8974 if (data_var.is_owned) {
8977 LDKMonitorUpdateId update_id_var = update_id;
8978 uint32_t update_id_ref = 0;
8979 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8980 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8981 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8982 update_id_ref = (uintptr_t)update_id_var.inner;
8983 if (update_id_var.is_owned) {
8986 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 52, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8987 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8988 CHECK_ACCESS(ret_ptr);
8989 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8993 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8994 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8995 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8997 static inline LDKPersist LDKPersist_init (JSValue o) {
8998 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8999 atomic_init(&calls->refcnt, 1);
9000 calls->instance_ptr = o;
9003 .this_arg = (void*) calls,
9004 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9005 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9006 .free = LDKPersist_JCalls_free,
9010 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9011 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9012 *res_ptr = LDKPersist_init(o);
9013 return (long)res_ptr;
9015 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) {
9016 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9017 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9018 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9019 LDKOutPoint channel_id_conv;
9020 channel_id_conv.inner = (void*)(channel_id & (~1));
9021 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9022 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9023 channel_id_conv = OutPoint_clone(&channel_id_conv);
9024 LDKChannelMonitor data_conv;
9025 data_conv.inner = (void*)(data & (~1));
9026 data_conv.is_owned = false;
9027 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9028 LDKMonitorUpdateId update_id_conv;
9029 update_id_conv.inner = (void*)(update_id & (~1));
9030 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9031 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9032 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9033 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9034 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9035 return (uint32_t)ret_conv;
9038 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) {
9039 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9040 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9041 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9042 LDKOutPoint channel_id_conv;
9043 channel_id_conv.inner = (void*)(channel_id & (~1));
9044 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9045 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9046 channel_id_conv = OutPoint_clone(&channel_id_conv);
9047 LDKChannelMonitorUpdate update_conv;
9048 update_conv.inner = (void*)(update & (~1));
9049 update_conv.is_owned = false;
9050 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9051 LDKChannelMonitor data_conv;
9052 data_conv.inner = (void*)(data & (~1));
9053 data_conv.is_owned = false;
9054 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9055 LDKMonitorUpdateId update_id_conv;
9056 update_id_conv.inner = (void*)(update_id & (~1));
9057 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9058 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9059 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9060 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9061 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9062 return (uint32_t)ret_conv;
9065 typedef struct LDKChannelMessageHandler_JCalls {
9066 atomic_size_t refcnt;
9067 uint32_t instance_ptr;
9068 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9069 } LDKChannelMessageHandler_JCalls;
9070 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9071 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9072 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9076 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9077 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9078 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9079 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9080 LDKInitFeatures their_features_var = their_features;
9081 uint32_t their_features_ref = 0;
9082 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9083 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9084 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9085 their_features_ref = (uintptr_t)their_features_var.inner;
9086 if (their_features_var.is_owned) {
9087 their_features_ref |= 1;
9089 LDKOpenChannel msg_var = *msg;
9090 uint32_t msg_ref = 0;
9091 msg_var = OpenChannel_clone(&msg_var);
9092 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9093 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9094 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9095 msg_ref = (uintptr_t)msg_var.inner;
9096 if (msg_var.is_owned) {
9099 js_invoke_function_3(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9101 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9102 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9103 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9104 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9105 LDKInitFeatures their_features_var = their_features;
9106 uint32_t their_features_ref = 0;
9107 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9108 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9109 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9110 their_features_ref = (uintptr_t)their_features_var.inner;
9111 if (their_features_var.is_owned) {
9112 their_features_ref |= 1;
9114 LDKAcceptChannel msg_var = *msg;
9115 uint32_t msg_ref = 0;
9116 msg_var = AcceptChannel_clone(&msg_var);
9117 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9118 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9119 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9120 msg_ref = (uintptr_t)msg_var.inner;
9121 if (msg_var.is_owned) {
9124 js_invoke_function_3(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9126 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9127 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9128 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9129 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9130 LDKFundingCreated msg_var = *msg;
9131 uint32_t msg_ref = 0;
9132 msg_var = FundingCreated_clone(&msg_var);
9133 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9134 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9136 msg_ref = (uintptr_t)msg_var.inner;
9137 if (msg_var.is_owned) {
9140 js_invoke_function_2(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9142 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9143 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9144 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9145 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9146 LDKFundingSigned msg_var = *msg;
9147 uint32_t msg_ref = 0;
9148 msg_var = FundingSigned_clone(&msg_var);
9149 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9150 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9151 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9152 msg_ref = (uintptr_t)msg_var.inner;
9153 if (msg_var.is_owned) {
9156 js_invoke_function_2(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9158 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9159 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9160 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9161 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9162 LDKChannelReady msg_var = *msg;
9163 uint32_t msg_ref = 0;
9164 msg_var = ChannelReady_clone(&msg_var);
9165 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9166 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9167 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9168 msg_ref = (uintptr_t)msg_var.inner;
9169 if (msg_var.is_owned) {
9172 js_invoke_function_2(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9174 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9175 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9176 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9177 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9178 LDKInitFeatures their_features_var = *their_features;
9179 uint32_t their_features_ref = 0;
9180 their_features_var = InitFeatures_clone(&their_features_var);
9181 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9182 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9183 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9184 their_features_ref = (uintptr_t)their_features_var.inner;
9185 if (their_features_var.is_owned) {
9186 their_features_ref |= 1;
9188 LDKShutdown msg_var = *msg;
9189 uint32_t msg_ref = 0;
9190 msg_var = Shutdown_clone(&msg_var);
9191 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9192 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9194 msg_ref = (uintptr_t)msg_var.inner;
9195 if (msg_var.is_owned) {
9198 js_invoke_function_3(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9200 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9201 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9202 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9203 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9204 LDKClosingSigned msg_var = *msg;
9205 uint32_t msg_ref = 0;
9206 msg_var = ClosingSigned_clone(&msg_var);
9207 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9208 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9209 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9210 msg_ref = (uintptr_t)msg_var.inner;
9211 if (msg_var.is_owned) {
9214 js_invoke_function_2(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9216 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9217 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9218 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9219 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9220 LDKUpdateAddHTLC msg_var = *msg;
9221 uint32_t msg_ref = 0;
9222 msg_var = UpdateAddHTLC_clone(&msg_var);
9223 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9224 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9225 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9226 msg_ref = (uintptr_t)msg_var.inner;
9227 if (msg_var.is_owned) {
9230 js_invoke_function_2(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9232 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9233 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9234 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9235 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9236 LDKUpdateFulfillHTLC msg_var = *msg;
9237 uint32_t msg_ref = 0;
9238 msg_var = UpdateFulfillHTLC_clone(&msg_var);
9239 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9240 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9241 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9242 msg_ref = (uintptr_t)msg_var.inner;
9243 if (msg_var.is_owned) {
9246 js_invoke_function_2(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9248 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9249 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9250 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9251 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9252 LDKUpdateFailHTLC msg_var = *msg;
9253 uint32_t msg_ref = 0;
9254 msg_var = UpdateFailHTLC_clone(&msg_var);
9255 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9256 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9257 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9258 msg_ref = (uintptr_t)msg_var.inner;
9259 if (msg_var.is_owned) {
9262 js_invoke_function_2(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9264 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9265 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9266 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9267 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9268 LDKUpdateFailMalformedHTLC msg_var = *msg;
9269 uint32_t msg_ref = 0;
9270 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9271 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9272 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9273 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9274 msg_ref = (uintptr_t)msg_var.inner;
9275 if (msg_var.is_owned) {
9278 js_invoke_function_2(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9280 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9281 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9282 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9283 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9284 LDKCommitmentSigned msg_var = *msg;
9285 uint32_t msg_ref = 0;
9286 msg_var = CommitmentSigned_clone(&msg_var);
9287 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9288 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9289 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9290 msg_ref = (uintptr_t)msg_var.inner;
9291 if (msg_var.is_owned) {
9294 js_invoke_function_2(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9296 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9297 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9298 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9299 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9300 LDKRevokeAndACK msg_var = *msg;
9301 uint32_t msg_ref = 0;
9302 msg_var = RevokeAndACK_clone(&msg_var);
9303 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9304 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9305 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9306 msg_ref = (uintptr_t)msg_var.inner;
9307 if (msg_var.is_owned) {
9310 js_invoke_function_2(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9312 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9313 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9314 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9315 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9316 LDKUpdateFee msg_var = *msg;
9317 uint32_t msg_ref = 0;
9318 msg_var = UpdateFee_clone(&msg_var);
9319 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9320 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9321 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9322 msg_ref = (uintptr_t)msg_var.inner;
9323 if (msg_var.is_owned) {
9326 js_invoke_function_2(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9328 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9329 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9330 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9331 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9332 LDKAnnouncementSignatures msg_var = *msg;
9333 uint32_t msg_ref = 0;
9334 msg_var = AnnouncementSignatures_clone(&msg_var);
9335 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9336 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9337 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9338 msg_ref = (uintptr_t)msg_var.inner;
9339 if (msg_var.is_owned) {
9342 js_invoke_function_2(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9344 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9345 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9346 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9347 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9348 jboolean no_connection_possible_conv = no_connection_possible;
9349 js_invoke_function_2(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible_conv);
9351 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9352 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9353 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9354 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9355 LDKInit msg_var = *msg;
9356 uint32_t msg_ref = 0;
9357 msg_var = Init_clone(&msg_var);
9358 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9359 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9360 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9361 msg_ref = (uintptr_t)msg_var.inner;
9362 if (msg_var.is_owned) {
9365 js_invoke_function_2(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9367 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9368 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9369 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9370 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9371 LDKChannelReestablish msg_var = *msg;
9372 uint32_t msg_ref = 0;
9373 msg_var = ChannelReestablish_clone(&msg_var);
9374 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9375 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9376 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9377 msg_ref = (uintptr_t)msg_var.inner;
9378 if (msg_var.is_owned) {
9381 js_invoke_function_2(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9383 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9384 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9385 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9386 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9387 LDKChannelUpdate msg_var = *msg;
9388 uint32_t msg_ref = 0;
9389 msg_var = ChannelUpdate_clone(&msg_var);
9390 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9391 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9392 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9393 msg_ref = (uintptr_t)msg_var.inner;
9394 if (msg_var.is_owned) {
9397 js_invoke_function_2(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9399 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9400 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9401 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9402 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9403 LDKErrorMessage msg_var = *msg;
9404 uint32_t msg_ref = 0;
9405 msg_var = ErrorMessage_clone(&msg_var);
9406 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9407 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9408 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9409 msg_ref = (uintptr_t)msg_var.inner;
9410 if (msg_var.is_owned) {
9413 js_invoke_function_2(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9415 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9416 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9417 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9418 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9420 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9421 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9422 atomic_init(&calls->refcnt, 1);
9423 calls->instance_ptr = o;
9425 LDKChannelMessageHandler ret = {
9426 .this_arg = (void*) calls,
9427 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9428 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9429 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9430 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9431 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9432 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9433 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9434 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9435 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9436 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9437 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9438 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9439 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9440 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9441 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9442 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9443 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9444 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9445 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9446 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9447 .free = LDKChannelMessageHandler_JCalls_free,
9448 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9450 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9453 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9454 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9455 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9456 return (long)res_ptr;
9458 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) {
9459 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9460 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9461 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9462 LDKPublicKey their_node_id_ref;
9463 CHECK(their_node_id->arr_len == 33);
9464 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9465 LDKInitFeatures their_features_conv;
9466 their_features_conv.inner = (void*)(their_features & (~1));
9467 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9468 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9469 their_features_conv = InitFeatures_clone(&their_features_conv);
9470 LDKOpenChannel msg_conv;
9471 msg_conv.inner = (void*)(msg & (~1));
9472 msg_conv.is_owned = false;
9473 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9474 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9477 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) {
9478 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9479 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9480 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9481 LDKPublicKey their_node_id_ref;
9482 CHECK(their_node_id->arr_len == 33);
9483 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9484 LDKInitFeatures their_features_conv;
9485 their_features_conv.inner = (void*)(their_features & (~1));
9486 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9487 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9488 their_features_conv = InitFeatures_clone(&their_features_conv);
9489 LDKAcceptChannel msg_conv;
9490 msg_conv.inner = (void*)(msg & (~1));
9491 msg_conv.is_owned = false;
9492 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9493 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9496 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) {
9497 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9498 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9500 LDKPublicKey their_node_id_ref;
9501 CHECK(their_node_id->arr_len == 33);
9502 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9503 LDKFundingCreated msg_conv;
9504 msg_conv.inner = (void*)(msg & (~1));
9505 msg_conv.is_owned = false;
9506 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9507 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9510 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) {
9511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9513 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9514 LDKPublicKey their_node_id_ref;
9515 CHECK(their_node_id->arr_len == 33);
9516 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9517 LDKFundingSigned msg_conv;
9518 msg_conv.inner = (void*)(msg & (~1));
9519 msg_conv.is_owned = false;
9520 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9521 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9524 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) {
9525 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9526 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9528 LDKPublicKey their_node_id_ref;
9529 CHECK(their_node_id->arr_len == 33);
9530 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9531 LDKChannelReady msg_conv;
9532 msg_conv.inner = (void*)(msg & (~1));
9533 msg_conv.is_owned = false;
9534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9535 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9538 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) {
9539 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9542 LDKPublicKey their_node_id_ref;
9543 CHECK(their_node_id->arr_len == 33);
9544 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9545 LDKInitFeatures their_features_conv;
9546 their_features_conv.inner = (void*)(their_features & (~1));
9547 their_features_conv.is_owned = false;
9548 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9549 LDKShutdown msg_conv;
9550 msg_conv.inner = (void*)(msg & (~1));
9551 msg_conv.is_owned = false;
9552 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9553 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9556 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) {
9557 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9558 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9559 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9560 LDKPublicKey their_node_id_ref;
9561 CHECK(their_node_id->arr_len == 33);
9562 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9563 LDKClosingSigned msg_conv;
9564 msg_conv.inner = (void*)(msg & (~1));
9565 msg_conv.is_owned = false;
9566 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9567 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9570 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) {
9571 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9572 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9573 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9574 LDKPublicKey their_node_id_ref;
9575 CHECK(their_node_id->arr_len == 33);
9576 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9577 LDKUpdateAddHTLC msg_conv;
9578 msg_conv.inner = (void*)(msg & (~1));
9579 msg_conv.is_owned = false;
9580 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9581 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9584 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) {
9585 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9586 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9587 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9588 LDKPublicKey their_node_id_ref;
9589 CHECK(their_node_id->arr_len == 33);
9590 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9591 LDKUpdateFulfillHTLC msg_conv;
9592 msg_conv.inner = (void*)(msg & (~1));
9593 msg_conv.is_owned = false;
9594 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9595 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9598 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) {
9599 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9600 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9601 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9602 LDKPublicKey their_node_id_ref;
9603 CHECK(their_node_id->arr_len == 33);
9604 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9605 LDKUpdateFailHTLC msg_conv;
9606 msg_conv.inner = (void*)(msg & (~1));
9607 msg_conv.is_owned = false;
9608 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9609 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9612 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) {
9613 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9615 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9616 LDKPublicKey their_node_id_ref;
9617 CHECK(their_node_id->arr_len == 33);
9618 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9619 LDKUpdateFailMalformedHTLC msg_conv;
9620 msg_conv.inner = (void*)(msg & (~1));
9621 msg_conv.is_owned = false;
9622 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9623 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9626 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) {
9627 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9628 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9630 LDKPublicKey their_node_id_ref;
9631 CHECK(their_node_id->arr_len == 33);
9632 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9633 LDKCommitmentSigned msg_conv;
9634 msg_conv.inner = (void*)(msg & (~1));
9635 msg_conv.is_owned = false;
9636 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9637 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9640 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) {
9641 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9642 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9643 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9644 LDKPublicKey their_node_id_ref;
9645 CHECK(their_node_id->arr_len == 33);
9646 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9647 LDKRevokeAndACK msg_conv;
9648 msg_conv.inner = (void*)(msg & (~1));
9649 msg_conv.is_owned = false;
9650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9651 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9654 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) {
9655 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9656 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9657 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9658 LDKPublicKey their_node_id_ref;
9659 CHECK(their_node_id->arr_len == 33);
9660 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9661 LDKUpdateFee msg_conv;
9662 msg_conv.inner = (void*)(msg & (~1));
9663 msg_conv.is_owned = false;
9664 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9665 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9668 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) {
9669 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9670 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9671 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9672 LDKPublicKey their_node_id_ref;
9673 CHECK(their_node_id->arr_len == 33);
9674 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9675 LDKAnnouncementSignatures msg_conv;
9676 msg_conv.inner = (void*)(msg & (~1));
9677 msg_conv.is_owned = false;
9678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9679 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9682 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) {
9683 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9684 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9685 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9686 LDKPublicKey their_node_id_ref;
9687 CHECK(their_node_id->arr_len == 33);
9688 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9689 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9692 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9693 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9694 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9695 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9696 LDKPublicKey their_node_id_ref;
9697 CHECK(their_node_id->arr_len == 33);
9698 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9700 msg_conv.inner = (void*)(msg & (~1));
9701 msg_conv.is_owned = false;
9702 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9703 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9706 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) {
9707 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9708 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9709 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9710 LDKPublicKey their_node_id_ref;
9711 CHECK(their_node_id->arr_len == 33);
9712 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9713 LDKChannelReestablish msg_conv;
9714 msg_conv.inner = (void*)(msg & (~1));
9715 msg_conv.is_owned = false;
9716 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9717 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9720 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) {
9721 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9722 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9723 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9724 LDKPublicKey their_node_id_ref;
9725 CHECK(their_node_id->arr_len == 33);
9726 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9727 LDKChannelUpdate msg_conv;
9728 msg_conv.inner = (void*)(msg & (~1));
9729 msg_conv.is_owned = false;
9730 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9731 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9734 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9735 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9736 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9737 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9738 LDKPublicKey their_node_id_ref;
9739 CHECK(their_node_id->arr_len == 33);
9740 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9741 LDKErrorMessage msg_conv;
9742 msg_conv.inner = (void*)(msg & (~1));
9743 msg_conv.is_owned = false;
9744 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9745 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9748 typedef struct LDKRoutingMessageHandler_JCalls {
9749 atomic_size_t refcnt;
9750 uint32_t instance_ptr;
9751 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9752 } LDKRoutingMessageHandler_JCalls;
9753 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9754 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9755 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9759 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9760 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9761 LDKNodeAnnouncement msg_var = *msg;
9762 uint32_t msg_ref = 0;
9763 msg_var = NodeAnnouncement_clone(&msg_var);
9764 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9765 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9766 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9767 msg_ref = (uintptr_t)msg_var.inner;
9768 if (msg_var.is_owned) {
9771 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 73, (uint32_t)msg_ref);
9772 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9773 CHECK_ACCESS(ret_ptr);
9774 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9778 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9779 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9780 LDKChannelAnnouncement msg_var = *msg;
9781 uint32_t msg_ref = 0;
9782 msg_var = ChannelAnnouncement_clone(&msg_var);
9783 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9784 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9785 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9786 msg_ref = (uintptr_t)msg_var.inner;
9787 if (msg_var.is_owned) {
9790 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 74, (uint32_t)msg_ref);
9791 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9792 CHECK_ACCESS(ret_ptr);
9793 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9797 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9798 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9799 LDKChannelUpdate msg_var = *msg;
9800 uint32_t msg_ref = 0;
9801 msg_var = ChannelUpdate_clone(&msg_var);
9802 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9803 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9804 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9805 msg_ref = (uintptr_t)msg_var.inner;
9806 if (msg_var.is_owned) {
9809 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 75, (uint32_t)msg_ref);
9810 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9811 CHECK_ACCESS(ret_ptr);
9812 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9816 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9817 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9818 int64_t starting_point_conv = starting_point;
9819 int8_t batch_amount_conv = batch_amount;
9820 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 76, (uint32_t)starting_point_conv, (uint32_t)batch_amount_conv);
9821 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9822 ret_constr.datalen = ret->arr_len;
9823 if (ret_constr.datalen > 0)
9824 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9826 ret_constr.data = NULL;
9827 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9828 for (size_t h = 0; h < ret_constr.datalen; h++) {
9829 uint32_t ret_conv_59 = ret_vals[h];
9830 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
9831 CHECK_ACCESS(ret_conv_59_ptr);
9832 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9833 FREE((void*)ret_conv_59);
9834 ret_constr.data[h] = ret_conv_59_conv;
9838 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9839 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9840 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9841 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9842 int8_t batch_amount_conv = batch_amount;
9843 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 77, (uint32_t)starting_point_arr, (uint32_t)batch_amount_conv);
9844 LDKCVec_NodeAnnouncementZ ret_constr;
9845 ret_constr.datalen = ret->arr_len;
9846 if (ret_constr.datalen > 0)
9847 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9849 ret_constr.data = NULL;
9850 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9851 for (size_t s = 0; s < ret_constr.datalen; s++) {
9852 uint32_t ret_conv_18 = ret_vals[s];
9853 LDKNodeAnnouncement ret_conv_18_conv;
9854 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9855 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9857 ret_constr.data[s] = ret_conv_18_conv;
9861 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9862 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9863 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9864 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9865 LDKInit init_var = *init;
9866 uint32_t init_ref = 0;
9867 init_var = Init_clone(&init_var);
9868 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9869 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9870 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9871 init_ref = (uintptr_t)init_var.inner;
9872 if (init_var.is_owned) {
9875 js_invoke_function_2(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
9877 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9878 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9879 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9880 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9881 LDKReplyChannelRange msg_var = msg;
9882 uint32_t msg_ref = 0;
9883 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9884 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9885 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9886 msg_ref = (uintptr_t)msg_var.inner;
9887 if (msg_var.is_owned) {
9890 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9891 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9892 CHECK_ACCESS(ret_ptr);
9893 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9897 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9898 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9899 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9900 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9901 LDKReplyShortChannelIdsEnd msg_var = msg;
9902 uint32_t msg_ref = 0;
9903 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9904 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9905 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9906 msg_ref = (uintptr_t)msg_var.inner;
9907 if (msg_var.is_owned) {
9910 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9911 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9912 CHECK_ACCESS(ret_ptr);
9913 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9917 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9918 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9919 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9920 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9921 LDKQueryChannelRange msg_var = msg;
9922 uint32_t msg_ref = 0;
9923 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9924 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9925 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9926 msg_ref = (uintptr_t)msg_var.inner;
9927 if (msg_var.is_owned) {
9930 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9931 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9932 CHECK_ACCESS(ret_ptr);
9933 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9937 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9938 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9939 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9940 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9941 LDKQueryShortChannelIds msg_var = msg;
9942 uint32_t msg_ref = 0;
9943 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9944 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9945 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9946 msg_ref = (uintptr_t)msg_var.inner;
9947 if (msg_var.is_owned) {
9950 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9951 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9952 CHECK_ACCESS(ret_ptr);
9953 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9957 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9958 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9959 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9960 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9962 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9963 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9964 atomic_init(&calls->refcnt, 1);
9965 calls->instance_ptr = o;
9967 LDKRoutingMessageHandler ret = {
9968 .this_arg = (void*) calls,
9969 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9970 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9971 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9972 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9973 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9974 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9975 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9976 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9977 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9978 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9979 .free = LDKRoutingMessageHandler_JCalls_free,
9980 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9982 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9985 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9986 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9987 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9988 return (long)res_ptr;
9990 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
9991 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9992 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9993 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9994 LDKNodeAnnouncement 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 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9999 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10000 return (uint32_t)ret_conv;
10003 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
10004 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10005 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10006 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10007 LDKChannelAnnouncement msg_conv;
10008 msg_conv.inner = (void*)(msg & (~1));
10009 msg_conv.is_owned = false;
10010 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10011 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10012 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10013 return (uint32_t)ret_conv;
10016 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
10017 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10018 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10019 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10020 LDKChannelUpdate msg_conv;
10021 msg_conv.inner = (void*)(msg & (~1));
10022 msg_conv.is_owned = false;
10023 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10024 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10025 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10026 return (uint32_t)ret_conv;
10029 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) {
10030 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10032 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10033 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
10034 uint32_tArray ret_arr = NULL;
10035 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10036 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10037 for (size_t h = 0; h < ret_var.datalen; h++) {
10038 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10039 *ret_conv_59_conv = ret_var.data[h];
10040 ret_arr_ptr[h] = ((uint32_t)ret_conv_59_conv);
10043 FREE(ret_var.data);
10047 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) {
10048 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10049 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10050 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10051 LDKPublicKey starting_point_ref;
10052 CHECK(starting_point->arr_len == 33);
10053 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10054 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
10055 uint32_tArray ret_arr = NULL;
10056 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10057 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10058 for (size_t s = 0; s < ret_var.datalen; s++) {
10059 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
10060 uint32_t ret_conv_18_ref = 0;
10061 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10062 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
10064 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
10065 if (ret_conv_18_var.is_owned) {
10066 ret_conv_18_ref |= 1;
10068 ret_arr_ptr[s] = ret_conv_18_ref;
10071 FREE(ret_var.data);
10075 void __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
10076 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10077 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10078 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10079 LDKPublicKey their_node_id_ref;
10080 CHECK(their_node_id->arr_len == 33);
10081 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10083 init_conv.inner = (void*)(init & (~1));
10084 init_conv.is_owned = false;
10085 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10086 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10089 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) {
10090 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10091 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10092 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10093 LDKPublicKey their_node_id_ref;
10094 CHECK(their_node_id->arr_len == 33);
10095 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10096 LDKReplyChannelRange msg_conv;
10097 msg_conv.inner = (void*)(msg & (~1));
10098 msg_conv.is_owned = (msg & 1) || (msg == 0);
10099 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10100 msg_conv = ReplyChannelRange_clone(&msg_conv);
10101 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10102 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10103 return (uint32_t)ret_conv;
10106 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) {
10107 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10108 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10109 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10110 LDKPublicKey their_node_id_ref;
10111 CHECK(their_node_id->arr_len == 33);
10112 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10113 LDKReplyShortChannelIdsEnd msg_conv;
10114 msg_conv.inner = (void*)(msg & (~1));
10115 msg_conv.is_owned = (msg & 1) || (msg == 0);
10116 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10117 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10118 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10119 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10120 return (uint32_t)ret_conv;
10123 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) {
10124 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10125 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10126 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)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 LDKQueryChannelRange msg_conv;
10131 msg_conv.inner = (void*)(msg & (~1));
10132 msg_conv.is_owned = (msg & 1) || (msg == 0);
10133 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10134 msg_conv = QueryChannelRange_clone(&msg_conv);
10135 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10136 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10137 return (uint32_t)ret_conv;
10140 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) {
10141 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10142 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10143 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10144 LDKPublicKey their_node_id_ref;
10145 CHECK(their_node_id->arr_len == 33);
10146 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10147 LDKQueryShortChannelIds msg_conv;
10148 msg_conv.inner = (void*)(msg & (~1));
10149 msg_conv.is_owned = (msg & 1) || (msg == 0);
10150 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10151 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10152 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10153 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10154 return (uint32_t)ret_conv;
10157 typedef struct LDKCustomMessageReader_JCalls {
10158 atomic_size_t refcnt;
10159 uint32_t instance_ptr;
10160 } LDKCustomMessageReader_JCalls;
10161 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10162 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10163 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10167 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10168 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10169 int16_t message_type_conv = message_type;
10170 LDKu8slice buffer_var = buffer;
10171 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10172 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10173 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 83, (uint32_t)message_type_conv, (uint32_t)buffer_arr);
10174 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10175 CHECK_ACCESS(ret_ptr);
10176 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10180 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10181 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10182 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10184 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10185 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10186 atomic_init(&calls->refcnt, 1);
10187 calls->instance_ptr = o;
10189 LDKCustomMessageReader ret = {
10190 .this_arg = (void*) calls,
10191 .read = read_LDKCustomMessageReader_jcall,
10192 .free = LDKCustomMessageReader_JCalls_free,
10196 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10197 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10198 *res_ptr = LDKCustomMessageReader_init(o);
10199 return (long)res_ptr;
10201 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
10202 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10203 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10204 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10205 LDKu8slice buffer_ref;
10206 buffer_ref.datalen = buffer->arr_len;
10207 buffer_ref.data = buffer->elems /* XXX buffer leaks */;
10208 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10209 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10210 return (uint32_t)ret_conv;
10213 typedef struct LDKCustomMessageHandler_JCalls {
10214 atomic_size_t refcnt;
10215 uint32_t instance_ptr;
10216 LDKCustomMessageReader_JCalls* CustomMessageReader;
10217 } LDKCustomMessageHandler_JCalls;
10218 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10219 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10220 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10224 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10225 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10226 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10228 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10229 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10230 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 84, (uint32_t)(uint32_t)msg_ret, (uint32_t)sender_node_id_arr);
10231 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10232 CHECK_ACCESS(ret_ptr);
10233 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10237 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10238 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10239 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 85);
10240 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10241 ret_constr.datalen = ret->arr_len;
10242 if (ret_constr.datalen > 0)
10243 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10245 ret_constr.data = NULL;
10246 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
10247 for (size_t z = 0; z < ret_constr.datalen; z++) {
10248 uint32_t ret_conv_25 = ret_vals[z];
10249 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
10250 CHECK_ACCESS(ret_conv_25_ptr);
10251 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10252 FREE((void*)ret_conv_25);
10253 ret_constr.data[z] = ret_conv_25_conv;
10257 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10258 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10259 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10260 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10262 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10263 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10264 atomic_init(&calls->refcnt, 1);
10265 calls->instance_ptr = o;
10267 LDKCustomMessageHandler ret = {
10268 .this_arg = (void*) calls,
10269 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10270 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10271 .free = LDKCustomMessageHandler_JCalls_free,
10272 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10274 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10277 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10278 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10279 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10280 return (long)res_ptr;
10282 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) {
10283 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10285 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10286 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
10287 CHECK_ACCESS(msg_ptr);
10288 LDKType msg_conv = *(LDKType*)(msg_ptr);
10289 if (msg_conv.free == LDKType_JCalls_free) {
10290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10291 LDKType_JCalls_cloned(&msg_conv);
10293 LDKPublicKey sender_node_id_ref;
10294 CHECK(sender_node_id->arr_len == 33);
10295 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10296 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10297 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10298 return (uint32_t)ret_conv;
10301 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
10302 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10303 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10304 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10305 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10306 uint32_tArray ret_arr = NULL;
10307 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10308 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10309 for (size_t z = 0; z < ret_var.datalen; z++) {
10310 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10311 *ret_conv_25_conv = ret_var.data[z];
10312 ret_arr_ptr[z] = ((uint32_t)ret_conv_25_conv);
10315 FREE(ret_var.data);
10319 typedef struct LDKSocketDescriptor_JCalls {
10320 atomic_size_t refcnt;
10321 uint32_t instance_ptr;
10322 } LDKSocketDescriptor_JCalls;
10323 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10324 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10325 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10329 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10330 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10331 LDKu8slice data_var = data;
10332 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10333 memcpy(data_arr->elems, data_var.data, data_var.datalen);
10334 jboolean resume_read_conv = resume_read;
10335 return js_invoke_function_2(j_calls->instance_ptr, 86, (uint32_t)data_arr, (uint32_t)resume_read_conv);
10337 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10338 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10339 js_invoke_function_0(j_calls->instance_ptr, 87);
10341 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10342 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10343 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10344 *other_arg_clone = SocketDescriptor_clone(other_arg);
10345 return js_invoke_function_1(j_calls->instance_ptr, 88, (uint32_t)(uint32_t)other_arg_clone);
10347 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10348 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10349 return js_invoke_function_0(j_calls->instance_ptr, 89);
10351 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10352 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10353 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10355 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10356 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10357 atomic_init(&calls->refcnt, 1);
10358 calls->instance_ptr = o;
10360 LDKSocketDescriptor ret = {
10361 .this_arg = (void*) calls,
10362 .send_data = send_data_LDKSocketDescriptor_jcall,
10363 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10364 .eq = eq_LDKSocketDescriptor_jcall,
10365 .hash = hash_LDKSocketDescriptor_jcall,
10366 .cloned = LDKSocketDescriptor_JCalls_cloned,
10367 .free = LDKSocketDescriptor_JCalls_free,
10371 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10372 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10373 *res_ptr = LDKSocketDescriptor_init(o);
10374 return (long)res_ptr;
10376 uint32_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
10377 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10378 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10379 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10380 LDKu8slice data_ref;
10381 data_ref.datalen = data->arr_len;
10382 data_ref.data = data->elems /* XXX data leaks */;
10383 uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10387 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
10388 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10390 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10391 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10394 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
10395 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10396 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10397 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10398 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10402 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
10403 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10405 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10406 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10407 case LDKEffectiveCapacity_Total: return 2;
10408 case LDKEffectiveCapacity_Infinite: return 3;
10409 case LDKEffectiveCapacity_Unknown: return 4;
10413 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
10414 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10415 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10416 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10417 return liquidity_msat_conv;
10419 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
10420 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10421 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10422 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10423 return amount_msat_conv;
10425 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
10426 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10427 assert(obj->tag == LDKEffectiveCapacity_Total);
10428 int64_t capacity_msat_conv = obj->total.capacity_msat;
10429 return capacity_msat_conv;
10431 typedef struct LDKLockableScore_JCalls {
10432 atomic_size_t refcnt;
10433 uint32_t instance_ptr;
10434 } LDKLockableScore_JCalls;
10435 static void LDKLockableScore_JCalls_free(void* this_arg) {
10436 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10441 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10442 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10443 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 90);
10444 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10445 CHECK_ACCESS(ret_ptr);
10446 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10447 if (ret_conv.free == LDKScore_JCalls_free) {
10448 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10449 LDKScore_JCalls_cloned(&ret_conv);
10450 }// WARNING: we may need a move here but no clone is available for LDKScore
10454 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10455 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10456 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10458 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10459 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10460 atomic_init(&calls->refcnt, 1);
10461 calls->instance_ptr = o;
10463 LDKLockableScore ret = {
10464 .this_arg = (void*) calls,
10465 .lock = lock_LDKLockableScore_jcall,
10466 .free = LDKLockableScore_JCalls_free,
10470 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10471 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10472 *res_ptr = LDKLockableScore_init(o);
10473 return (long)res_ptr;
10475 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
10476 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10477 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10478 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10479 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10480 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10481 return (uint32_t)ret_ret;
10484 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
10485 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10487 case LDKFallback_SegWitProgram: return 0;
10488 case LDKFallback_PubKeyHash: return 1;
10489 case LDKFallback_ScriptHash: return 2;
10493 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
10494 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10495 assert(obj->tag == LDKFallback_SegWitProgram);
10496 uint8_t version_val = obj->seg_wit_program.version._0;
10497 return version_val;
10499 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
10500 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10501 assert(obj->tag == LDKFallback_SegWitProgram);
10502 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10503 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10504 memcpy(program_arr->elems, program_var.data, program_var.datalen);
10505 return program_arr;
10507 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
10508 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10509 assert(obj->tag == LDKFallback_PubKeyHash);
10510 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10511 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10512 return pub_key_hash_arr;
10514 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
10515 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10516 assert(obj->tag == LDKFallback_ScriptHash);
10517 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10518 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10519 return script_hash_arr;
10521 typedef struct LDKPayer_JCalls {
10522 atomic_size_t refcnt;
10523 uint32_t instance_ptr;
10525 static void LDKPayer_JCalls_free(void* this_arg) {
10526 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10527 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10531 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10532 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10533 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 91);
10534 LDKPublicKey ret_ref;
10535 CHECK(ret->arr_len == 33);
10536 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10539 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10540 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10541 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 92);
10542 LDKCVec_ChannelDetailsZ ret_constr;
10543 ret_constr.datalen = ret->arr_len;
10544 if (ret_constr.datalen > 0)
10545 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10547 ret_constr.data = NULL;
10548 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
10549 for (size_t q = 0; q < ret_constr.datalen; q++) {
10550 uint32_t ret_conv_16 = ret_vals[q];
10551 LDKChannelDetails ret_conv_16_conv;
10552 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10553 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10555 ret_constr.data[q] = ret_conv_16_conv;
10559 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10560 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10561 LDKRoute route_var = *route;
10562 uint32_t route_ref = 0;
10563 route_var = Route_clone(&route_var);
10564 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10565 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10566 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10567 route_ref = (uintptr_t)route_var.inner;
10568 if (route_var.is_owned) {
10571 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10572 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10573 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10574 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10575 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 93, (uint32_t)route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr);
10576 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10577 CHECK_ACCESS(ret_ptr);
10578 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10582 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10583 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10584 LDKRoute route_var = *route;
10585 uint32_t route_ref = 0;
10586 route_var = Route_clone(&route_var);
10587 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10588 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10589 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10590 route_ref = (uintptr_t)route_var.inner;
10591 if (route_var.is_owned) {
10594 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10595 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10596 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 94, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10597 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10598 CHECK_ACCESS(ret_ptr);
10599 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10603 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10604 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10605 LDKRoute route_var = *route;
10606 uint32_t route_ref = 0;
10607 route_var = Route_clone(&route_var);
10608 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10609 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10610 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10611 route_ref = (uintptr_t)route_var.inner;
10612 if (route_var.is_owned) {
10615 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10616 memcpy(payment_id_arr->elems, payment_id.data, 32);
10617 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 95, (uint32_t)route_ref, (uint32_t)payment_id_arr);
10618 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10619 CHECK_ACCESS(ret_ptr);
10620 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10624 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10625 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10626 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10627 memcpy(payment_id_arr->elems, payment_id.data, 32);
10628 js_invoke_function_1(j_calls->instance_ptr, 96, (uint32_t)payment_id_arr);
10630 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10631 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10632 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10634 static inline LDKPayer LDKPayer_init (JSValue o) {
10635 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10636 atomic_init(&calls->refcnt, 1);
10637 calls->instance_ptr = o;
10640 .this_arg = (void*) calls,
10641 .node_id = node_id_LDKPayer_jcall,
10642 .first_hops = first_hops_LDKPayer_jcall,
10643 .send_payment = send_payment_LDKPayer_jcall,
10644 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10645 .retry_payment = retry_payment_LDKPayer_jcall,
10646 .abandon_payment = abandon_payment_LDKPayer_jcall,
10647 .free = LDKPayer_JCalls_free,
10651 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10652 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10653 *res_ptr = LDKPayer_init(o);
10654 return (long)res_ptr;
10656 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
10657 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10658 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10659 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10660 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10661 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10665 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
10666 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10667 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10668 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10669 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10670 uint32_tArray ret_arr = NULL;
10671 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10672 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10673 for (size_t q = 0; q < ret_var.datalen; q++) {
10674 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10675 uint32_t ret_conv_16_ref = 0;
10676 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10677 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10679 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
10680 if (ret_conv_16_var.is_owned) {
10681 ret_conv_16_ref |= 1;
10683 ret_arr_ptr[q] = ret_conv_16_ref;
10686 FREE(ret_var.data);
10690 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) {
10691 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10692 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10693 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10694 LDKRoute route_conv;
10695 route_conv.inner = (void*)(route & (~1));
10696 route_conv.is_owned = false;
10697 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10698 LDKThirtyTwoBytes payment_hash_ref;
10699 CHECK(payment_hash->arr_len == 32);
10700 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10701 LDKThirtyTwoBytes payment_secret_ref;
10702 CHECK(payment_secret->arr_len == 32);
10703 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10704 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10705 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10706 return (uint32_t)ret_conv;
10709 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) {
10710 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10711 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10712 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10713 LDKRoute route_conv;
10714 route_conv.inner = (void*)(route & (~1));
10715 route_conv.is_owned = false;
10716 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10717 LDKThirtyTwoBytes payment_preimage_ref;
10718 CHECK(payment_preimage->arr_len == 32);
10719 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10720 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10721 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10722 return (uint32_t)ret_conv;
10725 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
10726 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10727 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10728 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10729 LDKRoute route_conv;
10730 route_conv.inner = (void*)(route & (~1));
10731 route_conv.is_owned = false;
10732 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10733 LDKThirtyTwoBytes payment_id_ref;
10734 CHECK(payment_id->arr_len == 32);
10735 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10736 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10737 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10738 return (uint32_t)ret_conv;
10741 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
10742 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10743 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10744 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10745 LDKThirtyTwoBytes payment_id_ref;
10746 CHECK(payment_id->arr_len == 32);
10747 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10748 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10751 typedef struct LDKRouter_JCalls {
10752 atomic_size_t refcnt;
10753 uint32_t instance_ptr;
10754 } LDKRouter_JCalls;
10755 static void LDKRouter_JCalls_free(void* this_arg) {
10756 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10757 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10761 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) {
10762 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10763 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10764 memcpy(payer_arr->elems, payer.compressed_form, 33);
10765 LDKRouteParameters route_params_var = *route_params;
10766 uint32_t route_params_ref = 0;
10767 route_params_var = RouteParameters_clone(&route_params_var);
10768 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10769 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10770 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10771 route_params_ref = (uintptr_t)route_params_var.inner;
10772 if (route_params_var.is_owned) {
10773 route_params_ref |= 1;
10775 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10776 memcpy(payment_hash_arr->elems, *payment_hash, 32);
10777 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10778 uint32_tArray first_hops_arr = NULL;
10779 if (first_hops != NULL) {
10780 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10781 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
10782 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
10783 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10784 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10785 uint32_t first_hops_conv_16_ref = 0;
10786 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10787 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10788 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10789 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
10790 if (first_hops_conv_16_var.is_owned) {
10791 first_hops_conv_16_ref |= 1;
10793 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10797 // WARNING: This object doesn't live past this scope, needs clone!
10798 uint32_t ret_scorer = ((uintptr_t)scorer) | 1;
10799 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 97, (uint32_t)payer_arr, (uint32_t)route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, (uint32_t)ret_scorer);
10800 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10801 CHECK_ACCESS(ret_ptr);
10802 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10806 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10807 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10808 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10810 static inline LDKRouter LDKRouter_init (JSValue o) {
10811 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10812 atomic_init(&calls->refcnt, 1);
10813 calls->instance_ptr = o;
10816 .this_arg = (void*) calls,
10817 .find_route = find_route_LDKRouter_jcall,
10818 .free = LDKRouter_JCalls_free,
10822 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10823 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10824 *res_ptr = LDKRouter_init(o);
10825 return (long)res_ptr;
10827 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) {
10828 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10829 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10830 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10831 LDKPublicKey payer_ref;
10832 CHECK(payer->arr_len == 33);
10833 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10834 LDKRouteParameters route_params_conv;
10835 route_params_conv.inner = (void*)(route_params & (~1));
10836 route_params_conv.is_owned = false;
10837 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10838 unsigned char payment_hash_arr[32];
10839 CHECK(payment_hash->arr_len == 32);
10840 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10841 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10842 LDKCVec_ChannelDetailsZ first_hops_constr;
10843 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10844 if (first_hops != 0) {
10845 first_hops_constr.datalen = first_hops->arr_len;
10846 if (first_hops_constr.datalen > 0)
10847 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10849 first_hops_constr.data = NULL;
10850 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
10851 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10852 uint32_t first_hops_conv_16 = first_hops_vals[q];
10853 LDKChannelDetails first_hops_conv_16_conv;
10854 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
10855 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
10856 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10857 first_hops_constr.data[q] = first_hops_conv_16_conv;
10859 first_hops_ptr = &first_hops_constr;
10861 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
10862 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
10863 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10864 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10865 *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);
10866 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10867 return (uint32_t)ret_conv;
10870 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint32_t ptr) {
10871 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10873 case LDKRetry_Attempts: return 0;
10877 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint32_t ptr) {
10878 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10879 assert(obj->tag == LDKRetry_Attempts);
10880 uint32_t attempts_conv = obj->attempts;
10881 return attempts_conv;
10883 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10884 LDKStr ret_str = _ldk_get_compiled_version();
10885 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10890 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10891 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10892 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10897 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
10898 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10899 *ret_copy = Bech32Error_clone(arg);
10900 uint32_t ret_ref = (uintptr_t)ret_copy;
10903 uint32_t __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint32_t arg) {
10904 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
10905 uint32_t ret_conv = Bech32Error_clone_ptr(arg_conv);
10909 uint32_t __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint32_t orig) {
10910 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
10911 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10912 *ret_copy = Bech32Error_clone(orig_conv);
10913 uint32_t ret_ref = (uintptr_t)ret_copy;
10917 void __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint32_t o) {
10918 if ((o & 1) != 0) return;
10919 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
10920 CHECK_ACCESS(o_ptr);
10921 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
10923 Bech32Error_free(o_conv);
10926 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10927 LDKTransaction _res_ref;
10928 _res_ref.datalen = _res->arr_len;
10929 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10930 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10931 _res_ref.data_is_owned = true;
10932 Transaction_free(_res_ref);
10935 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10936 LDKCVec_u8Z script_pubkey_ref;
10937 script_pubkey_ref.datalen = script_pubkey->arr_len;
10938 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10939 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10940 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10941 *ret_ref = TxOut_new(script_pubkey_ref, value);
10942 return (uint32_t)ret_ref;
10945 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
10946 if ((_res & 1) != 0) return;
10947 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10948 CHECK_ACCESS(_res_ptr);
10949 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10951 TxOut_free(_res_conv);
10954 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10955 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10956 *ret_ref = TxOut_clone(arg);
10957 return (uint32_t)ret_ref;
10959 uint32_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
10960 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
10961 uint32_t ret_conv = TxOut_clone_ptr(arg_conv);
10965 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
10966 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10967 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10968 *ret_ref = TxOut_clone(orig_conv);
10969 return (uint32_t)ret_ref;
10972 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10973 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10977 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10978 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10979 *ret_conv = CResult_NoneNoneZ_ok();
10980 return (uint32_t)ret_conv;
10983 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10984 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10985 *ret_conv = CResult_NoneNoneZ_err();
10986 return (uint32_t)ret_conv;
10989 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10990 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10991 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
10995 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10996 if ((_res & 1) != 0) return;
10997 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10998 CHECK_ACCESS(_res_ptr);
10999 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11001 CResult_NoneNoneZ_free(_res_conv);
11004 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11005 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11006 *ret_conv = CResult_NoneNoneZ_clone(arg);
11007 return (uint32_t)ret_conv;
11009 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
11010 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
11011 uint32_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11015 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
11016 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11017 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11018 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11019 return (uint32_t)ret_conv;
11022 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
11023 LDKCounterpartyCommitmentSecrets o_conv;
11024 o_conv.inner = (void*)(o & (~1));
11025 o_conv.is_owned = (o & 1) || (o == 0);
11026 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11027 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11028 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11029 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11030 return (uint32_t)ret_conv;
11033 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
11034 LDKDecodeError e_conv;
11035 e_conv.inner = (void*)(e & (~1));
11036 e_conv.is_owned = (e & 1) || (e == 0);
11037 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11038 e_conv = DecodeError_clone(&e_conv);
11039 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11040 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11041 return (uint32_t)ret_conv;
11044 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
11045 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
11046 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11050 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
11051 if ((_res & 1) != 0) return;
11052 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11053 CHECK_ACCESS(_res_ptr);
11054 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11056 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11059 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11060 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11061 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11062 return (uint32_t)ret_conv;
11064 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
11065 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
11066 uint32_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11070 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
11071 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
11072 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11073 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11074 return (uint32_t)ret_conv;
11077 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11078 LDKSecretKey o_ref;
11079 CHECK(o->arr_len == 32);
11080 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11081 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11082 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11083 return (uint32_t)ret_conv;
11086 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11087 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11088 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11089 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11090 return (uint32_t)ret_conv;
11093 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
11094 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
11095 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11099 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
11100 if ((_res & 1) != 0) return;
11101 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11102 CHECK_ACCESS(_res_ptr);
11103 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11105 CResult_SecretKeyErrorZ_free(_res_conv);
11108 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11109 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11110 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11111 return (uint32_t)ret_conv;
11113 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
11114 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
11115 uint32_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11119 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
11120 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
11121 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11122 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11123 return (uint32_t)ret_conv;
11126 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11127 LDKPublicKey o_ref;
11128 CHECK(o->arr_len == 33);
11129 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11130 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11131 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11132 return (uint32_t)ret_conv;
11135 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11136 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11137 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11138 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11139 return (uint32_t)ret_conv;
11142 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
11143 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
11144 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11148 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
11149 if ((_res & 1) != 0) return;
11150 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11151 CHECK_ACCESS(_res_ptr);
11152 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11154 CResult_PublicKeyErrorZ_free(_res_conv);
11157 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11158 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11159 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11160 return (uint32_t)ret_conv;
11162 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
11163 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
11164 uint32_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11168 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
11169 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11170 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11171 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11172 return (uint32_t)ret_conv;
11175 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
11176 LDKTxCreationKeys o_conv;
11177 o_conv.inner = (void*)(o & (~1));
11178 o_conv.is_owned = (o & 1) || (o == 0);
11179 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11180 o_conv = TxCreationKeys_clone(&o_conv);
11181 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11182 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11183 return (uint32_t)ret_conv;
11186 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
11187 LDKDecodeError e_conv;
11188 e_conv.inner = (void*)(e & (~1));
11189 e_conv.is_owned = (e & 1) || (e == 0);
11190 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11191 e_conv = DecodeError_clone(&e_conv);
11192 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11193 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11194 return (uint32_t)ret_conv;
11197 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
11198 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
11199 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11203 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
11204 if ((_res & 1) != 0) return;
11205 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11206 CHECK_ACCESS(_res_ptr);
11207 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11209 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11212 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11213 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11214 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11215 return (uint32_t)ret_conv;
11217 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11218 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
11219 uint32_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11223 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
11224 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11225 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11226 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11227 return (uint32_t)ret_conv;
11230 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
11231 LDKChannelPublicKeys o_conv;
11232 o_conv.inner = (void*)(o & (~1));
11233 o_conv.is_owned = (o & 1) || (o == 0);
11234 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11235 o_conv = ChannelPublicKeys_clone(&o_conv);
11236 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11237 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11238 return (uint32_t)ret_conv;
11241 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
11242 LDKDecodeError e_conv;
11243 e_conv.inner = (void*)(e & (~1));
11244 e_conv.is_owned = (e & 1) || (e == 0);
11245 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11246 e_conv = DecodeError_clone(&e_conv);
11247 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11248 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11249 return (uint32_t)ret_conv;
11252 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
11253 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
11254 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11258 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
11259 if ((_res & 1) != 0) return;
11260 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11261 CHECK_ACCESS(_res_ptr);
11262 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11264 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11267 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11268 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11269 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11270 return (uint32_t)ret_conv;
11272 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11273 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
11274 uint32_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11278 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
11279 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11280 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11281 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11282 return (uint32_t)ret_conv;
11285 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
11286 LDKTxCreationKeys o_conv;
11287 o_conv.inner = (void*)(o & (~1));
11288 o_conv.is_owned = (o & 1) || (o == 0);
11289 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11290 o_conv = TxCreationKeys_clone(&o_conv);
11291 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11292 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11293 return (uint32_t)ret_conv;
11296 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11297 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11298 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11299 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11300 return (uint32_t)ret_conv;
11303 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
11304 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
11305 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11309 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
11310 if ((_res & 1) != 0) return;
11311 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11312 CHECK_ACCESS(_res_ptr);
11313 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11315 CResult_TxCreationKeysErrorZ_free(_res_conv);
11318 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11319 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11320 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11321 return (uint32_t)ret_conv;
11323 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
11324 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
11325 uint32_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11329 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
11330 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11331 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11332 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11333 return (uint32_t)ret_conv;
11336 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11337 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11338 *ret_copy = COption_u32Z_some(o);
11339 uint32_t ret_ref = (uintptr_t)ret_copy;
11343 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11344 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11345 *ret_copy = COption_u32Z_none();
11346 uint32_t ret_ref = (uintptr_t)ret_copy;
11350 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
11351 if ((_res & 1) != 0) return;
11352 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11353 CHECK_ACCESS(_res_ptr);
11354 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11356 COption_u32Z_free(_res_conv);
11359 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11360 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11361 *ret_copy = COption_u32Z_clone(arg);
11362 uint32_t ret_ref = (uintptr_t)ret_copy;
11365 uint32_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
11366 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
11367 uint32_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11371 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
11372 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11373 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11374 *ret_copy = COption_u32Z_clone(orig_conv);
11375 uint32_t ret_ref = (uintptr_t)ret_copy;
11379 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
11380 LDKHTLCOutputInCommitment o_conv;
11381 o_conv.inner = (void*)(o & (~1));
11382 o_conv.is_owned = (o & 1) || (o == 0);
11383 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11384 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11385 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11386 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11387 return (uint32_t)ret_conv;
11390 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
11391 LDKDecodeError e_conv;
11392 e_conv.inner = (void*)(e & (~1));
11393 e_conv.is_owned = (e & 1) || (e == 0);
11394 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11395 e_conv = DecodeError_clone(&e_conv);
11396 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11397 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11398 return (uint32_t)ret_conv;
11401 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
11402 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
11403 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11407 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
11408 if ((_res & 1) != 0) return;
11409 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11410 CHECK_ACCESS(_res_ptr);
11411 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11413 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11416 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11417 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11418 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11419 return (uint32_t)ret_conv;
11421 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
11422 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
11423 uint32_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11427 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
11428 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11429 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11430 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11431 return (uint32_t)ret_conv;
11434 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11435 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11439 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11440 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11444 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11445 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11446 COption_NoneZ_free(_res_conv);
11449 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11450 LDKCounterpartyChannelTransactionParameters o_conv;
11451 o_conv.inner = (void*)(o & (~1));
11452 o_conv.is_owned = (o & 1) || (o == 0);
11453 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11454 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11455 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11456 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11457 return (uint32_t)ret_conv;
11460 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11461 LDKDecodeError e_conv;
11462 e_conv.inner = (void*)(e & (~1));
11463 e_conv.is_owned = (e & 1) || (e == 0);
11464 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11465 e_conv = DecodeError_clone(&e_conv);
11466 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11467 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11468 return (uint32_t)ret_conv;
11471 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11472 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11473 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11477 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11478 if ((_res & 1) != 0) return;
11479 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11480 CHECK_ACCESS(_res_ptr);
11481 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11483 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11486 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11487 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11488 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11489 return (uint32_t)ret_conv;
11491 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11492 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11493 uint32_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11497 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11498 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11499 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11500 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11501 return (uint32_t)ret_conv;
11504 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11505 LDKChannelTransactionParameters o_conv;
11506 o_conv.inner = (void*)(o & (~1));
11507 o_conv.is_owned = (o & 1) || (o == 0);
11508 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11509 o_conv = ChannelTransactionParameters_clone(&o_conv);
11510 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11511 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11512 return (uint32_t)ret_conv;
11515 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11516 LDKDecodeError e_conv;
11517 e_conv.inner = (void*)(e & (~1));
11518 e_conv.is_owned = (e & 1) || (e == 0);
11519 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11520 e_conv = DecodeError_clone(&e_conv);
11521 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11522 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11523 return (uint32_t)ret_conv;
11526 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11527 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11528 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11532 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11533 if ((_res & 1) != 0) return;
11534 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11535 CHECK_ACCESS(_res_ptr);
11536 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11538 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11541 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11542 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11543 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11544 return (uint32_t)ret_conv;
11546 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11547 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11548 uint32_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11552 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11553 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11554 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11555 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11556 return (uint32_t)ret_conv;
11559 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11560 LDKCVec_SignatureZ _res_constr;
11561 _res_constr.datalen = _res->arr_len;
11562 if (_res_constr.datalen > 0)
11563 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11565 _res_constr.data = NULL;
11566 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
11567 for (size_t m = 0; m < _res_constr.datalen; m++) {
11568 int8_tArray _res_conv_12 = _res_vals[m];
11569 LDKSignature _res_conv_12_ref;
11570 CHECK(_res_conv_12->arr_len == 64);
11571 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11572 _res_constr.data[m] = _res_conv_12_ref;
11574 CVec_SignatureZ_free(_res_constr);
11577 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11578 LDKHolderCommitmentTransaction 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 = HolderCommitmentTransaction_clone(&o_conv);
11583 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11584 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11585 return (uint32_t)ret_conv;
11588 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_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_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11595 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11596 return (uint32_t)ret_conv;
11599 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11600 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
11601 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11605 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_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_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11611 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11614 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11615 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11616 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11617 return (uint32_t)ret_conv;
11619 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11620 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11621 uint32_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11625 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11626 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11627 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11628 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11629 return (uint32_t)ret_conv;
11632 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11633 LDKBuiltCommitmentTransaction 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 = BuiltCommitmentTransaction_clone(&o_conv);
11638 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11639 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11640 return (uint32_t)ret_conv;
11643 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_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_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11650 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11651 return (uint32_t)ret_conv;
11654 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11655 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
11656 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11660 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_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_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11666 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11669 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11670 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11671 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
11672 return (uint32_t)ret_conv;
11674 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11675 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11676 uint32_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11680 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11681 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11682 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11683 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11684 return (uint32_t)ret_conv;
11687 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
11688 LDKTrustedClosingTransaction 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 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11693 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11694 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11695 return (uint32_t)ret_conv;
11698 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11699 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11700 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11701 return (uint32_t)ret_conv;
11704 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
11705 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
11706 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11710 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
11711 if ((_res & 1) != 0) return;
11712 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11713 CHECK_ACCESS(_res_ptr);
11714 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11716 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11719 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11720 LDKCommitmentTransaction o_conv;
11721 o_conv.inner = (void*)(o & (~1));
11722 o_conv.is_owned = (o & 1) || (o == 0);
11723 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11724 o_conv = CommitmentTransaction_clone(&o_conv);
11725 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11726 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11727 return (uint32_t)ret_conv;
11730 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11731 LDKDecodeError e_conv;
11732 e_conv.inner = (void*)(e & (~1));
11733 e_conv.is_owned = (e & 1) || (e == 0);
11734 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11735 e_conv = DecodeError_clone(&e_conv);
11736 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11737 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11738 return (uint32_t)ret_conv;
11741 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11742 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
11743 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11747 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11748 if ((_res & 1) != 0) return;
11749 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11750 CHECK_ACCESS(_res_ptr);
11751 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11753 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11756 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11757 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11758 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11759 return (uint32_t)ret_conv;
11761 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11762 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
11763 uint32_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11767 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11768 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11769 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11770 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11771 return (uint32_t)ret_conv;
11774 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
11775 LDKTrustedCommitmentTransaction o_conv;
11776 o_conv.inner = (void*)(o & (~1));
11777 o_conv.is_owned = (o & 1) || (o == 0);
11778 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11779 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11780 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11781 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11782 return (uint32_t)ret_conv;
11785 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11786 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11787 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11788 return (uint32_t)ret_conv;
11791 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
11792 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
11793 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11797 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
11798 if ((_res & 1) != 0) return;
11799 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11800 CHECK_ACCESS(_res_ptr);
11801 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11803 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11806 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11807 LDKCVec_SignatureZ o_constr;
11808 o_constr.datalen = o->arr_len;
11809 if (o_constr.datalen > 0)
11810 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11812 o_constr.data = NULL;
11813 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
11814 for (size_t m = 0; m < o_constr.datalen; m++) {
11815 int8_tArray o_conv_12 = o_vals[m];
11816 LDKSignature o_conv_12_ref;
11817 CHECK(o_conv_12->arr_len == 64);
11818 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11819 o_constr.data[m] = o_conv_12_ref;
11821 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11822 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11823 return (uint32_t)ret_conv;
11826 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11827 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11828 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11829 return (uint32_t)ret_conv;
11832 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
11833 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
11834 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11838 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
11839 if ((_res & 1) != 0) return;
11840 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11841 CHECK_ACCESS(_res_ptr);
11842 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11844 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11847 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11848 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11849 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11850 return (uint32_t)ret_conv;
11852 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
11853 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
11854 uint32_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11858 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
11859 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11860 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11861 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11862 return (uint32_t)ret_conv;
11865 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
11866 LDKShutdownScript o_conv;
11867 o_conv.inner = (void*)(o & (~1));
11868 o_conv.is_owned = (o & 1) || (o == 0);
11869 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11870 o_conv = ShutdownScript_clone(&o_conv);
11871 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11872 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11873 return (uint32_t)ret_conv;
11876 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
11877 LDKDecodeError e_conv;
11878 e_conv.inner = (void*)(e & (~1));
11879 e_conv.is_owned = (e & 1) || (e == 0);
11880 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11881 e_conv = DecodeError_clone(&e_conv);
11882 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11883 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11884 return (uint32_t)ret_conv;
11887 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
11888 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
11889 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11893 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
11894 if ((_res & 1) != 0) return;
11895 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11896 CHECK_ACCESS(_res_ptr);
11897 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11899 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11902 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11903 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11904 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11905 return (uint32_t)ret_conv;
11907 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
11908 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
11909 uint32_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11913 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
11914 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11915 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11916 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11917 return (uint32_t)ret_conv;
11920 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
11921 LDKShutdownScript o_conv;
11922 o_conv.inner = (void*)(o & (~1));
11923 o_conv.is_owned = (o & 1) || (o == 0);
11924 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11925 o_conv = ShutdownScript_clone(&o_conv);
11926 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11927 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11928 return (uint32_t)ret_conv;
11931 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
11932 LDKInvalidShutdownScript e_conv;
11933 e_conv.inner = (void*)(e & (~1));
11934 e_conv.is_owned = (e & 1) || (e == 0);
11935 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11936 e_conv = InvalidShutdownScript_clone(&e_conv);
11937 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11938 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11939 return (uint32_t)ret_conv;
11942 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
11943 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
11944 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11948 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
11949 if ((_res & 1) != 0) return;
11950 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11951 CHECK_ACCESS(_res_ptr);
11952 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11954 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11957 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11958 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11959 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11960 return (uint32_t)ret_conv;
11962 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
11963 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
11964 uint32_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11968 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
11969 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11970 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11971 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11972 return (uint32_t)ret_conv;
11975 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
11976 LDKRouteHop o_conv;
11977 o_conv.inner = (void*)(o & (~1));
11978 o_conv.is_owned = (o & 1) || (o == 0);
11979 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11980 o_conv = RouteHop_clone(&o_conv);
11981 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11982 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11983 return (uint32_t)ret_conv;
11986 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
11987 LDKDecodeError e_conv;
11988 e_conv.inner = (void*)(e & (~1));
11989 e_conv.is_owned = (e & 1) || (e == 0);
11990 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11991 e_conv = DecodeError_clone(&e_conv);
11992 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11993 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11994 return (uint32_t)ret_conv;
11997 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
11998 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
11999 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12003 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
12004 if ((_res & 1) != 0) return;
12005 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12006 CHECK_ACCESS(_res_ptr);
12007 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12009 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12012 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12013 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12014 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12015 return (uint32_t)ret_conv;
12017 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12018 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
12019 uint32_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12023 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
12024 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12025 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12026 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12027 return (uint32_t)ret_conv;
12030 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
12031 LDKCVec_RouteHopZ _res_constr;
12032 _res_constr.datalen = _res->arr_len;
12033 if (_res_constr.datalen > 0)
12034 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12036 _res_constr.data = NULL;
12037 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12038 for (size_t k = 0; k < _res_constr.datalen; k++) {
12039 uint32_t _res_conv_10 = _res_vals[k];
12040 LDKRouteHop _res_conv_10_conv;
12041 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12042 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12043 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12044 _res_constr.data[k] = _res_conv_10_conv;
12046 CVec_RouteHopZ_free(_res_constr);
12049 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12050 LDKCVec_CVec_RouteHopZZ _res_constr;
12051 _res_constr.datalen = _res->arr_len;
12052 if (_res_constr.datalen > 0)
12053 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12055 _res_constr.data = NULL;
12056 uint32_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
12057 for (size_t m = 0; m < _res_constr.datalen; m++) {
12058 uint32_tArray _res_conv_12 = _res_vals[m];
12059 LDKCVec_RouteHopZ _res_conv_12_constr;
12060 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12061 if (_res_conv_12_constr.datalen > 0)
12062 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12064 _res_conv_12_constr.data = NULL;
12065 uint32_t* _res_conv_12_vals = _res_conv_12->elems /* XXX _res_conv_12 leaks */;
12066 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12067 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12068 LDKRouteHop _res_conv_12_conv_10_conv;
12069 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12070 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12071 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12072 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12074 _res_constr.data[m] = _res_conv_12_constr;
12076 CVec_CVec_RouteHopZZ_free(_res_constr);
12079 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
12081 o_conv.inner = (void*)(o & (~1));
12082 o_conv.is_owned = (o & 1) || (o == 0);
12083 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12084 o_conv = Route_clone(&o_conv);
12085 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12086 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12087 return (uint32_t)ret_conv;
12090 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
12091 LDKDecodeError e_conv;
12092 e_conv.inner = (void*)(e & (~1));
12093 e_conv.is_owned = (e & 1) || (e == 0);
12094 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12095 e_conv = DecodeError_clone(&e_conv);
12096 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12097 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12098 return (uint32_t)ret_conv;
12101 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
12102 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
12103 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12107 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
12108 if ((_res & 1) != 0) return;
12109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12110 CHECK_ACCESS(_res_ptr);
12111 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12113 CResult_RouteDecodeErrorZ_free(_res_conv);
12116 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12117 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12118 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12119 return (uint32_t)ret_conv;
12121 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
12122 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
12123 uint32_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12127 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
12128 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12129 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12130 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12131 return (uint32_t)ret_conv;
12134 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
12135 LDKRouteParameters o_conv;
12136 o_conv.inner = (void*)(o & (~1));
12137 o_conv.is_owned = (o & 1) || (o == 0);
12138 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12139 o_conv = RouteParameters_clone(&o_conv);
12140 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12141 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12142 return (uint32_t)ret_conv;
12145 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
12146 LDKDecodeError e_conv;
12147 e_conv.inner = (void*)(e & (~1));
12148 e_conv.is_owned = (e & 1) || (e == 0);
12149 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12150 e_conv = DecodeError_clone(&e_conv);
12151 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12152 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12153 return (uint32_t)ret_conv;
12156 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
12157 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
12158 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12162 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
12163 if ((_res & 1) != 0) return;
12164 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12165 CHECK_ACCESS(_res_ptr);
12166 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12168 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12171 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12172 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12173 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12174 return (uint32_t)ret_conv;
12176 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12177 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
12178 uint32_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12182 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
12183 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12184 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12185 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12186 return (uint32_t)ret_conv;
12189 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
12190 LDKCVec_RouteHintZ _res_constr;
12191 _res_constr.datalen = _res->arr_len;
12192 if (_res_constr.datalen > 0)
12193 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12195 _res_constr.data = NULL;
12196 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12197 for (size_t l = 0; l < _res_constr.datalen; l++) {
12198 uint32_t _res_conv_11 = _res_vals[l];
12199 LDKRouteHint _res_conv_11_conv;
12200 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12201 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12202 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12203 _res_constr.data[l] = _res_conv_11_conv;
12205 CVec_RouteHintZ_free(_res_constr);
12208 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12209 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12210 *ret_copy = COption_u64Z_some(o);
12211 uint32_t ret_ref = (uintptr_t)ret_copy;
12215 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12216 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12217 *ret_copy = COption_u64Z_none();
12218 uint32_t ret_ref = (uintptr_t)ret_copy;
12222 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
12223 if ((_res & 1) != 0) return;
12224 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12225 CHECK_ACCESS(_res_ptr);
12226 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12228 COption_u64Z_free(_res_conv);
12231 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12232 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12233 *ret_copy = COption_u64Z_clone(arg);
12234 uint32_t ret_ref = (uintptr_t)ret_copy;
12237 uint32_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
12238 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
12239 uint32_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12243 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
12244 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12245 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12246 *ret_copy = COption_u64Z_clone(orig_conv);
12247 uint32_t ret_ref = (uintptr_t)ret_copy;
12251 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
12252 LDKPaymentParameters o_conv;
12253 o_conv.inner = (void*)(o & (~1));
12254 o_conv.is_owned = (o & 1) || (o == 0);
12255 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12256 o_conv = PaymentParameters_clone(&o_conv);
12257 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12258 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12259 return (uint32_t)ret_conv;
12262 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
12263 LDKDecodeError e_conv;
12264 e_conv.inner = (void*)(e & (~1));
12265 e_conv.is_owned = (e & 1) || (e == 0);
12266 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12267 e_conv = DecodeError_clone(&e_conv);
12268 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12269 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12270 return (uint32_t)ret_conv;
12273 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
12274 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
12275 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12279 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
12280 if ((_res & 1) != 0) return;
12281 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12282 CHECK_ACCESS(_res_ptr);
12283 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12285 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12288 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12289 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12290 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12291 return (uint32_t)ret_conv;
12293 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12294 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
12295 uint32_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12299 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
12300 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
12301 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12302 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12303 return (uint32_t)ret_conv;
12306 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
12307 LDKCVec_RouteHintHopZ _res_constr;
12308 _res_constr.datalen = _res->arr_len;
12309 if (_res_constr.datalen > 0)
12310 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12312 _res_constr.data = NULL;
12313 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12314 for (size_t o = 0; o < _res_constr.datalen; o++) {
12315 uint32_t _res_conv_14 = _res_vals[o];
12316 LDKRouteHintHop _res_conv_14_conv;
12317 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12318 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12319 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12320 _res_constr.data[o] = _res_conv_14_conv;
12322 CVec_RouteHintHopZ_free(_res_constr);
12325 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
12326 LDKRouteHint o_conv;
12327 o_conv.inner = (void*)(o & (~1));
12328 o_conv.is_owned = (o & 1) || (o == 0);
12329 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12330 o_conv = RouteHint_clone(&o_conv);
12331 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12332 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12333 return (uint32_t)ret_conv;
12336 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
12337 LDKDecodeError e_conv;
12338 e_conv.inner = (void*)(e & (~1));
12339 e_conv.is_owned = (e & 1) || (e == 0);
12340 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12341 e_conv = DecodeError_clone(&e_conv);
12342 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12343 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12344 return (uint32_t)ret_conv;
12347 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
12348 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
12349 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12353 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
12354 if ((_res & 1) != 0) return;
12355 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12356 CHECK_ACCESS(_res_ptr);
12357 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12359 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12362 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12363 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12364 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12365 return (uint32_t)ret_conv;
12367 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
12368 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
12369 uint32_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12373 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
12374 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12375 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12376 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12377 return (uint32_t)ret_conv;
12380 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
12381 LDKRouteHintHop o_conv;
12382 o_conv.inner = (void*)(o & (~1));
12383 o_conv.is_owned = (o & 1) || (o == 0);
12384 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12385 o_conv = RouteHintHop_clone(&o_conv);
12386 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12387 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12388 return (uint32_t)ret_conv;
12391 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
12392 LDKDecodeError e_conv;
12393 e_conv.inner = (void*)(e & (~1));
12394 e_conv.is_owned = (e & 1) || (e == 0);
12395 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12396 e_conv = DecodeError_clone(&e_conv);
12397 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12398 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12399 return (uint32_t)ret_conv;
12402 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
12403 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
12404 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12408 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
12409 if ((_res & 1) != 0) return;
12410 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12411 CHECK_ACCESS(_res_ptr);
12412 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12414 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12417 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12418 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12419 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12420 return (uint32_t)ret_conv;
12422 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12423 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
12424 uint32_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12428 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
12429 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12430 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12431 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12432 return (uint32_t)ret_conv;
12435 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
12436 LDKCVec_ChannelDetailsZ _res_constr;
12437 _res_constr.datalen = _res->arr_len;
12438 if (_res_constr.datalen > 0)
12439 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12441 _res_constr.data = NULL;
12442 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12443 for (size_t q = 0; q < _res_constr.datalen; q++) {
12444 uint32_t _res_conv_16 = _res_vals[q];
12445 LDKChannelDetails _res_conv_16_conv;
12446 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12447 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12448 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12449 _res_constr.data[q] = _res_conv_16_conv;
12451 CVec_ChannelDetailsZ_free(_res_constr);
12454 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
12456 o_conv.inner = (void*)(o & (~1));
12457 o_conv.is_owned = (o & 1) || (o == 0);
12458 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12459 o_conv = Route_clone(&o_conv);
12460 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12461 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12462 return (uint32_t)ret_conv;
12465 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
12466 LDKLightningError e_conv;
12467 e_conv.inner = (void*)(e & (~1));
12468 e_conv.is_owned = (e & 1) || (e == 0);
12469 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12470 e_conv = LightningError_clone(&e_conv);
12471 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12472 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12473 return (uint32_t)ret_conv;
12476 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
12477 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
12478 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12482 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
12483 if ((_res & 1) != 0) return;
12484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12485 CHECK_ACCESS(_res_ptr);
12486 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12488 CResult_RouteLightningErrorZ_free(_res_conv);
12491 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12492 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12493 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12494 return (uint32_t)ret_conv;
12496 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
12497 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
12498 uint32_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12502 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
12503 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12504 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12505 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12506 return (uint32_t)ret_conv;
12509 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12510 LDKCVec_PublicKeyZ _res_constr;
12511 _res_constr.datalen = _res->arr_len;
12512 if (_res_constr.datalen > 0)
12513 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12515 _res_constr.data = NULL;
12516 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
12517 for (size_t m = 0; m < _res_constr.datalen; m++) {
12518 int8_tArray _res_conv_12 = _res_vals[m];
12519 LDKPublicKey _res_conv_12_ref;
12520 CHECK(_res_conv_12->arr_len == 33);
12521 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12522 _res_constr.data[m] = _res_conv_12_ref;
12524 CVec_PublicKeyZ_free(_res_constr);
12527 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint32_t o) {
12528 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12529 CHECK_ACCESS(o_ptr);
12530 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12531 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
12532 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12533 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12534 return (uint32_t)ret_conv;
12537 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint32_t e) {
12538 LDKDecodeError e_conv;
12539 e_conv.inner = (void*)(e & (~1));
12540 e_conv.is_owned = (e & 1) || (e == 0);
12541 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12542 e_conv = DecodeError_clone(&e_conv);
12543 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12544 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12545 return (uint32_t)ret_conv;
12548 jboolean __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint32_t o) {
12549 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
12550 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12554 void __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint32_t _res) {
12555 if ((_res & 1) != 0) return;
12556 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12557 CHECK_ACCESS(_res_ptr);
12558 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12560 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12563 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12564 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12565 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12566 return (uint32_t)ret_conv;
12568 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint32_t arg) {
12569 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
12570 uint32_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12574 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint32_t orig) {
12575 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
12576 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12577 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12578 return (uint32_t)ret_conv;
12581 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
12582 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12583 CHECK_ACCESS(o_ptr);
12584 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12585 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
12586 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12587 *ret_copy = COption_ClosureReasonZ_some(o_conv);
12588 uint32_t ret_ref = (uintptr_t)ret_copy;
12592 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12593 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12594 *ret_copy = COption_ClosureReasonZ_none();
12595 uint32_t ret_ref = (uintptr_t)ret_copy;
12599 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
12600 if ((_res & 1) != 0) return;
12601 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12602 CHECK_ACCESS(_res_ptr);
12603 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12605 COption_ClosureReasonZ_free(_res_conv);
12608 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12609 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12610 *ret_copy = COption_ClosureReasonZ_clone(arg);
12611 uint32_t ret_ref = (uintptr_t)ret_copy;
12614 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
12615 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
12616 uint32_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
12620 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12621 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12622 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12623 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12624 uint32_t ret_ref = (uintptr_t)ret_copy;
12628 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12629 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12630 CHECK_ACCESS(o_ptr);
12631 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12632 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
12633 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12634 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12635 return (uint32_t)ret_conv;
12638 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12639 LDKDecodeError e_conv;
12640 e_conv.inner = (void*)(e & (~1));
12641 e_conv.is_owned = (e & 1) || (e == 0);
12642 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12643 e_conv = DecodeError_clone(&e_conv);
12644 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12645 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12646 return (uint32_t)ret_conv;
12649 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12650 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12651 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12655 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12656 if ((_res & 1) != 0) return;
12657 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12658 CHECK_ACCESS(_res_ptr);
12659 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12661 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12664 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12665 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12666 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12667 return (uint32_t)ret_conv;
12669 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12670 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12671 uint32_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12675 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12676 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12677 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12678 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12679 return (uint32_t)ret_conv;
12682 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12683 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12684 CHECK_ACCESS(o_ptr);
12685 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12686 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
12687 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12688 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12689 uint32_t ret_ref = (uintptr_t)ret_copy;
12693 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12694 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12695 *ret_copy = COption_NetworkUpdateZ_none();
12696 uint32_t ret_ref = (uintptr_t)ret_copy;
12700 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12701 if ((_res & 1) != 0) return;
12702 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12703 CHECK_ACCESS(_res_ptr);
12704 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12706 COption_NetworkUpdateZ_free(_res_conv);
12709 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12710 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12711 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12712 uint32_t ret_ref = (uintptr_t)ret_copy;
12715 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12716 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12717 uint32_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12721 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12722 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12723 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12724 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12725 uint32_t ret_ref = (uintptr_t)ret_copy;
12729 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12730 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12731 _res_constr.datalen = _res->arr_len;
12732 if (_res_constr.datalen > 0)
12733 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12735 _res_constr.data = NULL;
12736 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12737 for (size_t b = 0; b < _res_constr.datalen; b++) {
12738 uint32_t _res_conv_27 = _res_vals[b];
12739 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
12740 CHECK_ACCESS(_res_conv_27_ptr);
12741 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12742 FREE((void*)_res_conv_27);
12743 _res_constr.data[b] = _res_conv_27_conv;
12745 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12748 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12749 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12750 CHECK_ACCESS(o_ptr);
12751 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12752 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
12753 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12754 *ret_copy = COption_EventZ_some(o_conv);
12755 uint32_t ret_ref = (uintptr_t)ret_copy;
12759 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12760 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12761 *ret_copy = COption_EventZ_none();
12762 uint32_t ret_ref = (uintptr_t)ret_copy;
12766 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12767 if ((_res & 1) != 0) return;
12768 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12769 CHECK_ACCESS(_res_ptr);
12770 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12772 COption_EventZ_free(_res_conv);
12775 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12776 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12777 *ret_copy = COption_EventZ_clone(arg);
12778 uint32_t ret_ref = (uintptr_t)ret_copy;
12781 uint32_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12782 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12783 uint32_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
12787 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12788 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12789 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12790 *ret_copy = COption_EventZ_clone(orig_conv);
12791 uint32_t ret_ref = (uintptr_t)ret_copy;
12795 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12796 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12797 CHECK_ACCESS(o_ptr);
12798 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12799 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
12800 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12801 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12802 return (uint32_t)ret_conv;
12805 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12806 LDKDecodeError e_conv;
12807 e_conv.inner = (void*)(e & (~1));
12808 e_conv.is_owned = (e & 1) || (e == 0);
12809 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12810 e_conv = DecodeError_clone(&e_conv);
12811 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12812 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12813 return (uint32_t)ret_conv;
12816 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12817 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12818 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12822 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12823 if ((_res & 1) != 0) return;
12824 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12825 CHECK_ACCESS(_res_ptr);
12826 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12828 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12831 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12832 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12833 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12834 return (uint32_t)ret_conv;
12836 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12837 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12838 uint32_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12842 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12843 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12844 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12845 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12846 return (uint32_t)ret_conv;
12849 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
12850 LDKCVec_MessageSendEventZ _res_constr;
12851 _res_constr.datalen = _res->arr_len;
12852 if (_res_constr.datalen > 0)
12853 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12855 _res_constr.data = NULL;
12856 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12857 for (size_t s = 0; s < _res_constr.datalen; s++) {
12858 uint32_t _res_conv_18 = _res_vals[s];
12859 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
12860 CHECK_ACCESS(_res_conv_18_ptr);
12861 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12862 FREE((void*)_res_conv_18);
12863 _res_constr.data[s] = _res_conv_18_conv;
12865 CVec_MessageSendEventZ_free(_res_constr);
12868 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
12869 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12870 CHECK_ACCESS(o_ptr);
12871 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12872 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
12873 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12874 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12875 return (uint32_t)ret_conv;
12878 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12879 LDKAccessError e_conv = LDKAccessError_from_js(e);
12880 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12881 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12882 return (uint32_t)ret_conv;
12885 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
12886 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
12887 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12891 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
12892 if ((_res & 1) != 0) return;
12893 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12894 CHECK_ACCESS(_res_ptr);
12895 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12897 CResult_TxOutAccessErrorZ_free(_res_conv);
12900 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12901 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12902 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12903 return (uint32_t)ret_conv;
12905 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
12906 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
12907 uint32_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12911 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
12912 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
12913 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12914 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12915 return (uint32_t)ret_conv;
12918 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12919 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12920 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12921 return ((uint32_t)ret_conv);
12923 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
12924 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
12925 uint32_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12929 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
12930 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12931 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12932 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12933 return ((uint32_t)ret_conv);
12936 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12937 LDKTransaction b_ref;
12938 b_ref.datalen = b->arr_len;
12939 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12940 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12941 b_ref.data_is_owned = true;
12942 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12943 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12944 return ((uint32_t)ret_conv);
12947 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
12948 if ((_res & 1) != 0) return;
12949 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12950 CHECK_ACCESS(_res_ptr);
12951 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12953 C2Tuple_usizeTransactionZ_free(_res_conv);
12956 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
12957 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12958 _res_constr.datalen = _res->arr_len;
12959 if (_res_constr.datalen > 0)
12960 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12962 _res_constr.data = NULL;
12963 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12964 for (size_t c = 0; c < _res_constr.datalen; c++) {
12965 uint32_t _res_conv_28 = _res_vals[c];
12966 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
12967 CHECK_ACCESS(_res_conv_28_ptr);
12968 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12969 FREE((void*)_res_conv_28);
12970 _res_constr.data[c] = _res_conv_28_conv;
12972 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12975 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
12976 LDKCVec_TxidZ _res_constr;
12977 _res_constr.datalen = _res->arr_len;
12978 if (_res_constr.datalen > 0)
12979 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12981 _res_constr.data = NULL;
12982 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
12983 for (size_t m = 0; m < _res_constr.datalen; m++) {
12984 int8_tArray _res_conv_12 = _res_vals[m];
12985 LDKThirtyTwoBytes _res_conv_12_ref;
12986 CHECK(_res_conv_12->arr_len == 32);
12987 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
12988 _res_constr.data[m] = _res_conv_12_ref;
12990 CVec_TxidZ_free(_res_constr);
12993 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
12994 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12995 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12996 return (uint32_t)ret_conv;
12999 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13000 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13001 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13002 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13003 return (uint32_t)ret_conv;
13006 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
13007 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
13008 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13012 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
13013 if ((_res & 1) != 0) return;
13014 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13015 CHECK_ACCESS(_res_ptr);
13016 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13018 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13021 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13022 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13023 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13024 return (uint32_t)ret_conv;
13026 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
13027 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
13028 uint32_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13032 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
13033 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
13034 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13035 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13036 return (uint32_t)ret_conv;
13039 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
13040 LDKCVec_MonitorEventZ _res_constr;
13041 _res_constr.datalen = _res->arr_len;
13042 if (_res_constr.datalen > 0)
13043 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13045 _res_constr.data = NULL;
13046 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13047 for (size_t o = 0; o < _res_constr.datalen; o++) {
13048 uint32_t _res_conv_14 = _res_vals[o];
13049 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
13050 CHECK_ACCESS(_res_conv_14_ptr);
13051 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13052 FREE((void*)_res_conv_14);
13053 _res_constr.data[o] = _res_conv_14_conv;
13055 CVec_MonitorEventZ_free(_res_constr);
13058 static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) {
13059 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13060 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg);
13061 return ((uint32_t)ret_conv);
13063 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(uint32_t arg) {
13064 LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1);
13065 uint32_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv);
13069 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone(uint32_t orig) {
13070 LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1);
13071 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13072 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv);
13073 return ((uint32_t)ret_conv);
13076 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_new(uint32_t a, uint32_tArray b) {
13077 LDKOutPoint a_conv;
13078 a_conv.inner = (void*)(a & (~1));
13079 a_conv.is_owned = (a & 1) || (a == 0);
13080 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13081 a_conv = OutPoint_clone(&a_conv);
13082 LDKCVec_MonitorEventZ b_constr;
13083 b_constr.datalen = b->arr_len;
13084 if (b_constr.datalen > 0)
13085 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13087 b_constr.data = NULL;
13088 uint32_t* b_vals = b->elems /* XXX b leaks */;
13089 for (size_t o = 0; o < b_constr.datalen; o++) {
13090 uint32_t b_conv_14 = b_vals[o];
13091 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
13092 CHECK_ACCESS(b_conv_14_ptr);
13093 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13094 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
13095 b_constr.data[o] = b_conv_14_conv;
13097 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13098 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr);
13099 return ((uint32_t)ret_conv);
13102 void __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_free(uint32_t _res) {
13103 if ((_res & 1) != 0) return;
13104 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13105 CHECK_ACCESS(_res_ptr);
13106 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr);
13108 C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv);
13111 void __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(uint32_tArray _res) {
13112 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr;
13113 _res_constr.datalen = _res->arr_len;
13114 if (_res_constr.datalen > 0)
13115 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
13117 _res_constr.data = NULL;
13118 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13119 for (size_t m = 0; m < _res_constr.datalen; m++) {
13120 uint32_t _res_conv_38 = _res_vals[m];
13121 void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1);
13122 CHECK_ACCESS(_res_conv_38_ptr);
13123 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr);
13124 FREE((void*)_res_conv_38);
13125 _res_constr.data[m] = _res_conv_38_conv;
13127 CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr);
13130 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
13131 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13132 CHECK_ACCESS(o_ptr);
13133 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
13134 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
13135 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13136 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
13137 uint32_t ret_ref = (uintptr_t)ret_copy;
13141 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
13142 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13143 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
13144 uint32_t ret_ref = (uintptr_t)ret_copy;
13148 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
13149 if ((_res & 1) != 0) return;
13150 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13151 CHECK_ACCESS(_res_ptr);
13152 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
13154 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
13157 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
13158 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13159 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
13160 uint32_t ret_ref = (uintptr_t)ret_copy;
13163 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
13164 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
13165 uint32_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
13169 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
13170 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
13171 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13172 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
13173 uint32_t ret_ref = (uintptr_t)ret_copy;
13177 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
13178 LDKFixedPenaltyScorer o_conv;
13179 o_conv.inner = (void*)(o & (~1));
13180 o_conv.is_owned = (o & 1) || (o == 0);
13181 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13182 o_conv = FixedPenaltyScorer_clone(&o_conv);
13183 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13184 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13185 return (uint32_t)ret_conv;
13188 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
13189 LDKDecodeError e_conv;
13190 e_conv.inner = (void*)(e & (~1));
13191 e_conv.is_owned = (e & 1) || (e == 0);
13192 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13193 e_conv = DecodeError_clone(&e_conv);
13194 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13195 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13196 return (uint32_t)ret_conv;
13199 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
13200 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
13201 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13205 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint32_t _res) {
13206 if ((_res & 1) != 0) return;
13207 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13208 CHECK_ACCESS(_res_ptr);
13209 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13211 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13214 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13215 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13216 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13217 return (uint32_t)ret_conv;
13219 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
13220 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
13221 uint32_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13225 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
13226 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
13227 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13228 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13229 return (uint32_t)ret_conv;
13232 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint32_t o) {
13233 LDKProbabilisticScorer o_conv;
13234 o_conv.inner = (void*)(o & (~1));
13235 o_conv.is_owned = (o & 1) || (o == 0);
13236 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13237 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13238 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13239 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13240 return (uint32_t)ret_conv;
13243 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint32_t e) {
13244 LDKDecodeError e_conv;
13245 e_conv.inner = (void*)(e & (~1));
13246 e_conv.is_owned = (e & 1) || (e == 0);
13247 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13248 e_conv = DecodeError_clone(&e_conv);
13249 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13250 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13251 return (uint32_t)ret_conv;
13254 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint32_t o) {
13255 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
13256 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13260 void __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint32_t _res) {
13261 if ((_res & 1) != 0) return;
13262 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13263 CHECK_ACCESS(_res_ptr);
13264 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13266 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13269 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
13270 LDKInitFeatures o_conv;
13271 o_conv.inner = (void*)(o & (~1));
13272 o_conv.is_owned = (o & 1) || (o == 0);
13273 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13274 o_conv = InitFeatures_clone(&o_conv);
13275 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13276 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13277 return (uint32_t)ret_conv;
13280 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
13281 LDKDecodeError e_conv;
13282 e_conv.inner = (void*)(e & (~1));
13283 e_conv.is_owned = (e & 1) || (e == 0);
13284 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13285 e_conv = DecodeError_clone(&e_conv);
13286 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13287 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13288 return (uint32_t)ret_conv;
13291 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13292 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
13293 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13297 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
13298 if ((_res & 1) != 0) return;
13299 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13300 CHECK_ACCESS(_res_ptr);
13301 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13303 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13306 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13307 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13308 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13309 return (uint32_t)ret_conv;
13311 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13312 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
13313 uint32_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13317 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint32_t orig) {
13318 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
13319 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13320 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13321 return (uint32_t)ret_conv;
13324 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
13325 LDKChannelFeatures o_conv;
13326 o_conv.inner = (void*)(o & (~1));
13327 o_conv.is_owned = (o & 1) || (o == 0);
13328 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13329 o_conv = ChannelFeatures_clone(&o_conv);
13330 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13331 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13332 return (uint32_t)ret_conv;
13335 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
13336 LDKDecodeError e_conv;
13337 e_conv.inner = (void*)(e & (~1));
13338 e_conv.is_owned = (e & 1) || (e == 0);
13339 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13340 e_conv = DecodeError_clone(&e_conv);
13341 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13342 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13343 return (uint32_t)ret_conv;
13346 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13347 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
13348 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13352 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
13353 if ((_res & 1) != 0) return;
13354 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13355 CHECK_ACCESS(_res_ptr);
13356 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13358 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13361 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13362 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13363 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13364 return (uint32_t)ret_conv;
13366 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13367 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
13368 uint32_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13372 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint32_t orig) {
13373 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
13374 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13375 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13376 return (uint32_t)ret_conv;
13379 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
13380 LDKNodeFeatures o_conv;
13381 o_conv.inner = (void*)(o & (~1));
13382 o_conv.is_owned = (o & 1) || (o == 0);
13383 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13384 o_conv = NodeFeatures_clone(&o_conv);
13385 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13386 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13387 return (uint32_t)ret_conv;
13390 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
13391 LDKDecodeError e_conv;
13392 e_conv.inner = (void*)(e & (~1));
13393 e_conv.is_owned = (e & 1) || (e == 0);
13394 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13395 e_conv = DecodeError_clone(&e_conv);
13396 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13397 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13398 return (uint32_t)ret_conv;
13401 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13402 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
13403 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13407 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
13408 if ((_res & 1) != 0) return;
13409 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13410 CHECK_ACCESS(_res_ptr);
13411 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13413 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13416 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13417 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13418 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13419 return (uint32_t)ret_conv;
13421 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13422 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
13423 uint32_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13427 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13428 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
13429 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13430 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13431 return (uint32_t)ret_conv;
13434 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
13435 LDKInvoiceFeatures o_conv;
13436 o_conv.inner = (void*)(o & (~1));
13437 o_conv.is_owned = (o & 1) || (o == 0);
13438 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13439 o_conv = InvoiceFeatures_clone(&o_conv);
13440 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13441 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13442 return (uint32_t)ret_conv;
13445 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
13446 LDKDecodeError e_conv;
13447 e_conv.inner = (void*)(e & (~1));
13448 e_conv.is_owned = (e & 1) || (e == 0);
13449 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13450 e_conv = DecodeError_clone(&e_conv);
13451 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13452 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13453 return (uint32_t)ret_conv;
13456 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13457 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
13458 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13462 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
13463 if ((_res & 1) != 0) return;
13464 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13465 CHECK_ACCESS(_res_ptr);
13466 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13468 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13471 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13472 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13473 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13474 return (uint32_t)ret_conv;
13476 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13477 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
13478 uint32_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13482 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint32_t orig) {
13483 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
13484 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13485 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13486 return (uint32_t)ret_conv;
13489 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
13490 LDKChannelTypeFeatures o_conv;
13491 o_conv.inner = (void*)(o & (~1));
13492 o_conv.is_owned = (o & 1) || (o == 0);
13493 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13494 o_conv = ChannelTypeFeatures_clone(&o_conv);
13495 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13496 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
13497 return (uint32_t)ret_conv;
13500 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
13501 LDKDecodeError e_conv;
13502 e_conv.inner = (void*)(e & (~1));
13503 e_conv.is_owned = (e & 1) || (e == 0);
13504 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13505 e_conv = DecodeError_clone(&e_conv);
13506 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13507 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
13508 return (uint32_t)ret_conv;
13511 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13512 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
13513 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13517 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
13518 if ((_res & 1) != 0) return;
13519 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13520 CHECK_ACCESS(_res_ptr);
13521 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13523 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13526 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13527 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13528 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
13529 return (uint32_t)ret_conv;
13531 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13532 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
13533 uint32_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13537 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13538 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
13539 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13540 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
13541 return (uint32_t)ret_conv;
13544 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13546 o_conv.inner = (void*)(o & (~1));
13547 o_conv.is_owned = (o & 1) || (o == 0);
13548 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13549 o_conv = NodeId_clone(&o_conv);
13550 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13551 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13552 return (uint32_t)ret_conv;
13555 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13556 LDKDecodeError e_conv;
13557 e_conv.inner = (void*)(e & (~1));
13558 e_conv.is_owned = (e & 1) || (e == 0);
13559 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13560 e_conv = DecodeError_clone(&e_conv);
13561 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13562 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13563 return (uint32_t)ret_conv;
13566 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13567 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13568 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13572 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13573 if ((_res & 1) != 0) return;
13574 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13575 CHECK_ACCESS(_res_ptr);
13576 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13578 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13581 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13582 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13583 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13584 return (uint32_t)ret_conv;
13586 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13587 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13588 uint32_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13592 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13593 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13594 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13595 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13596 return (uint32_t)ret_conv;
13599 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13600 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13601 CHECK_ACCESS(o_ptr);
13602 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13603 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
13604 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13605 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13606 return (uint32_t)ret_conv;
13609 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13610 LDKDecodeError e_conv;
13611 e_conv.inner = (void*)(e & (~1));
13612 e_conv.is_owned = (e & 1) || (e == 0);
13613 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13614 e_conv = DecodeError_clone(&e_conv);
13615 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13616 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13617 return (uint32_t)ret_conv;
13620 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13621 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13622 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13626 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13627 if ((_res & 1) != 0) return;
13628 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13629 CHECK_ACCESS(_res_ptr);
13630 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13632 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13635 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13636 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13637 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13638 return (uint32_t)ret_conv;
13640 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
13641 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
13642 uint32_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13646 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
13647 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
13648 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13649 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13650 return (uint32_t)ret_conv;
13653 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
13654 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13655 CHECK_ACCESS(o_ptr);
13656 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13657 if (o_conv.free == LDKAccess_JCalls_free) {
13658 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13659 LDKAccess_JCalls_cloned(&o_conv);
13661 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13662 *ret_copy = COption_AccessZ_some(o_conv);
13663 uint32_t ret_ref = (uintptr_t)ret_copy;
13667 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
13668 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13669 *ret_copy = COption_AccessZ_none();
13670 uint32_t ret_ref = (uintptr_t)ret_copy;
13674 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
13675 if ((_res & 1) != 0) return;
13676 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13677 CHECK_ACCESS(_res_ptr);
13678 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13680 COption_AccessZ_free(_res_conv);
13683 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13684 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13685 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13686 return (uint32_t)ret_conv;
13689 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13690 LDKLightningError e_conv;
13691 e_conv.inner = (void*)(e & (~1));
13692 e_conv.is_owned = (e & 1) || (e == 0);
13693 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13694 e_conv = LightningError_clone(&e_conv);
13695 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13696 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13697 return (uint32_t)ret_conv;
13700 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13701 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13702 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
13706 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
13707 if ((_res & 1) != 0) return;
13708 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13709 CHECK_ACCESS(_res_ptr);
13710 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13712 CResult_boolLightningErrorZ_free(_res_conv);
13715 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13716 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13717 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13718 return (uint32_t)ret_conv;
13720 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13721 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13722 uint32_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13726 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13727 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13728 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13729 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13730 return (uint32_t)ret_conv;
13733 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13734 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13735 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13736 return ((uint32_t)ret_conv);
13738 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13739 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13740 uint32_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13744 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13745 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13746 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13747 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13748 return ((uint32_t)ret_conv);
13751 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13752 LDKChannelAnnouncement a_conv;
13753 a_conv.inner = (void*)(a & (~1));
13754 a_conv.is_owned = (a & 1) || (a == 0);
13755 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13756 a_conv = ChannelAnnouncement_clone(&a_conv);
13757 LDKChannelUpdate b_conv;
13758 b_conv.inner = (void*)(b & (~1));
13759 b_conv.is_owned = (b & 1) || (b == 0);
13760 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13761 b_conv = ChannelUpdate_clone(&b_conv);
13762 LDKChannelUpdate c_conv;
13763 c_conv.inner = (void*)(c & (~1));
13764 c_conv.is_owned = (c & 1) || (c == 0);
13765 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13766 c_conv = ChannelUpdate_clone(&c_conv);
13767 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13768 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13769 return ((uint32_t)ret_conv);
13772 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13773 if ((_res & 1) != 0) return;
13774 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13775 CHECK_ACCESS(_res_ptr);
13776 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13778 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13781 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13782 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13783 _res_constr.datalen = _res->arr_len;
13784 if (_res_constr.datalen > 0)
13785 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13787 _res_constr.data = NULL;
13788 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13789 for (size_t h = 0; h < _res_constr.datalen; h++) {
13790 uint32_t _res_conv_59 = _res_vals[h];
13791 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
13792 CHECK_ACCESS(_res_conv_59_ptr);
13793 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13794 FREE((void*)_res_conv_59);
13795 _res_constr.data[h] = _res_conv_59_conv;
13797 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13800 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13801 LDKCVec_NodeAnnouncementZ _res_constr;
13802 _res_constr.datalen = _res->arr_len;
13803 if (_res_constr.datalen > 0)
13804 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13806 _res_constr.data = NULL;
13807 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13808 for (size_t s = 0; s < _res_constr.datalen; s++) {
13809 uint32_t _res_conv_18 = _res_vals[s];
13810 LDKNodeAnnouncement _res_conv_18_conv;
13811 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13812 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13813 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13814 _res_constr.data[s] = _res_conv_18_conv;
13816 CVec_NodeAnnouncementZ_free(_res_constr);
13819 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
13820 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13821 *ret_conv = CResult_NoneLightningErrorZ_ok();
13822 return (uint32_t)ret_conv;
13825 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
13826 LDKLightningError e_conv;
13827 e_conv.inner = (void*)(e & (~1));
13828 e_conv.is_owned = (e & 1) || (e == 0);
13829 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13830 e_conv = LightningError_clone(&e_conv);
13831 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13832 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13833 return (uint32_t)ret_conv;
13836 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13837 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13838 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
13842 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13843 if ((_res & 1) != 0) return;
13844 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13845 CHECK_ACCESS(_res_ptr);
13846 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13848 CResult_NoneLightningErrorZ_free(_res_conv);
13851 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13852 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13853 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13854 return (uint32_t)ret_conv;
13856 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13857 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13858 uint32_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13862 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13863 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13864 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13865 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13866 return (uint32_t)ret_conv;
13869 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
13870 LDKChannelUpdateInfo o_conv;
13871 o_conv.inner = (void*)(o & (~1));
13872 o_conv.is_owned = (o & 1) || (o == 0);
13873 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13874 o_conv = ChannelUpdateInfo_clone(&o_conv);
13875 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13876 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
13877 return (uint32_t)ret_conv;
13880 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
13881 LDKDecodeError e_conv;
13882 e_conv.inner = (void*)(e & (~1));
13883 e_conv.is_owned = (e & 1) || (e == 0);
13884 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13885 e_conv = DecodeError_clone(&e_conv);
13886 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13887 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
13888 return (uint32_t)ret_conv;
13891 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
13892 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
13893 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
13897 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
13898 if ((_res & 1) != 0) return;
13899 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13900 CHECK_ACCESS(_res_ptr);
13901 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
13903 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
13906 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
13907 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13908 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
13909 return (uint32_t)ret_conv;
13911 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13912 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
13913 uint32_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
13917 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
13918 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
13919 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13920 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
13921 return (uint32_t)ret_conv;
13924 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
13925 LDKChannelInfo o_conv;
13926 o_conv.inner = (void*)(o & (~1));
13927 o_conv.is_owned = (o & 1) || (o == 0);
13928 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13929 o_conv = ChannelInfo_clone(&o_conv);
13930 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13931 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13932 return (uint32_t)ret_conv;
13935 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
13936 LDKDecodeError e_conv;
13937 e_conv.inner = (void*)(e & (~1));
13938 e_conv.is_owned = (e & 1) || (e == 0);
13939 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13940 e_conv = DecodeError_clone(&e_conv);
13941 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13942 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13943 return (uint32_t)ret_conv;
13946 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13947 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
13948 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13952 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
13953 if ((_res & 1) != 0) return;
13954 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13955 CHECK_ACCESS(_res_ptr);
13956 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13958 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13961 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13962 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13963 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
13964 return (uint32_t)ret_conv;
13966 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13967 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
13968 uint32_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13972 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
13973 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13974 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13975 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13976 return (uint32_t)ret_conv;
13979 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
13980 LDKRoutingFees o_conv;
13981 o_conv.inner = (void*)(o & (~1));
13982 o_conv.is_owned = (o & 1) || (o == 0);
13983 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13984 o_conv = RoutingFees_clone(&o_conv);
13985 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13986 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13987 return (uint32_t)ret_conv;
13990 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
13991 LDKDecodeError e_conv;
13992 e_conv.inner = (void*)(e & (~1));
13993 e_conv.is_owned = (e & 1) || (e == 0);
13994 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13995 e_conv = DecodeError_clone(&e_conv);
13996 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13997 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13998 return (uint32_t)ret_conv;
14001 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
14002 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
14003 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14007 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
14008 if ((_res & 1) != 0) return;
14009 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14010 CHECK_ACCESS(_res_ptr);
14011 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14013 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14016 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14017 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14018 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14019 return (uint32_t)ret_conv;
14021 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
14022 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
14023 uint32_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14027 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
14028 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14029 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14030 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14031 return (uint32_t)ret_conv;
14034 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14035 LDKCVec_NetAddressZ _res_constr;
14036 _res_constr.datalen = _res->arr_len;
14037 if (_res_constr.datalen > 0)
14038 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14040 _res_constr.data = NULL;
14041 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
14042 for (size_t m = 0; m < _res_constr.datalen; m++) {
14043 uint32_t _res_conv_12 = _res_vals[m];
14044 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14045 CHECK_ACCESS(_res_conv_12_ptr);
14046 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14047 FREE((void*)_res_conv_12);
14048 _res_constr.data[m] = _res_conv_12_conv;
14050 CVec_NetAddressZ_free(_res_constr);
14053 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
14054 LDKNodeAnnouncementInfo o_conv;
14055 o_conv.inner = (void*)(o & (~1));
14056 o_conv.is_owned = (o & 1) || (o == 0);
14057 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14058 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14059 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14060 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14061 return (uint32_t)ret_conv;
14064 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
14065 LDKDecodeError e_conv;
14066 e_conv.inner = (void*)(e & (~1));
14067 e_conv.is_owned = (e & 1) || (e == 0);
14068 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14069 e_conv = DecodeError_clone(&e_conv);
14070 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14071 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14072 return (uint32_t)ret_conv;
14075 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
14076 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
14077 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14081 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
14082 if ((_res & 1) != 0) return;
14083 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14084 CHECK_ACCESS(_res_ptr);
14085 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14087 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14090 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14091 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14092 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14093 return (uint32_t)ret_conv;
14095 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14096 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
14097 uint32_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14101 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
14102 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14103 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14104 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14105 return (uint32_t)ret_conv;
14108 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
14109 LDKCVec_u64Z _res_constr;
14110 _res_constr.datalen = _res->arr_len;
14111 if (_res_constr.datalen > 0)
14112 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14114 _res_constr.data = NULL;
14115 int64_t* _res_vals = _res->elems /* XXX _res leaks */;
14116 for (size_t i = 0; i < _res_constr.datalen; i++) {
14117 int64_t _res_conv_8 = _res_vals[i];
14118 _res_constr.data[i] = _res_conv_8;
14120 CVec_u64Z_free(_res_constr);
14123 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
14124 LDKNodeInfo o_conv;
14125 o_conv.inner = (void*)(o & (~1));
14126 o_conv.is_owned = (o & 1) || (o == 0);
14127 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14128 o_conv = NodeInfo_clone(&o_conv);
14129 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14130 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14131 return (uint32_t)ret_conv;
14134 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
14135 LDKDecodeError e_conv;
14136 e_conv.inner = (void*)(e & (~1));
14137 e_conv.is_owned = (e & 1) || (e == 0);
14138 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14139 e_conv = DecodeError_clone(&e_conv);
14140 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14141 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14142 return (uint32_t)ret_conv;
14145 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
14146 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
14147 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14151 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
14152 if ((_res & 1) != 0) return;
14153 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14154 CHECK_ACCESS(_res_ptr);
14155 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14157 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14160 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14161 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14162 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14163 return (uint32_t)ret_conv;
14165 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14166 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
14167 uint32_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14171 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
14172 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14173 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14174 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14175 return (uint32_t)ret_conv;
14178 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
14179 LDKNetworkGraph o_conv;
14180 o_conv.inner = (void*)(o & (~1));
14181 o_conv.is_owned = (o & 1) || (o == 0);
14182 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14183 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14184 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14185 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14186 return (uint32_t)ret_conv;
14189 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
14190 LDKDecodeError e_conv;
14191 e_conv.inner = (void*)(e & (~1));
14192 e_conv.is_owned = (e & 1) || (e == 0);
14193 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14194 e_conv = DecodeError_clone(&e_conv);
14195 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14196 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14197 return (uint32_t)ret_conv;
14200 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
14201 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
14202 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14206 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
14207 if ((_res & 1) != 0) return;
14208 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14209 CHECK_ACCESS(_res_ptr);
14210 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14212 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14215 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
14216 LDKCVec_NetAddressZ o_constr;
14217 o_constr.datalen = o->arr_len;
14218 if (o_constr.datalen > 0)
14219 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14221 o_constr.data = NULL;
14222 uint32_t* o_vals = o->elems /* XXX o leaks */;
14223 for (size_t m = 0; m < o_constr.datalen; m++) {
14224 uint32_t o_conv_12 = o_vals[m];
14225 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
14226 CHECK_ACCESS(o_conv_12_ptr);
14227 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14228 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
14229 o_constr.data[m] = o_conv_12_conv;
14231 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14232 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14233 uint32_t ret_ref = (uintptr_t)ret_copy;
14237 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14238 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14239 *ret_copy = COption_CVec_NetAddressZZ_none();
14240 uint32_t ret_ref = (uintptr_t)ret_copy;
14244 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
14245 if ((_res & 1) != 0) return;
14246 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14247 CHECK_ACCESS(_res_ptr);
14248 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14250 COption_CVec_NetAddressZZ_free(_res_conv);
14253 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14254 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14255 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14256 uint32_t ret_ref = (uintptr_t)ret_copy;
14259 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
14260 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
14261 uint32_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14265 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
14266 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14267 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14268 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14269 uint32_t ret_ref = (uintptr_t)ret_copy;
14273 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14274 LDKDelayedPaymentOutputDescriptor o_conv;
14275 o_conv.inner = (void*)(o & (~1));
14276 o_conv.is_owned = (o & 1) || (o == 0);
14277 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14278 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14279 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14280 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14281 return (uint32_t)ret_conv;
14284 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14285 LDKDecodeError e_conv;
14286 e_conv.inner = (void*)(e & (~1));
14287 e_conv.is_owned = (e & 1) || (e == 0);
14288 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14289 e_conv = DecodeError_clone(&e_conv);
14290 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14291 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14292 return (uint32_t)ret_conv;
14295 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14296 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14297 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14301 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14302 if ((_res & 1) != 0) return;
14303 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14304 CHECK_ACCESS(_res_ptr);
14305 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14307 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14310 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14311 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14312 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14313 return (uint32_t)ret_conv;
14315 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14316 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14317 uint32_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14321 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14322 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14323 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14324 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14325 return (uint32_t)ret_conv;
14328 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14329 LDKStaticPaymentOutputDescriptor o_conv;
14330 o_conv.inner = (void*)(o & (~1));
14331 o_conv.is_owned = (o & 1) || (o == 0);
14332 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14333 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14334 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14335 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14336 return (uint32_t)ret_conv;
14339 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14340 LDKDecodeError e_conv;
14341 e_conv.inner = (void*)(e & (~1));
14342 e_conv.is_owned = (e & 1) || (e == 0);
14343 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14344 e_conv = DecodeError_clone(&e_conv);
14345 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14346 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14347 return (uint32_t)ret_conv;
14350 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14351 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14352 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14356 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14357 if ((_res & 1) != 0) return;
14358 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14359 CHECK_ACCESS(_res_ptr);
14360 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14362 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14365 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14366 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14367 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14368 return (uint32_t)ret_conv;
14370 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14371 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14372 uint32_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14376 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14377 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14378 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14379 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14380 return (uint32_t)ret_conv;
14383 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14384 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14385 CHECK_ACCESS(o_ptr);
14386 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14387 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
14388 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14389 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14390 return (uint32_t)ret_conv;
14393 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14394 LDKDecodeError e_conv;
14395 e_conv.inner = (void*)(e & (~1));
14396 e_conv.is_owned = (e & 1) || (e == 0);
14397 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14398 e_conv = DecodeError_clone(&e_conv);
14399 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14400 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14401 return (uint32_t)ret_conv;
14404 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14405 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
14406 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14410 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_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 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14416 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14419 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14420 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14421 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14422 return (uint32_t)ret_conv;
14424 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14425 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14426 uint32_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14430 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14431 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14432 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14433 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14434 return (uint32_t)ret_conv;
14437 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14438 LDKCVec_PaymentPreimageZ _res_constr;
14439 _res_constr.datalen = _res->arr_len;
14440 if (_res_constr.datalen > 0)
14441 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14443 _res_constr.data = NULL;
14444 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
14445 for (size_t m = 0; m < _res_constr.datalen; m++) {
14446 int8_tArray _res_conv_12 = _res_vals[m];
14447 LDKThirtyTwoBytes _res_conv_12_ref;
14448 CHECK(_res_conv_12->arr_len == 32);
14449 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14450 _res_constr.data[m] = _res_conv_12_ref;
14452 CVec_PaymentPreimageZ_free(_res_constr);
14455 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14456 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14457 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14458 return ((uint32_t)ret_conv);
14460 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
14461 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14462 uint32_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14466 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
14467 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14468 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14469 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14470 return ((uint32_t)ret_conv);
14473 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14474 LDKSignature a_ref;
14475 CHECK(a->arr_len == 64);
14476 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14477 LDKCVec_SignatureZ b_constr;
14478 b_constr.datalen = b->arr_len;
14479 if (b_constr.datalen > 0)
14480 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14482 b_constr.data = NULL;
14483 int8_tArray* b_vals = (void*) b->elems /* XXX b leaks */;
14484 for (size_t m = 0; m < b_constr.datalen; m++) {
14485 int8_tArray b_conv_12 = b_vals[m];
14486 LDKSignature b_conv_12_ref;
14487 CHECK(b_conv_12->arr_len == 64);
14488 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
14489 b_constr.data[m] = b_conv_12_ref;
14491 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14492 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14493 return ((uint32_t)ret_conv);
14496 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
14497 if ((_res & 1) != 0) return;
14498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14499 CHECK_ACCESS(_res_ptr);
14500 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14502 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14505 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
14506 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14507 CHECK_ACCESS(o_ptr);
14508 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14509 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
14510 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14511 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14512 return (uint32_t)ret_conv;
14515 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14516 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14517 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14518 return (uint32_t)ret_conv;
14521 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
14522 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14523 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14527 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
14528 if ((_res & 1) != 0) return;
14529 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14530 CHECK_ACCESS(_res_ptr);
14531 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14533 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14536 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14537 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14538 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14539 return (uint32_t)ret_conv;
14541 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
14542 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14543 uint32_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14547 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
14548 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14549 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14550 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14551 return (uint32_t)ret_conv;
14554 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14555 LDKSignature o_ref;
14556 CHECK(o->arr_len == 64);
14557 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
14558 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14559 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14560 return (uint32_t)ret_conv;
14563 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
14564 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14565 *ret_conv = CResult_SignatureNoneZ_err();
14566 return (uint32_t)ret_conv;
14569 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
14570 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14571 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
14575 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
14576 if ((_res & 1) != 0) return;
14577 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14578 CHECK_ACCESS(_res_ptr);
14579 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14581 CResult_SignatureNoneZ_free(_res_conv);
14584 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14585 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14586 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14587 return (uint32_t)ret_conv;
14589 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
14590 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14591 uint32_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14595 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
14596 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14597 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14598 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14599 return (uint32_t)ret_conv;
14602 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
14603 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14604 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
14605 return ((uint32_t)ret_conv);
14607 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
14608 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
14609 uint32_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
14613 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
14614 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
14615 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14616 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
14617 return ((uint32_t)ret_conv);
14620 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
14621 LDKSignature a_ref;
14622 CHECK(a->arr_len == 64);
14623 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14624 LDKSignature b_ref;
14625 CHECK(b->arr_len == 64);
14626 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
14627 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14628 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
14629 return ((uint32_t)ret_conv);
14632 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
14633 if ((_res & 1) != 0) return;
14634 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14635 CHECK_ACCESS(_res_ptr);
14636 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
14638 C2Tuple_SignatureSignatureZ_free(_res_conv);
14641 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
14642 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14643 CHECK_ACCESS(o_ptr);
14644 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
14645 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
14646 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14647 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
14648 return (uint32_t)ret_conv;
14651 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
14652 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14653 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
14654 return (uint32_t)ret_conv;
14657 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
14658 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
14659 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
14663 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
14664 if ((_res & 1) != 0) return;
14665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14666 CHECK_ACCESS(_res_ptr);
14667 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
14669 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
14672 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
14673 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14674 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
14675 return (uint32_t)ret_conv;
14677 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
14678 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
14679 uint32_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
14683 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
14684 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
14685 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14686 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
14687 return (uint32_t)ret_conv;
14690 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
14691 LDKSecretKey o_ref;
14692 CHECK(o->arr_len == 32);
14693 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
14694 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14695 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
14696 return (uint32_t)ret_conv;
14699 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
14700 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14701 *ret_conv = CResult_SecretKeyNoneZ_err();
14702 return (uint32_t)ret_conv;
14705 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
14706 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
14707 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
14711 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
14712 if ((_res & 1) != 0) return;
14713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14714 CHECK_ACCESS(_res_ptr);
14715 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
14717 CResult_SecretKeyNoneZ_free(_res_conv);
14720 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
14721 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14722 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
14723 return (uint32_t)ret_conv;
14725 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
14726 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
14727 uint32_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
14731 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
14732 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
14733 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14734 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
14735 return (uint32_t)ret_conv;
14738 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
14739 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14740 CHECK_ACCESS(o_ptr);
14741 LDKSign o_conv = *(LDKSign*)(o_ptr);
14742 if (o_conv.free == LDKSign_JCalls_free) {
14743 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14744 LDKSign_JCalls_cloned(&o_conv);
14746 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14747 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14748 return (uint32_t)ret_conv;
14751 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
14752 LDKDecodeError e_conv;
14753 e_conv.inner = (void*)(e & (~1));
14754 e_conv.is_owned = (e & 1) || (e == 0);
14755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14756 e_conv = DecodeError_clone(&e_conv);
14757 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14758 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14759 return (uint32_t)ret_conv;
14762 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
14763 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14764 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
14768 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
14769 if ((_res & 1) != 0) return;
14770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14771 CHECK_ACCESS(_res_ptr);
14772 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14774 CResult_SignDecodeErrorZ_free(_res_conv);
14777 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14778 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14779 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14780 return (uint32_t)ret_conv;
14782 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
14783 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14784 uint32_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14788 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
14789 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14790 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14791 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14792 return (uint32_t)ret_conv;
14795 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
14796 LDKCVec_u5Z _res_constr;
14797 _res_constr.datalen = _res->arr_len;
14798 if (_res_constr.datalen > 0)
14799 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
14801 _res_constr.data = NULL;
14802 int8_t* _res_vals = (void*) _res->elems /* XXX _res leaks */;
14803 for (size_t h = 0; h < _res_constr.datalen; h++) {
14804 int8_t _res_conv_7 = _res_vals[h];
14806 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
14808 CVec_u5Z_free(_res_constr);
14811 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
14812 LDKRecoverableSignature o_ref;
14813 CHECK(o->arr_len == 68);
14814 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
14815 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14816 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
14817 return (uint32_t)ret_conv;
14820 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14821 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14822 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14823 return (uint32_t)ret_conv;
14826 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
14827 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14828 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14832 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_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_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14838 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14841 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14842 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14843 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14844 return (uint32_t)ret_conv;
14846 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
14847 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14848 uint32_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14852 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
14853 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14854 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14855 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14856 return (uint32_t)ret_conv;
14859 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14860 LDKCVec_u8Z _res_ref;
14861 _res_ref.datalen = _res->arr_len;
14862 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14863 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14864 CVec_u8Z_free(_res_ref);
14867 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
14868 LDKCVec_CVec_u8ZZ _res_constr;
14869 _res_constr.datalen = _res->arr_len;
14870 if (_res_constr.datalen > 0)
14871 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14873 _res_constr.data = NULL;
14874 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
14875 for (size_t m = 0; m < _res_constr.datalen; m++) {
14876 int8_tArray _res_conv_12 = _res_vals[m];
14877 LDKCVec_u8Z _res_conv_12_ref;
14878 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
14879 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14880 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
14881 _res_constr.data[m] = _res_conv_12_ref;
14883 CVec_CVec_u8ZZ_free(_res_constr);
14886 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
14887 LDKCVec_CVec_u8ZZ o_constr;
14888 o_constr.datalen = o->arr_len;
14889 if (o_constr.datalen > 0)
14890 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14892 o_constr.data = NULL;
14893 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
14894 for (size_t m = 0; m < o_constr.datalen; m++) {
14895 int8_tArray o_conv_12 = o_vals[m];
14896 LDKCVec_u8Z o_conv_12_ref;
14897 o_conv_12_ref.datalen = o_conv_12->arr_len;
14898 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14899 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
14900 o_constr.data[m] = o_conv_12_ref;
14902 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14903 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14904 return (uint32_t)ret_conv;
14907 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
14908 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14909 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14910 return (uint32_t)ret_conv;
14913 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
14914 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
14915 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14919 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
14920 if ((_res & 1) != 0) return;
14921 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14922 CHECK_ACCESS(_res_ptr);
14923 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14925 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14928 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14929 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14930 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14931 return (uint32_t)ret_conv;
14933 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
14934 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
14935 uint32_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14939 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
14940 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
14941 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14942 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14943 return (uint32_t)ret_conv;
14946 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
14947 LDKInMemorySigner o_conv;
14948 o_conv.inner = (void*)(o & (~1));
14949 o_conv.is_owned = (o & 1) || (o == 0);
14950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14951 o_conv = InMemorySigner_clone(&o_conv);
14952 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14953 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
14954 return (uint32_t)ret_conv;
14957 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
14958 LDKDecodeError e_conv;
14959 e_conv.inner = (void*)(e & (~1));
14960 e_conv.is_owned = (e & 1) || (e == 0);
14961 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14962 e_conv = DecodeError_clone(&e_conv);
14963 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14964 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
14965 return (uint32_t)ret_conv;
14968 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
14969 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
14970 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
14974 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
14975 if ((_res & 1) != 0) return;
14976 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14977 CHECK_ACCESS(_res_ptr);
14978 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
14980 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
14983 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
14984 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14985 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
14986 return (uint32_t)ret_conv;
14988 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
14989 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
14990 uint32_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
14994 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
14995 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
14996 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14997 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
14998 return (uint32_t)ret_conv;
15001 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15002 LDKCVec_TxOutZ _res_constr;
15003 _res_constr.datalen = _res->arr_len;
15004 if (_res_constr.datalen > 0)
15005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15007 _res_constr.data = NULL;
15008 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15009 for (size_t h = 0; h < _res_constr.datalen; h++) {
15010 uint32_t _res_conv_7 = _res_vals[h];
15011 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15012 CHECK_ACCESS(_res_conv_7_ptr);
15013 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15014 FREE((void*)_res_conv_7);
15015 _res_constr.data[h] = _res_conv_7_conv;
15017 CVec_TxOutZ_free(_res_constr);
15020 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15021 LDKTransaction o_ref;
15022 o_ref.datalen = o->arr_len;
15023 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15024 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15025 o_ref.data_is_owned = true;
15026 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15027 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15028 return (uint32_t)ret_conv;
15031 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15032 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15033 *ret_conv = CResult_TransactionNoneZ_err();
15034 return (uint32_t)ret_conv;
15037 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15038 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15039 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15043 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15044 if ((_res & 1) != 0) return;
15045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15046 CHECK_ACCESS(_res_ptr);
15047 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15049 CResult_TransactionNoneZ_free(_res_conv);
15052 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15053 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15054 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15055 return (uint32_t)ret_conv;
15057 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15058 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15059 uint32_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15063 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15064 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15065 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15066 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15067 return (uint32_t)ret_conv;
15070 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15071 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15072 *ret_copy = COption_u16Z_some(o);
15073 uint32_t ret_ref = (uintptr_t)ret_copy;
15077 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15078 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15079 *ret_copy = COption_u16Z_none();
15080 uint32_t ret_ref = (uintptr_t)ret_copy;
15084 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15085 if ((_res & 1) != 0) return;
15086 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15087 CHECK_ACCESS(_res_ptr);
15088 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15090 COption_u16Z_free(_res_conv);
15093 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15094 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15095 *ret_copy = COption_u16Z_clone(arg);
15096 uint32_t ret_ref = (uintptr_t)ret_copy;
15099 uint32_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15100 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15101 uint32_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15105 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15106 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15107 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15108 *ret_copy = COption_u16Z_clone(orig_conv);
15109 uint32_t ret_ref = (uintptr_t)ret_copy;
15113 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15114 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15115 *ret_conv = CResult_NoneAPIErrorZ_ok();
15116 return (uint32_t)ret_conv;
15119 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15120 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15121 CHECK_ACCESS(e_ptr);
15122 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15123 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15124 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15125 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15126 return (uint32_t)ret_conv;
15129 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15130 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15131 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15135 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15136 if ((_res & 1) != 0) return;
15137 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15138 CHECK_ACCESS(_res_ptr);
15139 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15141 CResult_NoneAPIErrorZ_free(_res_conv);
15144 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15145 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15146 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15147 return (uint32_t)ret_conv;
15149 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15150 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15151 uint32_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15155 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15156 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15157 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15158 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15159 return (uint32_t)ret_conv;
15162 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15163 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15164 _res_constr.datalen = _res->arr_len;
15165 if (_res_constr.datalen > 0)
15166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15168 _res_constr.data = NULL;
15169 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15170 for (size_t w = 0; w < _res_constr.datalen; w++) {
15171 uint32_t _res_conv_22 = _res_vals[w];
15172 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
15173 CHECK_ACCESS(_res_conv_22_ptr);
15174 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15175 FREE((void*)_res_conv_22);
15176 _res_constr.data[w] = _res_conv_22_conv;
15178 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15181 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15182 LDKCVec_APIErrorZ _res_constr;
15183 _res_constr.datalen = _res->arr_len;
15184 if (_res_constr.datalen > 0)
15185 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15187 _res_constr.data = NULL;
15188 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15189 for (size_t k = 0; k < _res_constr.datalen; k++) {
15190 uint32_t _res_conv_10 = _res_vals[k];
15191 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
15192 CHECK_ACCESS(_res_conv_10_ptr);
15193 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15194 FREE((void*)_res_conv_10);
15195 _res_constr.data[k] = _res_conv_10_conv;
15197 CVec_APIErrorZ_free(_res_constr);
15200 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15201 LDKThirtyTwoBytes o_ref;
15202 CHECK(o->arr_len == 32);
15203 memcpy(o_ref.data, o->elems, 32); FREE(o);
15204 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15205 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15206 return (uint32_t)ret_conv;
15209 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15210 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15211 CHECK_ACCESS(e_ptr);
15212 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15213 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15214 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15215 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15216 return (uint32_t)ret_conv;
15219 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15220 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15221 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15225 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15226 if ((_res & 1) != 0) return;
15227 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15228 CHECK_ACCESS(_res_ptr);
15229 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15231 CResult__u832APIErrorZ_free(_res_conv);
15234 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15235 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15236 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15237 return (uint32_t)ret_conv;
15239 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15240 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15241 uint32_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15245 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15246 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15247 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15248 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15249 return (uint32_t)ret_conv;
15252 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15253 LDKThirtyTwoBytes o_ref;
15254 CHECK(o->arr_len == 32);
15255 memcpy(o_ref.data, o->elems, 32); FREE(o);
15256 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15257 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15258 return (uint32_t)ret_conv;
15261 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15262 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15263 CHECK_ACCESS(e_ptr);
15264 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15265 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15266 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15267 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15268 return (uint32_t)ret_conv;
15271 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15272 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15273 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15277 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15278 if ((_res & 1) != 0) return;
15279 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15280 CHECK_ACCESS(_res_ptr);
15281 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15283 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15286 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15287 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15288 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15289 return (uint32_t)ret_conv;
15291 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15292 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15293 uint32_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15297 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15298 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15299 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15300 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15301 return (uint32_t)ret_conv;
15304 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15305 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15306 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15307 return (uint32_t)ret_conv;
15310 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15311 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15312 CHECK_ACCESS(e_ptr);
15313 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15314 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15315 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15316 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15317 return (uint32_t)ret_conv;
15320 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15321 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15322 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15326 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15327 if ((_res & 1) != 0) return;
15328 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15329 CHECK_ACCESS(_res_ptr);
15330 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15332 CResult_NonePaymentSendFailureZ_free(_res_conv);
15335 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15336 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15337 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15338 return (uint32_t)ret_conv;
15340 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15341 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15342 uint32_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15346 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15347 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15348 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15349 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15350 return (uint32_t)ret_conv;
15353 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15354 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15355 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15356 return ((uint32_t)ret_conv);
15358 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15359 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15360 uint32_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15364 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15365 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15366 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15367 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15368 return ((uint32_t)ret_conv);
15371 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15372 LDKThirtyTwoBytes a_ref;
15373 CHECK(a->arr_len == 32);
15374 memcpy(a_ref.data, a->elems, 32); FREE(a);
15375 LDKThirtyTwoBytes b_ref;
15376 CHECK(b->arr_len == 32);
15377 memcpy(b_ref.data, b->elems, 32); FREE(b);
15378 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15379 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15380 return ((uint32_t)ret_conv);
15383 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15384 if ((_res & 1) != 0) return;
15385 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15386 CHECK_ACCESS(_res_ptr);
15387 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15389 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15392 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15393 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15394 CHECK_ACCESS(o_ptr);
15395 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15396 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
15397 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15398 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15399 return (uint32_t)ret_conv;
15402 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15403 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15404 CHECK_ACCESS(e_ptr);
15405 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15406 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15407 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15408 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15409 return (uint32_t)ret_conv;
15412 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15413 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15414 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15418 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15419 if ((_res & 1) != 0) return;
15420 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15421 CHECK_ACCESS(_res_ptr);
15422 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15424 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15427 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15428 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15429 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15430 return (uint32_t)ret_conv;
15432 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15433 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15434 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15438 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15439 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15440 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15441 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15442 return (uint32_t)ret_conv;
15445 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15446 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15447 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15448 return ((uint32_t)ret_conv);
15450 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15451 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15452 uint32_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15456 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15457 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15458 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15459 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15460 return ((uint32_t)ret_conv);
15463 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15464 LDKThirtyTwoBytes a_ref;
15465 CHECK(a->arr_len == 32);
15466 memcpy(a_ref.data, a->elems, 32); FREE(a);
15467 LDKThirtyTwoBytes b_ref;
15468 CHECK(b->arr_len == 32);
15469 memcpy(b_ref.data, b->elems, 32); FREE(b);
15470 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15471 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15472 return ((uint32_t)ret_conv);
15475 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15476 if ((_res & 1) != 0) return;
15477 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15478 CHECK_ACCESS(_res_ptr);
15479 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15481 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15484 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
15485 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15486 CHECK_ACCESS(o_ptr);
15487 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15488 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15489 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15490 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15491 return (uint32_t)ret_conv;
15494 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15495 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15496 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15497 return (uint32_t)ret_conv;
15500 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
15501 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15502 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15506 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
15507 if ((_res & 1) != 0) return;
15508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15509 CHECK_ACCESS(_res_ptr);
15510 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15512 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15515 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15516 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15517 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15518 return (uint32_t)ret_conv;
15520 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
15521 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15522 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15526 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
15527 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15528 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15529 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15530 return (uint32_t)ret_conv;
15533 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
15534 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15535 CHECK_ACCESS(o_ptr);
15536 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15537 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15538 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15539 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15540 return (uint32_t)ret_conv;
15543 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
15544 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15545 CHECK_ACCESS(e_ptr);
15546 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15547 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15548 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15549 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15550 return (uint32_t)ret_conv;
15553 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
15554 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15555 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15559 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
15560 if ((_res & 1) != 0) return;
15561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15562 CHECK_ACCESS(_res_ptr);
15563 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15565 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15568 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15569 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15570 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15571 return (uint32_t)ret_conv;
15573 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
15574 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15575 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15579 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
15580 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15581 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15582 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15583 return (uint32_t)ret_conv;
15586 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15587 LDKThirtyTwoBytes o_ref;
15588 CHECK(o->arr_len == 32);
15589 memcpy(o_ref.data, o->elems, 32); FREE(o);
15590 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15591 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15592 return (uint32_t)ret_conv;
15595 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
15596 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15597 *ret_conv = CResult_PaymentSecretNoneZ_err();
15598 return (uint32_t)ret_conv;
15601 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
15602 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15603 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15607 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
15608 if ((_res & 1) != 0) return;
15609 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15610 CHECK_ACCESS(_res_ptr);
15611 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15613 CResult_PaymentSecretNoneZ_free(_res_conv);
15616 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15617 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15618 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15619 return (uint32_t)ret_conv;
15621 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
15622 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15623 uint32_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15627 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
15628 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15629 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15630 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15631 return (uint32_t)ret_conv;
15634 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15635 LDKThirtyTwoBytes o_ref;
15636 CHECK(o->arr_len == 32);
15637 memcpy(o_ref.data, o->elems, 32); FREE(o);
15638 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15639 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15640 return (uint32_t)ret_conv;
15643 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
15644 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15645 CHECK_ACCESS(e_ptr);
15646 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15647 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15648 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15649 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15650 return (uint32_t)ret_conv;
15653 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
15654 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15655 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15659 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
15660 if ((_res & 1) != 0) return;
15661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15662 CHECK_ACCESS(_res_ptr);
15663 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15665 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15668 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15669 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15670 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15671 return (uint32_t)ret_conv;
15673 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
15674 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15675 uint32_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15679 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
15680 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15681 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15682 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15683 return (uint32_t)ret_conv;
15686 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15687 LDKThirtyTwoBytes o_ref;
15688 CHECK(o->arr_len == 32);
15689 memcpy(o_ref.data, o->elems, 32); FREE(o);
15690 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15691 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15692 return (uint32_t)ret_conv;
15695 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
15696 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15697 CHECK_ACCESS(e_ptr);
15698 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15699 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15700 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15701 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15702 return (uint32_t)ret_conv;
15705 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
15706 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15707 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15711 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
15712 if ((_res & 1) != 0) return;
15713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15714 CHECK_ACCESS(_res_ptr);
15715 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15717 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15720 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15721 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15722 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15723 return (uint32_t)ret_conv;
15725 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
15726 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15727 uint32_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15731 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
15732 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15733 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15734 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15735 return (uint32_t)ret_conv;
15738 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
15739 LDKCounterpartyForwardingInfo o_conv;
15740 o_conv.inner = (void*)(o & (~1));
15741 o_conv.is_owned = (o & 1) || (o == 0);
15742 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15743 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
15744 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15745 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
15746 return (uint32_t)ret_conv;
15749 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
15750 LDKDecodeError e_conv;
15751 e_conv.inner = (void*)(e & (~1));
15752 e_conv.is_owned = (e & 1) || (e == 0);
15753 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15754 e_conv = DecodeError_clone(&e_conv);
15755 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15756 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
15757 return (uint32_t)ret_conv;
15760 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
15761 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
15762 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
15766 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
15767 if ((_res & 1) != 0) return;
15768 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15769 CHECK_ACCESS(_res_ptr);
15770 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
15772 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
15775 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
15776 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15777 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
15778 return (uint32_t)ret_conv;
15780 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
15781 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
15782 uint32_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
15786 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
15787 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
15788 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15789 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
15790 return (uint32_t)ret_conv;
15793 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
15794 LDKChannelCounterparty o_conv;
15795 o_conv.inner = (void*)(o & (~1));
15796 o_conv.is_owned = (o & 1) || (o == 0);
15797 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15798 o_conv = ChannelCounterparty_clone(&o_conv);
15799 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15800 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
15801 return (uint32_t)ret_conv;
15804 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
15805 LDKDecodeError e_conv;
15806 e_conv.inner = (void*)(e & (~1));
15807 e_conv.is_owned = (e & 1) || (e == 0);
15808 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15809 e_conv = DecodeError_clone(&e_conv);
15810 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15811 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
15812 return (uint32_t)ret_conv;
15815 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
15816 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
15817 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
15821 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
15822 if ((_res & 1) != 0) return;
15823 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15824 CHECK_ACCESS(_res_ptr);
15825 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
15827 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
15830 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
15831 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15832 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
15833 return (uint32_t)ret_conv;
15835 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
15836 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
15837 uint32_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
15841 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
15842 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
15843 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15844 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
15845 return (uint32_t)ret_conv;
15848 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
15849 LDKChannelDetails o_conv;
15850 o_conv.inner = (void*)(o & (~1));
15851 o_conv.is_owned = (o & 1) || (o == 0);
15852 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15853 o_conv = ChannelDetails_clone(&o_conv);
15854 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15855 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
15856 return (uint32_t)ret_conv;
15859 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
15860 LDKDecodeError e_conv;
15861 e_conv.inner = (void*)(e & (~1));
15862 e_conv.is_owned = (e & 1) || (e == 0);
15863 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15864 e_conv = DecodeError_clone(&e_conv);
15865 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15866 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
15867 return (uint32_t)ret_conv;
15870 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
15871 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
15872 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
15876 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
15877 if ((_res & 1) != 0) return;
15878 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15879 CHECK_ACCESS(_res_ptr);
15880 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
15882 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
15885 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
15886 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15887 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
15888 return (uint32_t)ret_conv;
15890 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
15891 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
15892 uint32_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
15896 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
15897 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
15898 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15899 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
15900 return (uint32_t)ret_conv;
15903 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
15904 LDKPhantomRouteHints o_conv;
15905 o_conv.inner = (void*)(o & (~1));
15906 o_conv.is_owned = (o & 1) || (o == 0);
15907 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15908 o_conv = PhantomRouteHints_clone(&o_conv);
15909 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15910 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
15911 return (uint32_t)ret_conv;
15914 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
15915 LDKDecodeError e_conv;
15916 e_conv.inner = (void*)(e & (~1));
15917 e_conv.is_owned = (e & 1) || (e == 0);
15918 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15919 e_conv = DecodeError_clone(&e_conv);
15920 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15921 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
15922 return (uint32_t)ret_conv;
15925 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
15926 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
15927 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
15931 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
15932 if ((_res & 1) != 0) return;
15933 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15934 CHECK_ACCESS(_res_ptr);
15935 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
15937 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
15940 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
15941 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15942 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
15943 return (uint32_t)ret_conv;
15945 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
15946 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
15947 uint32_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
15951 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
15952 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
15953 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15954 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
15955 return (uint32_t)ret_conv;
15958 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
15959 LDKCVec_ChannelMonitorZ _res_constr;
15960 _res_constr.datalen = _res->arr_len;
15961 if (_res_constr.datalen > 0)
15962 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15964 _res_constr.data = NULL;
15965 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15966 for (size_t q = 0; q < _res_constr.datalen; q++) {
15967 uint32_t _res_conv_16 = _res_vals[q];
15968 LDKChannelMonitor _res_conv_16_conv;
15969 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15970 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15971 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15972 _res_constr.data[q] = _res_conv_16_conv;
15974 CVec_ChannelMonitorZ_free(_res_constr);
15977 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
15978 LDKThirtyTwoBytes a_ref;
15979 CHECK(a->arr_len == 32);
15980 memcpy(a_ref.data, a->elems, 32); FREE(a);
15981 LDKChannelManager b_conv;
15982 b_conv.inner = (void*)(b & (~1));
15983 b_conv.is_owned = (b & 1) || (b == 0);
15984 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15985 // WARNING: we need a move here but no clone is available for LDKChannelManager
15986 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15987 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15988 return ((uint32_t)ret_conv);
15991 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
15992 if ((_res & 1) != 0) return;
15993 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15994 CHECK_ACCESS(_res_ptr);
15995 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15997 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16000 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16001 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16002 CHECK_ACCESS(o_ptr);
16003 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16004 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16005 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16006 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16007 return (uint32_t)ret_conv;
16010 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16011 LDKDecodeError e_conv;
16012 e_conv.inner = (void*)(e & (~1));
16013 e_conv.is_owned = (e & 1) || (e == 0);
16014 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16015 e_conv = DecodeError_clone(&e_conv);
16016 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16017 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16018 return (uint32_t)ret_conv;
16021 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16022 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16023 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16027 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16028 if ((_res & 1) != 0) return;
16029 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16030 CHECK_ACCESS(_res_ptr);
16031 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16033 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16036 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
16037 LDKChannelConfig o_conv;
16038 o_conv.inner = (void*)(o & (~1));
16039 o_conv.is_owned = (o & 1) || (o == 0);
16040 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16041 o_conv = ChannelConfig_clone(&o_conv);
16042 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16043 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16044 return (uint32_t)ret_conv;
16047 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
16048 LDKDecodeError e_conv;
16049 e_conv.inner = (void*)(e & (~1));
16050 e_conv.is_owned = (e & 1) || (e == 0);
16051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16052 e_conv = DecodeError_clone(&e_conv);
16053 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16054 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16055 return (uint32_t)ret_conv;
16058 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
16059 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
16060 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16064 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
16065 if ((_res & 1) != 0) return;
16066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16067 CHECK_ACCESS(_res_ptr);
16068 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16070 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16073 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16074 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16075 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16076 return (uint32_t)ret_conv;
16078 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
16079 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
16080 uint32_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16084 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
16085 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
16086 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16087 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16088 return (uint32_t)ret_conv;
16091 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
16092 LDKOutPoint o_conv;
16093 o_conv.inner = (void*)(o & (~1));
16094 o_conv.is_owned = (o & 1) || (o == 0);
16095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16096 o_conv = OutPoint_clone(&o_conv);
16097 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16098 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16099 return (uint32_t)ret_conv;
16102 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
16103 LDKDecodeError e_conv;
16104 e_conv.inner = (void*)(e & (~1));
16105 e_conv.is_owned = (e & 1) || (e == 0);
16106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16107 e_conv = DecodeError_clone(&e_conv);
16108 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16109 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16110 return (uint32_t)ret_conv;
16113 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
16114 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
16115 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16119 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
16120 if ((_res & 1) != 0) return;
16121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16122 CHECK_ACCESS(_res_ptr);
16123 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16125 CResult_OutPointDecodeErrorZ_free(_res_conv);
16128 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16129 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16130 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16131 return (uint32_t)ret_conv;
16133 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
16134 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
16135 uint32_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16139 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
16140 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
16141 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16142 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16143 return (uint32_t)ret_conv;
16146 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
16147 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16148 CHECK_ACCESS(o_ptr);
16149 LDKType o_conv = *(LDKType*)(o_ptr);
16150 if (o_conv.free == LDKType_JCalls_free) {
16151 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16152 LDKType_JCalls_cloned(&o_conv);
16154 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16155 *ret_copy = COption_TypeZ_some(o_conv);
16156 uint32_t ret_ref = (uintptr_t)ret_copy;
16160 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16161 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16162 *ret_copy = COption_TypeZ_none();
16163 uint32_t ret_ref = (uintptr_t)ret_copy;
16167 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
16168 if ((_res & 1) != 0) return;
16169 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16170 CHECK_ACCESS(_res_ptr);
16171 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16173 COption_TypeZ_free(_res_conv);
16176 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16177 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16178 *ret_copy = COption_TypeZ_clone(arg);
16179 uint32_t ret_ref = (uintptr_t)ret_copy;
16182 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
16183 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
16184 uint32_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16188 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
16189 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
16190 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16191 *ret_copy = COption_TypeZ_clone(orig_conv);
16192 uint32_t ret_ref = (uintptr_t)ret_copy;
16196 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
16197 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16198 CHECK_ACCESS(o_ptr);
16199 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16200 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
16201 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16202 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16203 return (uint32_t)ret_conv;
16206 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
16207 LDKDecodeError e_conv;
16208 e_conv.inner = (void*)(e & (~1));
16209 e_conv.is_owned = (e & 1) || (e == 0);
16210 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16211 e_conv = DecodeError_clone(&e_conv);
16212 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16213 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16214 return (uint32_t)ret_conv;
16217 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
16218 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
16219 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16223 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
16224 if ((_res & 1) != 0) return;
16225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16226 CHECK_ACCESS(_res_ptr);
16227 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16229 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16232 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16233 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16234 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16235 return (uint32_t)ret_conv;
16237 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
16238 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
16239 uint32_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16243 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
16244 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
16245 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16246 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16247 return (uint32_t)ret_conv;
16250 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16251 LDKThirtyTwoBytes o_ref;
16252 CHECK(o->arr_len == 32);
16253 memcpy(o_ref.data, o->elems, 32); FREE(o);
16254 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16255 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16256 return (uint32_t)ret_conv;
16259 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
16260 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16261 CHECK_ACCESS(e_ptr);
16262 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16263 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
16264 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16265 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16266 return (uint32_t)ret_conv;
16269 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
16270 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
16271 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16275 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
16276 if ((_res & 1) != 0) return;
16277 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16278 CHECK_ACCESS(_res_ptr);
16279 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16281 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16284 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16285 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16286 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16287 return (uint32_t)ret_conv;
16289 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
16290 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
16291 uint32_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16295 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
16296 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
16297 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16298 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16299 return (uint32_t)ret_conv;
16302 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
16303 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
16304 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16305 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
16306 return (uint32_t)ret_conv;
16309 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint32_t e) {
16310 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16311 CHECK_ACCESS(e_ptr);
16312 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16313 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16314 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16315 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
16316 return (uint32_t)ret_conv;
16319 jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint32_t o) {
16320 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
16321 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
16325 void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint32_t _res) {
16326 if ((_res & 1) != 0) return;
16327 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16328 CHECK_ACCESS(_res_ptr);
16329 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
16331 CResult_SiPrefixParseErrorZ_free(_res_conv);
16334 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
16335 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16336 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
16337 return (uint32_t)ret_conv;
16339 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint32_t arg) {
16340 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
16341 uint32_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
16345 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint32_t orig) {
16346 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
16347 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16348 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
16349 return (uint32_t)ret_conv;
16352 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint32_t o) {
16354 o_conv.inner = (void*)(o & (~1));
16355 o_conv.is_owned = (o & 1) || (o == 0);
16356 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16357 o_conv = Invoice_clone(&o_conv);
16358 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16359 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
16360 return (uint32_t)ret_conv;
16363 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint32_t e) {
16364 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16365 CHECK_ACCESS(e_ptr);
16366 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
16367 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
16368 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16369 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
16370 return (uint32_t)ret_conv;
16373 jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint32_t o) {
16374 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
16375 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
16379 void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint32_t _res) {
16380 if ((_res & 1) != 0) return;
16381 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16382 CHECK_ACCESS(_res_ptr);
16383 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
16385 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
16388 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
16389 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16390 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
16391 return (uint32_t)ret_conv;
16393 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint32_t arg) {
16394 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
16395 uint32_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
16399 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint32_t orig) {
16400 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
16401 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16402 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
16403 return (uint32_t)ret_conv;
16406 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint32_t o) {
16407 LDKSignedRawInvoice o_conv;
16408 o_conv.inner = (void*)(o & (~1));
16409 o_conv.is_owned = (o & 1) || (o == 0);
16410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16411 o_conv = SignedRawInvoice_clone(&o_conv);
16412 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16413 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
16414 return (uint32_t)ret_conv;
16417 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint32_t e) {
16418 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16419 CHECK_ACCESS(e_ptr);
16420 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16421 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16422 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16423 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
16424 return (uint32_t)ret_conv;
16427 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint32_t o) {
16428 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
16429 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
16433 void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint32_t _res) {
16434 if ((_res & 1) != 0) return;
16435 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16436 CHECK_ACCESS(_res_ptr);
16437 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
16439 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
16442 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
16443 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16444 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
16445 return (uint32_t)ret_conv;
16447 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint32_t arg) {
16448 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
16449 uint32_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
16453 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint32_t orig) {
16454 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
16455 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16456 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
16457 return (uint32_t)ret_conv;
16460 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
16461 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16462 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
16463 return ((uint32_t)ret_conv);
16465 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
16466 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
16467 uint32_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
16471 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
16472 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
16473 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16474 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
16475 return ((uint32_t)ret_conv);
16478 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
16479 LDKRawInvoice a_conv;
16480 a_conv.inner = (void*)(a & (~1));
16481 a_conv.is_owned = (a & 1) || (a == 0);
16482 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16483 a_conv = RawInvoice_clone(&a_conv);
16484 LDKThirtyTwoBytes b_ref;
16485 CHECK(b->arr_len == 32);
16486 memcpy(b_ref.data, b->elems, 32); FREE(b);
16487 LDKInvoiceSignature c_conv;
16488 c_conv.inner = (void*)(c & (~1));
16489 c_conv.is_owned = (c & 1) || (c == 0);
16490 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16491 c_conv = InvoiceSignature_clone(&c_conv);
16492 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16493 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
16494 return ((uint32_t)ret_conv);
16497 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
16498 if ((_res & 1) != 0) return;
16499 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16500 CHECK_ACCESS(_res_ptr);
16501 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
16503 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
16506 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
16507 LDKPayeePubKey o_conv;
16508 o_conv.inner = (void*)(o & (~1));
16509 o_conv.is_owned = (o & 1) || (o == 0);
16510 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16511 o_conv = PayeePubKey_clone(&o_conv);
16512 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16513 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
16514 return (uint32_t)ret_conv;
16517 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
16518 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16519 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16520 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
16521 return (uint32_t)ret_conv;
16524 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
16525 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
16526 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
16530 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_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_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
16536 CResult_PayeePubKeyErrorZ_free(_res_conv);
16539 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
16540 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16541 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
16542 return (uint32_t)ret_conv;
16544 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
16545 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
16546 uint32_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
16550 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
16551 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
16552 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16553 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
16554 return (uint32_t)ret_conv;
16557 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
16558 LDKCVec_PrivateRouteZ _res_constr;
16559 _res_constr.datalen = _res->arr_len;
16560 if (_res_constr.datalen > 0)
16561 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
16563 _res_constr.data = NULL;
16564 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16565 for (size_t o = 0; o < _res_constr.datalen; o++) {
16566 uint32_t _res_conv_14 = _res_vals[o];
16567 LDKPrivateRoute _res_conv_14_conv;
16568 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
16569 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
16570 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16571 _res_constr.data[o] = _res_conv_14_conv;
16573 CVec_PrivateRouteZ_free(_res_constr);
16576 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
16577 LDKPositiveTimestamp o_conv;
16578 o_conv.inner = (void*)(o & (~1));
16579 o_conv.is_owned = (o & 1) || (o == 0);
16580 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16581 o_conv = PositiveTimestamp_clone(&o_conv);
16582 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16583 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
16584 return (uint32_t)ret_conv;
16587 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
16588 LDKCreationError e_conv = LDKCreationError_from_js(e);
16589 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16590 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
16591 return (uint32_t)ret_conv;
16594 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
16595 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
16596 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
16600 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
16601 if ((_res & 1) != 0) return;
16602 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16603 CHECK_ACCESS(_res_ptr);
16604 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
16606 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
16609 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
16610 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16611 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
16612 return (uint32_t)ret_conv;
16614 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
16615 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
16616 uint32_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
16620 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
16621 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
16622 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16623 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16624 return (uint32_t)ret_conv;
16627 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
16628 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16629 *ret_conv = CResult_NoneSemanticErrorZ_ok();
16630 return (uint32_t)ret_conv;
16633 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
16634 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16635 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16636 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16637 return (uint32_t)ret_conv;
16640 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
16641 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
16642 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16646 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
16647 if ((_res & 1) != 0) return;
16648 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16649 CHECK_ACCESS(_res_ptr);
16650 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16652 CResult_NoneSemanticErrorZ_free(_res_conv);
16655 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16656 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16657 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16658 return (uint32_t)ret_conv;
16660 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
16661 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
16662 uint32_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16666 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
16667 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
16668 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16669 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16670 return (uint32_t)ret_conv;
16673 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
16675 o_conv.inner = (void*)(o & (~1));
16676 o_conv.is_owned = (o & 1) || (o == 0);
16677 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16678 o_conv = Invoice_clone(&o_conv);
16679 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16680 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16681 return (uint32_t)ret_conv;
16684 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
16685 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16686 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16687 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16688 return (uint32_t)ret_conv;
16691 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
16692 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
16693 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16697 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
16698 if ((_res & 1) != 0) return;
16699 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16700 CHECK_ACCESS(_res_ptr);
16701 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16703 CResult_InvoiceSemanticErrorZ_free(_res_conv);
16706 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16707 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16708 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16709 return (uint32_t)ret_conv;
16711 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
16712 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
16713 uint32_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16717 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
16718 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
16719 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16720 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16721 return (uint32_t)ret_conv;
16724 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
16725 LDKDescription o_conv;
16726 o_conv.inner = (void*)(o & (~1));
16727 o_conv.is_owned = (o & 1) || (o == 0);
16728 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16729 o_conv = Description_clone(&o_conv);
16730 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16731 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16732 return (uint32_t)ret_conv;
16735 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
16736 LDKCreationError e_conv = LDKCreationError_from_js(e);
16737 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16738 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16739 return (uint32_t)ret_conv;
16742 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
16743 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
16744 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16748 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
16749 if ((_res & 1) != 0) return;
16750 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16751 CHECK_ACCESS(_res_ptr);
16752 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16754 CResult_DescriptionCreationErrorZ_free(_res_conv);
16757 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16758 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16759 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16760 return (uint32_t)ret_conv;
16762 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
16763 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
16764 uint32_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16768 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
16769 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
16770 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16771 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16772 return (uint32_t)ret_conv;
16775 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
16776 LDKPrivateRoute o_conv;
16777 o_conv.inner = (void*)(o & (~1));
16778 o_conv.is_owned = (o & 1) || (o == 0);
16779 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16780 o_conv = PrivateRoute_clone(&o_conv);
16781 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16782 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16783 return (uint32_t)ret_conv;
16786 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
16787 LDKCreationError e_conv = LDKCreationError_from_js(e);
16788 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16789 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16790 return (uint32_t)ret_conv;
16793 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
16794 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
16795 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16799 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
16800 if ((_res & 1) != 0) return;
16801 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16802 CHECK_ACCESS(_res_ptr);
16803 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16805 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16808 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16809 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16810 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16811 return (uint32_t)ret_conv;
16813 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
16814 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
16815 uint32_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16819 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
16820 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
16821 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16822 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16823 return (uint32_t)ret_conv;
16826 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
16827 LDKStr o_conv = str_ref_to_owned_c(o);
16828 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16829 *ret_conv = CResult_StringErrorZ_ok(o_conv);
16830 return (uint32_t)ret_conv;
16833 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
16834 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16835 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16836 *ret_conv = CResult_StringErrorZ_err(e_conv);
16837 return (uint32_t)ret_conv;
16840 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
16841 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
16842 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
16846 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
16847 if ((_res & 1) != 0) return;
16848 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16849 CHECK_ACCESS(_res_ptr);
16850 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16852 CResult_StringErrorZ_free(_res_conv);
16855 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
16856 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16857 *ret_conv = CResult_StringErrorZ_clone(arg);
16858 return (uint32_t)ret_conv;
16860 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint32_t arg) {
16861 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
16862 uint32_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
16866 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint32_t orig) {
16867 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
16868 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16869 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
16870 return (uint32_t)ret_conv;
16873 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
16874 LDKChannelMonitorUpdate o_conv;
16875 o_conv.inner = (void*)(o & (~1));
16876 o_conv.is_owned = (o & 1) || (o == 0);
16877 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16878 o_conv = ChannelMonitorUpdate_clone(&o_conv);
16879 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16880 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16881 return (uint32_t)ret_conv;
16884 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
16885 LDKDecodeError e_conv;
16886 e_conv.inner = (void*)(e & (~1));
16887 e_conv.is_owned = (e & 1) || (e == 0);
16888 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16889 e_conv = DecodeError_clone(&e_conv);
16890 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16891 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16892 return (uint32_t)ret_conv;
16895 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
16896 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
16897 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16901 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
16902 if ((_res & 1) != 0) return;
16903 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16904 CHECK_ACCESS(_res_ptr);
16905 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16907 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16910 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16911 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16912 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16913 return (uint32_t)ret_conv;
16915 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
16916 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
16917 uint32_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16921 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
16922 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
16923 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16924 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16925 return (uint32_t)ret_conv;
16928 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
16929 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16930 CHECK_ACCESS(o_ptr);
16931 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16932 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
16933 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16934 *ret_copy = COption_MonitorEventZ_some(o_conv);
16935 uint32_t ret_ref = (uintptr_t)ret_copy;
16939 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
16940 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16941 *ret_copy = COption_MonitorEventZ_none();
16942 uint32_t ret_ref = (uintptr_t)ret_copy;
16946 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
16947 if ((_res & 1) != 0) return;
16948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16949 CHECK_ACCESS(_res_ptr);
16950 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
16952 COption_MonitorEventZ_free(_res_conv);
16955 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
16956 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16957 *ret_copy = COption_MonitorEventZ_clone(arg);
16958 uint32_t ret_ref = (uintptr_t)ret_copy;
16961 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
16962 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
16963 uint32_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
16967 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
16968 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
16969 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16970 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
16971 uint32_t ret_ref = (uintptr_t)ret_copy;
16975 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
16976 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16977 CHECK_ACCESS(o_ptr);
16978 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
16979 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
16980 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16981 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
16982 return (uint32_t)ret_conv;
16985 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
16986 LDKDecodeError e_conv;
16987 e_conv.inner = (void*)(e & (~1));
16988 e_conv.is_owned = (e & 1) || (e == 0);
16989 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16990 e_conv = DecodeError_clone(&e_conv);
16991 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16992 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
16993 return (uint32_t)ret_conv;
16996 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
16997 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
16998 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17002 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
17003 if ((_res & 1) != 0) return;
17004 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17005 CHECK_ACCESS(_res_ptr);
17006 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17008 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17011 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17012 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17013 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17014 return (uint32_t)ret_conv;
17016 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
17017 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
17018 uint32_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17022 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
17023 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
17024 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17025 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17026 return (uint32_t)ret_conv;
17029 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
17030 LDKHTLCUpdate o_conv;
17031 o_conv.inner = (void*)(o & (~1));
17032 o_conv.is_owned = (o & 1) || (o == 0);
17033 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17034 o_conv = HTLCUpdate_clone(&o_conv);
17035 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17036 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17037 return (uint32_t)ret_conv;
17040 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
17041 LDKDecodeError e_conv;
17042 e_conv.inner = (void*)(e & (~1));
17043 e_conv.is_owned = (e & 1) || (e == 0);
17044 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17045 e_conv = DecodeError_clone(&e_conv);
17046 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17047 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17048 return (uint32_t)ret_conv;
17051 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
17052 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
17053 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17057 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
17058 if ((_res & 1) != 0) return;
17059 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17060 CHECK_ACCESS(_res_ptr);
17061 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17063 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17066 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17067 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17068 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17069 return (uint32_t)ret_conv;
17071 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
17072 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
17073 uint32_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17077 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
17078 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
17079 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17080 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17081 return (uint32_t)ret_conv;
17084 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17085 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17086 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17087 return ((uint32_t)ret_conv);
17089 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
17090 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
17091 uint32_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17095 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
17096 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
17097 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17098 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17099 return ((uint32_t)ret_conv);
17102 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
17103 LDKOutPoint a_conv;
17104 a_conv.inner = (void*)(a & (~1));
17105 a_conv.is_owned = (a & 1) || (a == 0);
17106 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17107 a_conv = OutPoint_clone(&a_conv);
17109 b_ref.datalen = b->arr_len;
17110 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17111 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17112 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17113 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17114 return ((uint32_t)ret_conv);
17117 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
17118 if ((_res & 1) != 0) return;
17119 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17120 CHECK_ACCESS(_res_ptr);
17121 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17123 C2Tuple_OutPointScriptZ_free(_res_conv);
17126 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17127 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17128 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17129 return ((uint32_t)ret_conv);
17131 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
17132 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
17133 uint32_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17137 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
17138 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
17139 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17140 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17141 return ((uint32_t)ret_conv);
17144 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17146 b_ref.datalen = b->arr_len;
17147 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17148 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17149 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17150 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17151 return ((uint32_t)ret_conv);
17154 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
17155 if ((_res & 1) != 0) return;
17156 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17157 CHECK_ACCESS(_res_ptr);
17158 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17160 C2Tuple_u32ScriptZ_free(_res_conv);
17163 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
17164 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17165 _res_constr.datalen = _res->arr_len;
17166 if (_res_constr.datalen > 0)
17167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17169 _res_constr.data = NULL;
17170 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17171 for (size_t v = 0; v < _res_constr.datalen; v++) {
17172 uint32_t _res_conv_21 = _res_vals[v];
17173 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
17174 CHECK_ACCESS(_res_conv_21_ptr);
17175 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17176 FREE((void*)_res_conv_21);
17177 _res_constr.data[v] = _res_conv_21_conv;
17179 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17182 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17183 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17184 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17185 return ((uint32_t)ret_conv);
17187 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
17188 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
17189 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17193 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
17194 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
17195 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17196 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17197 return ((uint32_t)ret_conv);
17200 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
17201 LDKThirtyTwoBytes a_ref;
17202 CHECK(a->arr_len == 32);
17203 memcpy(a_ref.data, a->elems, 32); FREE(a);
17204 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17205 b_constr.datalen = b->arr_len;
17206 if (b_constr.datalen > 0)
17207 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17209 b_constr.data = NULL;
17210 uint32_t* b_vals = b->elems /* XXX b leaks */;
17211 for (size_t v = 0; v < b_constr.datalen; v++) {
17212 uint32_t b_conv_21 = b_vals[v];
17213 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
17214 CHECK_ACCESS(b_conv_21_ptr);
17215 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17216 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
17217 b_constr.data[v] = b_conv_21_conv;
17219 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17220 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17221 return ((uint32_t)ret_conv);
17224 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
17225 if ((_res & 1) != 0) return;
17226 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17227 CHECK_ACCESS(_res_ptr);
17228 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17230 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17233 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
17234 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17235 _res_constr.datalen = _res->arr_len;
17236 if (_res_constr.datalen > 0)
17237 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17239 _res_constr.data = NULL;
17240 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17241 for (size_t o = 0; o < _res_constr.datalen; o++) {
17242 uint32_t _res_conv_40 = _res_vals[o];
17243 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
17244 CHECK_ACCESS(_res_conv_40_ptr);
17245 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17246 FREE((void*)_res_conv_40);
17247 _res_constr.data[o] = _res_conv_40_conv;
17249 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17252 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
17253 LDKCVec_EventZ _res_constr;
17254 _res_constr.datalen = _res->arr_len;
17255 if (_res_constr.datalen > 0)
17256 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17258 _res_constr.data = NULL;
17259 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17260 for (size_t h = 0; h < _res_constr.datalen; h++) {
17261 uint32_t _res_conv_7 = _res_vals[h];
17262 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17263 CHECK_ACCESS(_res_conv_7_ptr);
17264 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17265 FREE((void*)_res_conv_7);
17266 _res_constr.data[h] = _res_conv_7_conv;
17268 CVec_EventZ_free(_res_constr);
17271 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17272 LDKCVec_TransactionZ _res_constr;
17273 _res_constr.datalen = _res->arr_len;
17274 if (_res_constr.datalen > 0)
17275 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17277 _res_constr.data = NULL;
17278 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
17279 for (size_t m = 0; m < _res_constr.datalen; m++) {
17280 int8_tArray _res_conv_12 = _res_vals[m];
17281 LDKTransaction _res_conv_12_ref;
17282 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17283 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17284 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17285 _res_conv_12_ref.data_is_owned = true;
17286 _res_constr.data[m] = _res_conv_12_ref;
17288 CVec_TransactionZ_free(_res_constr);
17291 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
17292 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17293 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
17294 return ((uint32_t)ret_conv);
17296 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
17297 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
17298 uint32_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
17302 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
17303 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
17304 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17305 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
17306 return ((uint32_t)ret_conv);
17309 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
17310 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17311 CHECK_ACCESS(b_ptr);
17312 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
17313 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
17314 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17315 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
17316 return ((uint32_t)ret_conv);
17319 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
17320 if ((_res & 1) != 0) return;
17321 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17322 CHECK_ACCESS(_res_ptr);
17323 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
17325 C2Tuple_u32TxOutZ_free(_res_conv);
17328 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
17329 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
17330 _res_constr.datalen = _res->arr_len;
17331 if (_res_constr.datalen > 0)
17332 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17334 _res_constr.data = NULL;
17335 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17336 for (size_t u = 0; u < _res_constr.datalen; u++) {
17337 uint32_t _res_conv_20 = _res_vals[u];
17338 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
17339 CHECK_ACCESS(_res_conv_20_ptr);
17340 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
17341 FREE((void*)_res_conv_20);
17342 _res_constr.data[u] = _res_conv_20_conv;
17344 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
17347 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
17348 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17349 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
17350 return ((uint32_t)ret_conv);
17352 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
17353 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
17354 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
17358 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
17359 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
17360 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17361 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
17362 return ((uint32_t)ret_conv);
17365 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
17366 LDKThirtyTwoBytes a_ref;
17367 CHECK(a->arr_len == 32);
17368 memcpy(a_ref.data, a->elems, 32); FREE(a);
17369 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
17370 b_constr.datalen = b->arr_len;
17371 if (b_constr.datalen > 0)
17372 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17374 b_constr.data = NULL;
17375 uint32_t* b_vals = b->elems /* XXX b leaks */;
17376 for (size_t u = 0; u < b_constr.datalen; u++) {
17377 uint32_t b_conv_20 = b_vals[u];
17378 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
17379 CHECK_ACCESS(b_conv_20_ptr);
17380 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
17381 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
17382 b_constr.data[u] = b_conv_20_conv;
17384 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17385 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
17386 return ((uint32_t)ret_conv);
17389 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
17390 if ((_res & 1) != 0) return;
17391 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17392 CHECK_ACCESS(_res_ptr);
17393 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
17395 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
17398 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
17399 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
17400 _res_constr.datalen = _res->arr_len;
17401 if (_res_constr.datalen > 0)
17402 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
17404 _res_constr.data = NULL;
17405 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17406 for (size_t n = 0; n < _res_constr.datalen; n++) {
17407 uint32_t _res_conv_39 = _res_vals[n];
17408 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
17409 CHECK_ACCESS(_res_conv_39_ptr);
17410 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
17411 FREE((void*)_res_conv_39);
17412 _res_constr.data[n] = _res_conv_39_conv;
17414 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
17417 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
17418 LDKCVec_BalanceZ _res_constr;
17419 _res_constr.datalen = _res->arr_len;
17420 if (_res_constr.datalen > 0)
17421 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
17423 _res_constr.data = NULL;
17424 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17425 for (size_t j = 0; j < _res_constr.datalen; j++) {
17426 uint32_t _res_conv_9 = _res_vals[j];
17427 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
17428 CHECK_ACCESS(_res_conv_9_ptr);
17429 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
17430 FREE((void*)_res_conv_9);
17431 _res_constr.data[j] = _res_conv_9_conv;
17433 CVec_BalanceZ_free(_res_constr);
17436 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17437 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17438 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17439 return ((uint32_t)ret_conv);
17441 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
17442 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17443 uint32_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17447 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
17448 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17449 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17450 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17451 return ((uint32_t)ret_conv);
17454 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
17455 LDKThirtyTwoBytes a_ref;
17456 CHECK(a->arr_len == 32);
17457 memcpy(a_ref.data, a->elems, 32); FREE(a);
17458 LDKChannelMonitor b_conv;
17459 b_conv.inner = (void*)(b & (~1));
17460 b_conv.is_owned = (b & 1) || (b == 0);
17461 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17462 b_conv = ChannelMonitor_clone(&b_conv);
17463 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17464 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17465 return ((uint32_t)ret_conv);
17468 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
17469 if ((_res & 1) != 0) return;
17470 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17471 CHECK_ACCESS(_res_ptr);
17472 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17474 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17477 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
17478 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17479 CHECK_ACCESS(o_ptr);
17480 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
17481 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
17482 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17483 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
17484 return (uint32_t)ret_conv;
17487 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
17488 LDKDecodeError e_conv;
17489 e_conv.inner = (void*)(e & (~1));
17490 e_conv.is_owned = (e & 1) || (e == 0);
17491 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17492 e_conv = DecodeError_clone(&e_conv);
17493 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17494 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
17495 return (uint32_t)ret_conv;
17498 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
17499 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
17500 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
17504 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
17505 if ((_res & 1) != 0) return;
17506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17507 CHECK_ACCESS(_res_ptr);
17508 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
17510 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
17513 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
17514 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17515 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
17516 return (uint32_t)ret_conv;
17518 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
17519 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
17520 uint32_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
17524 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
17525 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
17526 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17527 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
17528 return (uint32_t)ret_conv;
17531 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
17532 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17533 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
17534 return ((uint32_t)ret_conv);
17536 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
17537 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
17538 uint32_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
17542 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
17543 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
17544 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17545 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
17546 return ((uint32_t)ret_conv);
17549 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
17550 LDKPublicKey a_ref;
17551 CHECK(a->arr_len == 33);
17552 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
17553 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17554 CHECK_ACCESS(b_ptr);
17555 LDKType b_conv = *(LDKType*)(b_ptr);
17556 if (b_conv.free == LDKType_JCalls_free) {
17557 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17558 LDKType_JCalls_cloned(&b_conv);
17560 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17561 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
17562 return ((uint32_t)ret_conv);
17565 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
17566 if ((_res & 1) != 0) return;
17567 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17568 CHECK_ACCESS(_res_ptr);
17569 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
17571 C2Tuple_PublicKeyTypeZ_free(_res_conv);
17574 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
17575 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17576 _res_constr.datalen = _res->arr_len;
17577 if (_res_constr.datalen > 0)
17578 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17580 _res_constr.data = NULL;
17581 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17582 for (size_t z = 0; z < _res_constr.datalen; z++) {
17583 uint32_t _res_conv_25 = _res_vals[z];
17584 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
17585 CHECK_ACCESS(_res_conv_25_ptr);
17586 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17587 FREE((void*)_res_conv_25);
17588 _res_constr.data[z] = _res_conv_25_conv;
17590 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17593 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint32_t o) {
17594 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17595 CHECK_ACCESS(o_ptr);
17596 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17597 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17598 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17599 *ret_copy = COption_NetAddressZ_some(o_conv);
17600 uint32_t ret_ref = (uintptr_t)ret_copy;
17604 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
17605 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17606 *ret_copy = COption_NetAddressZ_none();
17607 uint32_t ret_ref = (uintptr_t)ret_copy;
17611 void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint32_t _res) {
17612 if ((_res & 1) != 0) return;
17613 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17614 CHECK_ACCESS(_res_ptr);
17615 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
17617 COption_NetAddressZ_free(_res_conv);
17620 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
17621 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17622 *ret_copy = COption_NetAddressZ_clone(arg);
17623 uint32_t ret_ref = (uintptr_t)ret_copy;
17626 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint32_t arg) {
17627 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
17628 uint32_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
17632 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint32_t orig) {
17633 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
17634 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17635 *ret_copy = COption_NetAddressZ_clone(orig_conv);
17636 uint32_t ret_ref = (uintptr_t)ret_copy;
17640 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
17642 o_ref.datalen = o->arr_len;
17643 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17644 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17645 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17646 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17647 return (uint32_t)ret_conv;
17650 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
17651 LDKPeerHandleError e_conv;
17652 e_conv.inner = (void*)(e & (~1));
17653 e_conv.is_owned = (e & 1) || (e == 0);
17654 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17655 e_conv = PeerHandleError_clone(&e_conv);
17656 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17657 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17658 return (uint32_t)ret_conv;
17661 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
17662 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
17663 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17667 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
17668 if ((_res & 1) != 0) return;
17669 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17670 CHECK_ACCESS(_res_ptr);
17671 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17673 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17676 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17677 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17678 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17679 return (uint32_t)ret_conv;
17681 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17682 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
17683 uint32_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17687 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
17688 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
17689 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17690 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17691 return (uint32_t)ret_conv;
17694 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
17695 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17696 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17697 return (uint32_t)ret_conv;
17700 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
17701 LDKPeerHandleError e_conv;
17702 e_conv.inner = (void*)(e & (~1));
17703 e_conv.is_owned = (e & 1) || (e == 0);
17704 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17705 e_conv = PeerHandleError_clone(&e_conv);
17706 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17707 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17708 return (uint32_t)ret_conv;
17711 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
17712 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
17713 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17717 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
17718 if ((_res & 1) != 0) return;
17719 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17720 CHECK_ACCESS(_res_ptr);
17721 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17723 CResult_NonePeerHandleErrorZ_free(_res_conv);
17726 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17727 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17728 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17729 return (uint32_t)ret_conv;
17731 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
17732 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
17733 uint32_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17737 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
17738 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
17739 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17740 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17741 return (uint32_t)ret_conv;
17744 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
17745 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17746 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17747 return (uint32_t)ret_conv;
17750 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
17751 LDKPeerHandleError e_conv;
17752 e_conv.inner = (void*)(e & (~1));
17753 e_conv.is_owned = (e & 1) || (e == 0);
17754 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17755 e_conv = PeerHandleError_clone(&e_conv);
17756 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17757 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17758 return (uint32_t)ret_conv;
17761 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
17762 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
17763 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17767 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
17768 if ((_res & 1) != 0) return;
17769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17770 CHECK_ACCESS(_res_ptr);
17771 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17773 CResult_boolPeerHandleErrorZ_free(_res_conv);
17776 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17777 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17778 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17779 return (uint32_t)ret_conv;
17781 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17782 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
17783 uint32_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17787 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
17788 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
17789 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17790 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17791 return (uint32_t)ret_conv;
17794 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
17795 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17796 *ret_conv = CResult_NoneErrorZ_ok();
17797 return (uint32_t)ret_conv;
17800 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
17801 LDKIOError e_conv = LDKIOError_from_js(e);
17802 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17803 *ret_conv = CResult_NoneErrorZ_err(e_conv);
17804 return (uint32_t)ret_conv;
17807 jboolean __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
17808 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
17809 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17813 void __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
17814 if ((_res & 1) != 0) return;
17815 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17816 CHECK_ACCESS(_res_ptr);
17817 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17819 CResult_NoneErrorZ_free(_res_conv);
17822 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17823 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17824 *ret_conv = CResult_NoneErrorZ_clone(arg);
17825 return (uint32_t)ret_conv;
17827 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
17828 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
17829 uint32_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17833 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
17834 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
17835 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17836 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17837 return (uint32_t)ret_conv;
17840 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
17841 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17842 CHECK_ACCESS(o_ptr);
17843 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17844 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17845 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17846 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17847 return (uint32_t)ret_conv;
17850 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
17851 LDKDecodeError e_conv;
17852 e_conv.inner = (void*)(e & (~1));
17853 e_conv.is_owned = (e & 1) || (e == 0);
17854 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17855 e_conv = DecodeError_clone(&e_conv);
17856 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17857 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17858 return (uint32_t)ret_conv;
17861 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
17862 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17863 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17867 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
17868 if ((_res & 1) != 0) return;
17869 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17870 CHECK_ACCESS(_res_ptr);
17871 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17873 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17876 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17877 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17878 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17879 return (uint32_t)ret_conv;
17881 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
17882 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17883 uint32_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17887 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
17888 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17889 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17890 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17891 return (uint32_t)ret_conv;
17894 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
17895 LDKCVec_UpdateAddHTLCZ _res_constr;
17896 _res_constr.datalen = _res->arr_len;
17897 if (_res_constr.datalen > 0)
17898 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17900 _res_constr.data = NULL;
17901 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17902 for (size_t p = 0; p < _res_constr.datalen; p++) {
17903 uint32_t _res_conv_15 = _res_vals[p];
17904 LDKUpdateAddHTLC _res_conv_15_conv;
17905 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17906 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17907 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17908 _res_constr.data[p] = _res_conv_15_conv;
17910 CVec_UpdateAddHTLCZ_free(_res_constr);
17913 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
17914 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17915 _res_constr.datalen = _res->arr_len;
17916 if (_res_constr.datalen > 0)
17917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17919 _res_constr.data = NULL;
17920 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17921 for (size_t t = 0; t < _res_constr.datalen; t++) {
17922 uint32_t _res_conv_19 = _res_vals[t];
17923 LDKUpdateFulfillHTLC _res_conv_19_conv;
17924 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17925 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17926 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17927 _res_constr.data[t] = _res_conv_19_conv;
17929 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17932 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
17933 LDKCVec_UpdateFailHTLCZ _res_constr;
17934 _res_constr.datalen = _res->arr_len;
17935 if (_res_constr.datalen > 0)
17936 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17938 _res_constr.data = NULL;
17939 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17940 for (size_t q = 0; q < _res_constr.datalen; q++) {
17941 uint32_t _res_conv_16 = _res_vals[q];
17942 LDKUpdateFailHTLC _res_conv_16_conv;
17943 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
17944 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
17945 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17946 _res_constr.data[q] = _res_conv_16_conv;
17948 CVec_UpdateFailHTLCZ_free(_res_constr);
17951 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
17952 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17953 _res_constr.datalen = _res->arr_len;
17954 if (_res_constr.datalen > 0)
17955 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17957 _res_constr.data = NULL;
17958 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17959 for (size_t z = 0; z < _res_constr.datalen; z++) {
17960 uint32_t _res_conv_25 = _res_vals[z];
17961 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17962 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
17963 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
17964 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
17965 _res_constr.data[z] = _res_conv_25_conv;
17967 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
17970 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
17971 LDKAcceptChannel o_conv;
17972 o_conv.inner = (void*)(o & (~1));
17973 o_conv.is_owned = (o & 1) || (o == 0);
17974 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17975 o_conv = AcceptChannel_clone(&o_conv);
17976 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17977 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
17978 return (uint32_t)ret_conv;
17981 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
17982 LDKDecodeError e_conv;
17983 e_conv.inner = (void*)(e & (~1));
17984 e_conv.is_owned = (e & 1) || (e == 0);
17985 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17986 e_conv = DecodeError_clone(&e_conv);
17987 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17988 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
17989 return (uint32_t)ret_conv;
17992 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
17993 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
17994 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
17998 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
17999 if ((_res & 1) != 0) return;
18000 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18001 CHECK_ACCESS(_res_ptr);
18002 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18004 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18007 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18008 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18009 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18010 return (uint32_t)ret_conv;
18012 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18013 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
18014 uint32_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18018 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
18019 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
18020 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18021 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18022 return (uint32_t)ret_conv;
18025 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
18026 LDKAnnouncementSignatures o_conv;
18027 o_conv.inner = (void*)(o & (~1));
18028 o_conv.is_owned = (o & 1) || (o == 0);
18029 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18030 o_conv = AnnouncementSignatures_clone(&o_conv);
18031 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18032 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18033 return (uint32_t)ret_conv;
18036 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
18037 LDKDecodeError e_conv;
18038 e_conv.inner = (void*)(e & (~1));
18039 e_conv.is_owned = (e & 1) || (e == 0);
18040 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18041 e_conv = DecodeError_clone(&e_conv);
18042 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18043 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18044 return (uint32_t)ret_conv;
18047 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
18048 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
18049 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18053 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
18054 if ((_res & 1) != 0) return;
18055 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18056 CHECK_ACCESS(_res_ptr);
18057 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18059 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18062 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18063 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18064 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18065 return (uint32_t)ret_conv;
18067 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
18068 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
18069 uint32_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18073 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
18074 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
18075 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18076 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18077 return (uint32_t)ret_conv;
18080 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
18081 LDKChannelReestablish o_conv;
18082 o_conv.inner = (void*)(o & (~1));
18083 o_conv.is_owned = (o & 1) || (o == 0);
18084 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18085 o_conv = ChannelReestablish_clone(&o_conv);
18086 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18087 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18088 return (uint32_t)ret_conv;
18091 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
18092 LDKDecodeError e_conv;
18093 e_conv.inner = (void*)(e & (~1));
18094 e_conv.is_owned = (e & 1) || (e == 0);
18095 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18096 e_conv = DecodeError_clone(&e_conv);
18097 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18098 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18099 return (uint32_t)ret_conv;
18102 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
18103 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
18104 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18108 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
18109 if ((_res & 1) != 0) return;
18110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18111 CHECK_ACCESS(_res_ptr);
18112 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18114 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18117 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18118 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18119 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18120 return (uint32_t)ret_conv;
18122 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
18123 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
18124 uint32_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18128 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
18129 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
18130 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18131 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18132 return (uint32_t)ret_conv;
18135 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
18136 LDKClosingSigned o_conv;
18137 o_conv.inner = (void*)(o & (~1));
18138 o_conv.is_owned = (o & 1) || (o == 0);
18139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18140 o_conv = ClosingSigned_clone(&o_conv);
18141 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18142 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18143 return (uint32_t)ret_conv;
18146 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
18147 LDKDecodeError e_conv;
18148 e_conv.inner = (void*)(e & (~1));
18149 e_conv.is_owned = (e & 1) || (e == 0);
18150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18151 e_conv = DecodeError_clone(&e_conv);
18152 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18153 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18154 return (uint32_t)ret_conv;
18157 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
18158 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
18159 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18163 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
18164 if ((_res & 1) != 0) return;
18165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18166 CHECK_ACCESS(_res_ptr);
18167 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18169 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18172 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18173 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18174 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18175 return (uint32_t)ret_conv;
18177 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18178 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
18179 uint32_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18183 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
18184 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
18185 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18186 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18187 return (uint32_t)ret_conv;
18190 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
18191 LDKClosingSignedFeeRange o_conv;
18192 o_conv.inner = (void*)(o & (~1));
18193 o_conv.is_owned = (o & 1) || (o == 0);
18194 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18195 o_conv = ClosingSignedFeeRange_clone(&o_conv);
18196 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18197 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18198 return (uint32_t)ret_conv;
18201 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
18202 LDKDecodeError e_conv;
18203 e_conv.inner = (void*)(e & (~1));
18204 e_conv.is_owned = (e & 1) || (e == 0);
18205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18206 e_conv = DecodeError_clone(&e_conv);
18207 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18208 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18209 return (uint32_t)ret_conv;
18212 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
18213 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
18214 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18218 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
18219 if ((_res & 1) != 0) return;
18220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18221 CHECK_ACCESS(_res_ptr);
18222 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
18224 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
18227 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
18228 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18229 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
18230 return (uint32_t)ret_conv;
18232 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18233 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
18234 uint32_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
18238 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
18239 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
18240 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18241 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
18242 return (uint32_t)ret_conv;
18245 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
18246 LDKCommitmentSigned o_conv;
18247 o_conv.inner = (void*)(o & (~1));
18248 o_conv.is_owned = (o & 1) || (o == 0);
18249 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18250 o_conv = CommitmentSigned_clone(&o_conv);
18251 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18252 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
18253 return (uint32_t)ret_conv;
18256 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
18257 LDKDecodeError e_conv;
18258 e_conv.inner = (void*)(e & (~1));
18259 e_conv.is_owned = (e & 1) || (e == 0);
18260 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18261 e_conv = DecodeError_clone(&e_conv);
18262 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18263 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
18264 return (uint32_t)ret_conv;
18267 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
18268 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
18269 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
18273 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
18274 if ((_res & 1) != 0) return;
18275 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18276 CHECK_ACCESS(_res_ptr);
18277 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
18279 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
18282 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
18283 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18284 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
18285 return (uint32_t)ret_conv;
18287 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18288 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
18289 uint32_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
18293 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
18294 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
18295 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18296 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
18297 return (uint32_t)ret_conv;
18300 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
18301 LDKFundingCreated o_conv;
18302 o_conv.inner = (void*)(o & (~1));
18303 o_conv.is_owned = (o & 1) || (o == 0);
18304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18305 o_conv = FundingCreated_clone(&o_conv);
18306 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18307 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
18308 return (uint32_t)ret_conv;
18311 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
18312 LDKDecodeError e_conv;
18313 e_conv.inner = (void*)(e & (~1));
18314 e_conv.is_owned = (e & 1) || (e == 0);
18315 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18316 e_conv = DecodeError_clone(&e_conv);
18317 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18318 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
18319 return (uint32_t)ret_conv;
18322 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
18323 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
18324 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
18328 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
18329 if ((_res & 1) != 0) return;
18330 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18331 CHECK_ACCESS(_res_ptr);
18332 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
18334 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
18337 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
18338 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18339 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
18340 return (uint32_t)ret_conv;
18342 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
18343 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
18344 uint32_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
18348 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
18349 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
18350 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18351 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
18352 return (uint32_t)ret_conv;
18355 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
18356 LDKFundingSigned o_conv;
18357 o_conv.inner = (void*)(o & (~1));
18358 o_conv.is_owned = (o & 1) || (o == 0);
18359 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18360 o_conv = FundingSigned_clone(&o_conv);
18361 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18362 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
18363 return (uint32_t)ret_conv;
18366 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
18367 LDKDecodeError e_conv;
18368 e_conv.inner = (void*)(e & (~1));
18369 e_conv.is_owned = (e & 1) || (e == 0);
18370 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18371 e_conv = DecodeError_clone(&e_conv);
18372 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18373 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
18374 return (uint32_t)ret_conv;
18377 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
18378 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
18379 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
18383 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
18384 if ((_res & 1) != 0) return;
18385 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18386 CHECK_ACCESS(_res_ptr);
18387 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
18389 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
18392 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
18393 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18394 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
18395 return (uint32_t)ret_conv;
18397 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18398 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
18399 uint32_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
18403 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
18404 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
18405 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18406 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
18407 return (uint32_t)ret_conv;
18410 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint32_t o) {
18411 LDKChannelReady o_conv;
18412 o_conv.inner = (void*)(o & (~1));
18413 o_conv.is_owned = (o & 1) || (o == 0);
18414 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18415 o_conv = ChannelReady_clone(&o_conv);
18416 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18417 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
18418 return (uint32_t)ret_conv;
18421 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint32_t e) {
18422 LDKDecodeError 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 = DecodeError_clone(&e_conv);
18427 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18428 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
18429 return (uint32_t)ret_conv;
18432 jboolean __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint32_t o) {
18433 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
18434 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
18438 void __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_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_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
18444 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
18447 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
18448 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18449 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
18450 return (uint32_t)ret_conv;
18452 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint32_t arg) {
18453 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
18454 uint32_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
18458 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint32_t orig) {
18459 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
18460 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18461 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
18462 return (uint32_t)ret_conv;
18465 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
18467 o_conv.inner = (void*)(o & (~1));
18468 o_conv.is_owned = (o & 1) || (o == 0);
18469 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18470 o_conv = Init_clone(&o_conv);
18471 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18472 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
18473 return (uint32_t)ret_conv;
18476 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
18477 LDKDecodeError e_conv;
18478 e_conv.inner = (void*)(e & (~1));
18479 e_conv.is_owned = (e & 1) || (e == 0);
18480 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18481 e_conv = DecodeError_clone(&e_conv);
18482 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18483 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
18484 return (uint32_t)ret_conv;
18487 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
18488 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
18489 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
18493 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
18494 if ((_res & 1) != 0) return;
18495 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18496 CHECK_ACCESS(_res_ptr);
18497 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
18499 CResult_InitDecodeErrorZ_free(_res_conv);
18502 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
18503 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18504 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
18505 return (uint32_t)ret_conv;
18507 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
18508 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
18509 uint32_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
18513 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
18514 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
18515 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18516 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
18517 return (uint32_t)ret_conv;
18520 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
18521 LDKOpenChannel o_conv;
18522 o_conv.inner = (void*)(o & (~1));
18523 o_conv.is_owned = (o & 1) || (o == 0);
18524 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18525 o_conv = OpenChannel_clone(&o_conv);
18526 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18527 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
18528 return (uint32_t)ret_conv;
18531 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
18532 LDKDecodeError e_conv;
18533 e_conv.inner = (void*)(e & (~1));
18534 e_conv.is_owned = (e & 1) || (e == 0);
18535 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18536 e_conv = DecodeError_clone(&e_conv);
18537 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18538 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
18539 return (uint32_t)ret_conv;
18542 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
18543 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
18544 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
18548 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
18549 if ((_res & 1) != 0) return;
18550 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18551 CHECK_ACCESS(_res_ptr);
18552 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18554 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18557 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18558 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18559 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18560 return (uint32_t)ret_conv;
18562 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18563 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
18564 uint32_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18568 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
18569 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
18570 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18571 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18572 return (uint32_t)ret_conv;
18575 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
18576 LDKRevokeAndACK o_conv;
18577 o_conv.inner = (void*)(o & (~1));
18578 o_conv.is_owned = (o & 1) || (o == 0);
18579 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18580 o_conv = RevokeAndACK_clone(&o_conv);
18581 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18582 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18583 return (uint32_t)ret_conv;
18586 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
18587 LDKDecodeError e_conv;
18588 e_conv.inner = (void*)(e & (~1));
18589 e_conv.is_owned = (e & 1) || (e == 0);
18590 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18591 e_conv = DecodeError_clone(&e_conv);
18592 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18593 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18594 return (uint32_t)ret_conv;
18597 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
18598 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
18599 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18603 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
18604 if ((_res & 1) != 0) return;
18605 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18606 CHECK_ACCESS(_res_ptr);
18607 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18609 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18612 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18613 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18614 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18615 return (uint32_t)ret_conv;
18617 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
18618 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
18619 uint32_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18623 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
18624 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
18625 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18626 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18627 return (uint32_t)ret_conv;
18630 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
18631 LDKShutdown o_conv;
18632 o_conv.inner = (void*)(o & (~1));
18633 o_conv.is_owned = (o & 1) || (o == 0);
18634 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18635 o_conv = Shutdown_clone(&o_conv);
18636 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18637 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18638 return (uint32_t)ret_conv;
18641 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
18642 LDKDecodeError e_conv;
18643 e_conv.inner = (void*)(e & (~1));
18644 e_conv.is_owned = (e & 1) || (e == 0);
18645 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18646 e_conv = DecodeError_clone(&e_conv);
18647 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18648 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18649 return (uint32_t)ret_conv;
18652 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
18653 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
18654 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18658 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
18659 if ((_res & 1) != 0) return;
18660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18661 CHECK_ACCESS(_res_ptr);
18662 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18664 CResult_ShutdownDecodeErrorZ_free(_res_conv);
18667 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18668 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18669 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18670 return (uint32_t)ret_conv;
18672 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
18673 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
18674 uint32_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18678 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
18679 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
18680 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18681 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18682 return (uint32_t)ret_conv;
18685 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
18686 LDKUpdateFailHTLC o_conv;
18687 o_conv.inner = (void*)(o & (~1));
18688 o_conv.is_owned = (o & 1) || (o == 0);
18689 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18690 o_conv = UpdateFailHTLC_clone(&o_conv);
18691 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18692 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18693 return (uint32_t)ret_conv;
18696 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
18697 LDKDecodeError e_conv;
18698 e_conv.inner = (void*)(e & (~1));
18699 e_conv.is_owned = (e & 1) || (e == 0);
18700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18701 e_conv = DecodeError_clone(&e_conv);
18702 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18703 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18704 return (uint32_t)ret_conv;
18707 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
18708 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
18709 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18713 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
18714 if ((_res & 1) != 0) return;
18715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18716 CHECK_ACCESS(_res_ptr);
18717 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18719 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18722 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18723 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18724 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18725 return (uint32_t)ret_conv;
18727 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18728 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
18729 uint32_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18733 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
18734 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
18735 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18736 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18737 return (uint32_t)ret_conv;
18740 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
18741 LDKUpdateFailMalformedHTLC o_conv;
18742 o_conv.inner = (void*)(o & (~1));
18743 o_conv.is_owned = (o & 1) || (o == 0);
18744 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18745 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18746 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18747 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18748 return (uint32_t)ret_conv;
18751 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
18752 LDKDecodeError e_conv;
18753 e_conv.inner = (void*)(e & (~1));
18754 e_conv.is_owned = (e & 1) || (e == 0);
18755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18756 e_conv = DecodeError_clone(&e_conv);
18757 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18758 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18759 return (uint32_t)ret_conv;
18762 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
18763 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
18764 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18768 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
18769 if ((_res & 1) != 0) return;
18770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18771 CHECK_ACCESS(_res_ptr);
18772 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18774 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18777 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18778 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18779 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18780 return (uint32_t)ret_conv;
18782 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18783 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
18784 uint32_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18788 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
18789 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
18790 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18791 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18792 return (uint32_t)ret_conv;
18795 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
18796 LDKUpdateFee o_conv;
18797 o_conv.inner = (void*)(o & (~1));
18798 o_conv.is_owned = (o & 1) || (o == 0);
18799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18800 o_conv = UpdateFee_clone(&o_conv);
18801 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18802 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18803 return (uint32_t)ret_conv;
18806 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
18807 LDKDecodeError e_conv;
18808 e_conv.inner = (void*)(e & (~1));
18809 e_conv.is_owned = (e & 1) || (e == 0);
18810 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18811 e_conv = DecodeError_clone(&e_conv);
18812 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18813 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18814 return (uint32_t)ret_conv;
18817 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
18818 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18819 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18823 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
18824 if ((_res & 1) != 0) return;
18825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18826 CHECK_ACCESS(_res_ptr);
18827 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18829 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18832 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18833 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18834 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18835 return (uint32_t)ret_conv;
18837 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
18838 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18839 uint32_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18843 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
18844 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18845 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18846 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18847 return (uint32_t)ret_conv;
18850 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
18851 LDKUpdateFulfillHTLC o_conv;
18852 o_conv.inner = (void*)(o & (~1));
18853 o_conv.is_owned = (o & 1) || (o == 0);
18854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18855 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18856 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18857 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18858 return (uint32_t)ret_conv;
18861 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
18862 LDKDecodeError e_conv;
18863 e_conv.inner = (void*)(e & (~1));
18864 e_conv.is_owned = (e & 1) || (e == 0);
18865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18866 e_conv = DecodeError_clone(&e_conv);
18867 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18868 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18869 return (uint32_t)ret_conv;
18872 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
18873 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18874 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18878 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
18879 if ((_res & 1) != 0) return;
18880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18881 CHECK_ACCESS(_res_ptr);
18882 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18884 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18887 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18888 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18889 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18890 return (uint32_t)ret_conv;
18892 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18893 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18894 uint32_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18898 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
18899 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18900 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18901 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18902 return (uint32_t)ret_conv;
18905 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
18906 LDKUpdateAddHTLC o_conv;
18907 o_conv.inner = (void*)(o & (~1));
18908 o_conv.is_owned = (o & 1) || (o == 0);
18909 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18910 o_conv = UpdateAddHTLC_clone(&o_conv);
18911 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18912 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18913 return (uint32_t)ret_conv;
18916 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
18917 LDKDecodeError e_conv;
18918 e_conv.inner = (void*)(e & (~1));
18919 e_conv.is_owned = (e & 1) || (e == 0);
18920 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18921 e_conv = DecodeError_clone(&e_conv);
18922 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18923 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18924 return (uint32_t)ret_conv;
18927 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
18928 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18929 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18933 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
18934 if ((_res & 1) != 0) return;
18935 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18936 CHECK_ACCESS(_res_ptr);
18937 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18939 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18942 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18943 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18944 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18945 return (uint32_t)ret_conv;
18947 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18948 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
18949 uint32_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18953 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
18954 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
18955 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18956 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18957 return (uint32_t)ret_conv;
18960 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
18962 o_conv.inner = (void*)(o & (~1));
18963 o_conv.is_owned = (o & 1) || (o == 0);
18964 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18965 o_conv = Ping_clone(&o_conv);
18966 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18967 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
18968 return (uint32_t)ret_conv;
18971 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
18972 LDKDecodeError e_conv;
18973 e_conv.inner = (void*)(e & (~1));
18974 e_conv.is_owned = (e & 1) || (e == 0);
18975 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18976 e_conv = DecodeError_clone(&e_conv);
18977 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18978 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
18979 return (uint32_t)ret_conv;
18982 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
18983 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
18984 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
18988 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
18989 if ((_res & 1) != 0) return;
18990 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18991 CHECK_ACCESS(_res_ptr);
18992 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
18994 CResult_PingDecodeErrorZ_free(_res_conv);
18997 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
18998 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18999 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19000 return (uint32_t)ret_conv;
19002 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
19003 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
19004 uint32_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19008 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
19009 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
19010 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19011 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19012 return (uint32_t)ret_conv;
19015 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
19017 o_conv.inner = (void*)(o & (~1));
19018 o_conv.is_owned = (o & 1) || (o == 0);
19019 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19020 o_conv = Pong_clone(&o_conv);
19021 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19022 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19023 return (uint32_t)ret_conv;
19026 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
19027 LDKDecodeError e_conv;
19028 e_conv.inner = (void*)(e & (~1));
19029 e_conv.is_owned = (e & 1) || (e == 0);
19030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19031 e_conv = DecodeError_clone(&e_conv);
19032 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19033 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19034 return (uint32_t)ret_conv;
19037 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
19038 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
19039 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19043 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
19044 if ((_res & 1) != 0) return;
19045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19046 CHECK_ACCESS(_res_ptr);
19047 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19049 CResult_PongDecodeErrorZ_free(_res_conv);
19052 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19053 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19054 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19055 return (uint32_t)ret_conv;
19057 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
19058 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
19059 uint32_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19063 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
19064 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
19065 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19066 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19067 return (uint32_t)ret_conv;
19070 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19071 LDKUnsignedChannelAnnouncement o_conv;
19072 o_conv.inner = (void*)(o & (~1));
19073 o_conv.is_owned = (o & 1) || (o == 0);
19074 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19075 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19076 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19077 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19078 return (uint32_t)ret_conv;
19081 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19082 LDKDecodeError e_conv;
19083 e_conv.inner = (void*)(e & (~1));
19084 e_conv.is_owned = (e & 1) || (e == 0);
19085 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19086 e_conv = DecodeError_clone(&e_conv);
19087 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19088 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19089 return (uint32_t)ret_conv;
19092 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19093 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
19094 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19098 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19099 if ((_res & 1) != 0) return;
19100 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19101 CHECK_ACCESS(_res_ptr);
19102 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19104 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19107 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19108 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19109 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19110 return (uint32_t)ret_conv;
19112 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19113 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19114 uint32_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19118 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19119 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19120 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19121 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19122 return (uint32_t)ret_conv;
19125 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19126 LDKChannelAnnouncement o_conv;
19127 o_conv.inner = (void*)(o & (~1));
19128 o_conv.is_owned = (o & 1) || (o == 0);
19129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19130 o_conv = ChannelAnnouncement_clone(&o_conv);
19131 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19132 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19133 return (uint32_t)ret_conv;
19136 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19137 LDKDecodeError e_conv;
19138 e_conv.inner = (void*)(e & (~1));
19139 e_conv.is_owned = (e & 1) || (e == 0);
19140 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19141 e_conv = DecodeError_clone(&e_conv);
19142 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19143 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19144 return (uint32_t)ret_conv;
19147 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19148 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
19149 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19153 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19154 if ((_res & 1) != 0) return;
19155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19156 CHECK_ACCESS(_res_ptr);
19157 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19159 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19162 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19163 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19164 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19165 return (uint32_t)ret_conv;
19167 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19168 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19169 uint32_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19173 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19174 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19175 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19176 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19177 return (uint32_t)ret_conv;
19180 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19181 LDKUnsignedChannelUpdate o_conv;
19182 o_conv.inner = (void*)(o & (~1));
19183 o_conv.is_owned = (o & 1) || (o == 0);
19184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19185 o_conv = UnsignedChannelUpdate_clone(&o_conv);
19186 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19187 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
19188 return (uint32_t)ret_conv;
19191 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
19192 LDKDecodeError e_conv;
19193 e_conv.inner = (void*)(e & (~1));
19194 e_conv.is_owned = (e & 1) || (e == 0);
19195 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19196 e_conv = DecodeError_clone(&e_conv);
19197 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19198 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
19199 return (uint32_t)ret_conv;
19202 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19203 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
19204 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
19208 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19209 if ((_res & 1) != 0) return;
19210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19211 CHECK_ACCESS(_res_ptr);
19212 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
19214 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
19217 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19218 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19219 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
19220 return (uint32_t)ret_conv;
19222 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19223 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
19224 uint32_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19228 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19229 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
19230 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19231 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
19232 return (uint32_t)ret_conv;
19235 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19236 LDKChannelUpdate o_conv;
19237 o_conv.inner = (void*)(o & (~1));
19238 o_conv.is_owned = (o & 1) || (o == 0);
19239 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19240 o_conv = ChannelUpdate_clone(&o_conv);
19241 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19242 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
19243 return (uint32_t)ret_conv;
19246 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
19247 LDKDecodeError e_conv;
19248 e_conv.inner = (void*)(e & (~1));
19249 e_conv.is_owned = (e & 1) || (e == 0);
19250 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19251 e_conv = DecodeError_clone(&e_conv);
19252 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19253 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
19254 return (uint32_t)ret_conv;
19257 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19258 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
19259 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
19263 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19264 if ((_res & 1) != 0) return;
19265 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19266 CHECK_ACCESS(_res_ptr);
19267 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
19269 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
19272 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19273 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19274 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
19275 return (uint32_t)ret_conv;
19277 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19278 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
19279 uint32_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19283 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19284 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
19285 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19286 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
19287 return (uint32_t)ret_conv;
19290 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
19291 LDKErrorMessage o_conv;
19292 o_conv.inner = (void*)(o & (~1));
19293 o_conv.is_owned = (o & 1) || (o == 0);
19294 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19295 o_conv = ErrorMessage_clone(&o_conv);
19296 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19297 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
19298 return (uint32_t)ret_conv;
19301 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
19302 LDKDecodeError e_conv;
19303 e_conv.inner = (void*)(e & (~1));
19304 e_conv.is_owned = (e & 1) || (e == 0);
19305 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19306 e_conv = DecodeError_clone(&e_conv);
19307 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19308 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
19309 return (uint32_t)ret_conv;
19312 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
19313 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
19314 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
19318 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
19319 if ((_res & 1) != 0) return;
19320 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19321 CHECK_ACCESS(_res_ptr);
19322 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
19324 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
19327 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
19328 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19329 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
19330 return (uint32_t)ret_conv;
19332 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19333 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
19334 uint32_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
19338 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
19339 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
19340 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19341 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
19342 return (uint32_t)ret_conv;
19345 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
19346 LDKWarningMessage o_conv;
19347 o_conv.inner = (void*)(o & (~1));
19348 o_conv.is_owned = (o & 1) || (o == 0);
19349 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19350 o_conv = WarningMessage_clone(&o_conv);
19351 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19352 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
19353 return (uint32_t)ret_conv;
19356 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
19357 LDKDecodeError e_conv;
19358 e_conv.inner = (void*)(e & (~1));
19359 e_conv.is_owned = (e & 1) || (e == 0);
19360 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19361 e_conv = DecodeError_clone(&e_conv);
19362 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19363 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
19364 return (uint32_t)ret_conv;
19367 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
19368 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
19369 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
19373 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
19374 if ((_res & 1) != 0) return;
19375 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19376 CHECK_ACCESS(_res_ptr);
19377 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
19379 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
19382 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
19383 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19384 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
19385 return (uint32_t)ret_conv;
19387 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19388 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
19389 uint32_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
19393 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
19394 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
19395 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19396 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
19397 return (uint32_t)ret_conv;
19400 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19401 LDKUnsignedNodeAnnouncement o_conv;
19402 o_conv.inner = (void*)(o & (~1));
19403 o_conv.is_owned = (o & 1) || (o == 0);
19404 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19405 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
19406 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19407 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
19408 return (uint32_t)ret_conv;
19411 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19412 LDKDecodeError e_conv;
19413 e_conv.inner = (void*)(e & (~1));
19414 e_conv.is_owned = (e & 1) || (e == 0);
19415 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19416 e_conv = DecodeError_clone(&e_conv);
19417 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19418 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
19419 return (uint32_t)ret_conv;
19422 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19423 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
19424 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19428 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19429 if ((_res & 1) != 0) return;
19430 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19431 CHECK_ACCESS(_res_ptr);
19432 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
19434 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
19437 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19438 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19439 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
19440 return (uint32_t)ret_conv;
19442 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19443 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
19444 uint32_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19448 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19449 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
19450 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19451 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
19452 return (uint32_t)ret_conv;
19455 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19456 LDKNodeAnnouncement o_conv;
19457 o_conv.inner = (void*)(o & (~1));
19458 o_conv.is_owned = (o & 1) || (o == 0);
19459 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19460 o_conv = NodeAnnouncement_clone(&o_conv);
19461 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19462 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
19463 return (uint32_t)ret_conv;
19466 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19467 LDKDecodeError e_conv;
19468 e_conv.inner = (void*)(e & (~1));
19469 e_conv.is_owned = (e & 1) || (e == 0);
19470 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19471 e_conv = DecodeError_clone(&e_conv);
19472 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19473 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
19474 return (uint32_t)ret_conv;
19477 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19478 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
19479 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19483 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19484 if ((_res & 1) != 0) return;
19485 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19486 CHECK_ACCESS(_res_ptr);
19487 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
19489 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
19492 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19493 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19494 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
19495 return (uint32_t)ret_conv;
19497 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19498 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
19499 uint32_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19503 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19504 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
19505 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19506 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
19507 return (uint32_t)ret_conv;
19510 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
19511 LDKQueryShortChannelIds o_conv;
19512 o_conv.inner = (void*)(o & (~1));
19513 o_conv.is_owned = (o & 1) || (o == 0);
19514 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19515 o_conv = QueryShortChannelIds_clone(&o_conv);
19516 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19517 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
19518 return (uint32_t)ret_conv;
19521 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
19522 LDKDecodeError e_conv;
19523 e_conv.inner = (void*)(e & (~1));
19524 e_conv.is_owned = (e & 1) || (e == 0);
19525 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19526 e_conv = DecodeError_clone(&e_conv);
19527 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19528 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
19529 return (uint32_t)ret_conv;
19532 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
19533 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
19534 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
19538 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
19539 if ((_res & 1) != 0) return;
19540 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19541 CHECK_ACCESS(_res_ptr);
19542 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
19544 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
19547 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
19548 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19549 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
19550 return (uint32_t)ret_conv;
19552 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
19553 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
19554 uint32_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19558 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
19559 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
19560 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19561 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19562 return (uint32_t)ret_conv;
19565 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
19566 LDKReplyShortChannelIdsEnd o_conv;
19567 o_conv.inner = (void*)(o & (~1));
19568 o_conv.is_owned = (o & 1) || (o == 0);
19569 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19570 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19571 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19572 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19573 return (uint32_t)ret_conv;
19576 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
19577 LDKDecodeError e_conv;
19578 e_conv.inner = (void*)(e & (~1));
19579 e_conv.is_owned = (e & 1) || (e == 0);
19580 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19581 e_conv = DecodeError_clone(&e_conv);
19582 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19583 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19584 return (uint32_t)ret_conv;
19587 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
19588 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
19589 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19593 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
19594 if ((_res & 1) != 0) return;
19595 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19596 CHECK_ACCESS(_res_ptr);
19597 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19599 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19602 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19603 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19604 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19605 return (uint32_t)ret_conv;
19607 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
19608 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
19609 uint32_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19613 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
19614 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
19615 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19616 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19617 return (uint32_t)ret_conv;
19620 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
19621 LDKQueryChannelRange o_conv;
19622 o_conv.inner = (void*)(o & (~1));
19623 o_conv.is_owned = (o & 1) || (o == 0);
19624 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19625 o_conv = QueryChannelRange_clone(&o_conv);
19626 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19627 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19628 return (uint32_t)ret_conv;
19631 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
19632 LDKDecodeError e_conv;
19633 e_conv.inner = (void*)(e & (~1));
19634 e_conv.is_owned = (e & 1) || (e == 0);
19635 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19636 e_conv = DecodeError_clone(&e_conv);
19637 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19638 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19639 return (uint32_t)ret_conv;
19642 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19643 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
19644 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19648 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
19649 if ((_res & 1) != 0) return;
19650 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19651 CHECK_ACCESS(_res_ptr);
19652 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19654 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19657 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19658 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19659 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19660 return (uint32_t)ret_conv;
19662 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19663 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
19664 uint32_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19668 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19669 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
19670 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19671 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19672 return (uint32_t)ret_conv;
19675 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
19676 LDKReplyChannelRange o_conv;
19677 o_conv.inner = (void*)(o & (~1));
19678 o_conv.is_owned = (o & 1) || (o == 0);
19679 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19680 o_conv = ReplyChannelRange_clone(&o_conv);
19681 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19682 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19683 return (uint32_t)ret_conv;
19686 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
19687 LDKDecodeError e_conv;
19688 e_conv.inner = (void*)(e & (~1));
19689 e_conv.is_owned = (e & 1) || (e == 0);
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19691 e_conv = DecodeError_clone(&e_conv);
19692 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19693 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19694 return (uint32_t)ret_conv;
19697 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19698 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
19699 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19703 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
19704 if ((_res & 1) != 0) return;
19705 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19706 CHECK_ACCESS(_res_ptr);
19707 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19709 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19712 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19713 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19714 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19715 return (uint32_t)ret_conv;
19717 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19718 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
19719 uint32_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19723 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19724 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
19725 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19726 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19727 return (uint32_t)ret_conv;
19730 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
19731 LDKGossipTimestampFilter o_conv;
19732 o_conv.inner = (void*)(o & (~1));
19733 o_conv.is_owned = (o & 1) || (o == 0);
19734 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19735 o_conv = GossipTimestampFilter_clone(&o_conv);
19736 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19737 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19738 return (uint32_t)ret_conv;
19741 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
19742 LDKDecodeError e_conv;
19743 e_conv.inner = (void*)(e & (~1));
19744 e_conv.is_owned = (e & 1) || (e == 0);
19745 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19746 e_conv = DecodeError_clone(&e_conv);
19747 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19748 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19749 return (uint32_t)ret_conv;
19752 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
19753 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
19754 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19758 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
19759 if ((_res & 1) != 0) return;
19760 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19761 CHECK_ACCESS(_res_ptr);
19762 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19764 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19767 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19768 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19769 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19770 return (uint32_t)ret_conv;
19772 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
19773 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
19774 uint32_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19778 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
19779 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
19780 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19781 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19782 return (uint32_t)ret_conv;
19785 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
19787 o_conv.inner = (void*)(o & (~1));
19788 o_conv.is_owned = (o & 1) || (o == 0);
19789 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19790 o_conv = Invoice_clone(&o_conv);
19791 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19792 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19793 return (uint32_t)ret_conv;
19796 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
19797 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19798 CHECK_ACCESS(e_ptr);
19799 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19800 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
19801 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19802 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19803 return (uint32_t)ret_conv;
19806 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
19807 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19808 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19812 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
19813 if ((_res & 1) != 0) return;
19814 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19815 CHECK_ACCESS(_res_ptr);
19816 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19818 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19821 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19822 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19823 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19824 return (uint32_t)ret_conv;
19826 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
19827 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19828 uint32_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19832 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
19833 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19834 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19835 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19836 return (uint32_t)ret_conv;
19839 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
19840 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19841 CHECK_ACCESS(o_ptr);
19842 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19843 if (o_conv.free == LDKFilter_JCalls_free) {
19844 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19845 LDKFilter_JCalls_cloned(&o_conv);
19847 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19848 *ret_copy = COption_FilterZ_some(o_conv);
19849 uint32_t ret_ref = (uintptr_t)ret_copy;
19853 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19854 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19855 *ret_copy = COption_FilterZ_none();
19856 uint32_t ret_ref = (uintptr_t)ret_copy;
19860 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
19861 if ((_res & 1) != 0) return;
19862 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19863 CHECK_ACCESS(_res_ptr);
19864 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19866 COption_FilterZ_free(_res_conv);
19869 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
19870 LDKLockedChannelMonitor o_conv;
19871 o_conv.inner = (void*)(o & (~1));
19872 o_conv.is_owned = (o & 1) || (o == 0);
19873 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19874 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19875 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19876 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19877 return (uint32_t)ret_conv;
19880 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19881 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19882 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19883 return (uint32_t)ret_conv;
19886 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
19887 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19888 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19892 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
19893 if ((_res & 1) != 0) return;
19894 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19895 CHECK_ACCESS(_res_ptr);
19896 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19898 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19901 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
19902 LDKCVec_OutPointZ _res_constr;
19903 _res_constr.datalen = _res->arr_len;
19904 if (_res_constr.datalen > 0)
19905 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19907 _res_constr.data = NULL;
19908 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
19909 for (size_t k = 0; k < _res_constr.datalen; k++) {
19910 uint32_t _res_conv_10 = _res_vals[k];
19911 LDKOutPoint _res_conv_10_conv;
19912 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19913 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19914 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19915 _res_constr.data[k] = _res_conv_10_conv;
19917 CVec_OutPointZ_free(_res_constr);
19920 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
19921 if ((this_ptr & 1) != 0) return;
19922 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19923 CHECK_ACCESS(this_ptr_ptr);
19924 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19925 FREE((void*)this_ptr);
19926 PaymentPurpose_free(this_ptr_conv);
19929 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19930 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19931 *ret_copy = PaymentPurpose_clone(arg);
19932 uint32_t ret_ref = (uintptr_t)ret_copy;
19935 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
19936 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
19937 uint32_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
19941 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
19942 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
19943 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19944 *ret_copy = PaymentPurpose_clone(orig_conv);
19945 uint32_t ret_ref = (uintptr_t)ret_copy;
19949 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
19950 LDKThirtyTwoBytes payment_preimage_ref;
19951 CHECK(payment_preimage->arr_len == 32);
19952 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19953 LDKThirtyTwoBytes payment_secret_ref;
19954 CHECK(payment_secret->arr_len == 32);
19955 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
19956 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19957 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19958 uint32_t ret_ref = (uintptr_t)ret_copy;
19962 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
19963 LDKThirtyTwoBytes a_ref;
19964 CHECK(a->arr_len == 32);
19965 memcpy(a_ref.data, a->elems, 32); FREE(a);
19966 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19967 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19968 uint32_t ret_ref = (uintptr_t)ret_copy;
19972 int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint32_t obj) {
19973 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
19974 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
19975 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19976 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19977 CVec_u8Z_free(ret_var);
19981 uint32_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
19982 LDKu8slice ser_ref;
19983 ser_ref.datalen = ser->arr_len;
19984 ser_ref.data = ser->elems /* XXX ser leaks */;
19985 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
19986 *ret_conv = PaymentPurpose_read(ser_ref);
19987 return (uint32_t)ret_conv;
19990 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
19991 if ((this_ptr & 1) != 0) return;
19992 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19993 CHECK_ACCESS(this_ptr_ptr);
19994 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19995 FREE((void*)this_ptr);
19996 ClosureReason_free(this_ptr_conv);
19999 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20000 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20001 *ret_copy = ClosureReason_clone(arg);
20002 uint32_t ret_ref = (uintptr_t)ret_copy;
20005 uint32_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
20006 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
20007 uint32_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20011 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
20012 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
20013 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20014 *ret_copy = ClosureReason_clone(orig_conv);
20015 uint32_t ret_ref = (uintptr_t)ret_copy;
20019 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20020 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20021 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20022 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20023 uint32_t ret_ref = (uintptr_t)ret_copy;
20027 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20028 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20029 *ret_copy = ClosureReason_holder_force_closed();
20030 uint32_t ret_ref = (uintptr_t)ret_copy;
20034 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20035 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20036 *ret_copy = ClosureReason_cooperative_closure();
20037 uint32_t ret_ref = (uintptr_t)ret_copy;
20041 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20042 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20043 *ret_copy = ClosureReason_commitment_tx_confirmed();
20044 uint32_t ret_ref = (uintptr_t)ret_copy;
20048 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20049 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20050 *ret_copy = ClosureReason_funding_timed_out();
20051 uint32_t ret_ref = (uintptr_t)ret_copy;
20055 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20056 LDKStr err_conv = str_ref_to_owned_c(err);
20057 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20058 *ret_copy = ClosureReason_processing_error(err_conv);
20059 uint32_t ret_ref = (uintptr_t)ret_copy;
20063 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20064 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20065 *ret_copy = ClosureReason_disconnected_peer();
20066 uint32_t ret_ref = (uintptr_t)ret_copy;
20070 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20071 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20072 *ret_copy = ClosureReason_outdated_channel_manager();
20073 uint32_t ret_ref = (uintptr_t)ret_copy;
20077 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
20078 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
20079 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20080 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20081 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20082 CVec_u8Z_free(ret_var);
20086 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20087 LDKu8slice ser_ref;
20088 ser_ref.datalen = ser->arr_len;
20089 ser_ref.data = ser->elems /* XXX ser leaks */;
20090 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20091 *ret_conv = ClosureReason_read(ser_ref);
20092 return (uint32_t)ret_conv;
20095 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
20096 if ((this_ptr & 1) != 0) return;
20097 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20098 CHECK_ACCESS(this_ptr_ptr);
20099 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
20100 FREE((void*)this_ptr);
20101 Event_free(this_ptr_conv);
20104 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
20105 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20106 *ret_copy = Event_clone(arg);
20107 uint32_t ret_ref = (uintptr_t)ret_copy;
20110 uint32_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
20111 LDKEvent* arg_conv = (LDKEvent*)arg;
20112 uint32_t ret_conv = Event_clone_ptr(arg_conv);
20116 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
20117 LDKEvent* orig_conv = (LDKEvent*)orig;
20118 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20119 *ret_copy = Event_clone(orig_conv);
20120 uint32_t ret_ref = (uintptr_t)ret_copy;
20124 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) {
20125 LDKThirtyTwoBytes temporary_channel_id_ref;
20126 CHECK(temporary_channel_id->arr_len == 32);
20127 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20128 LDKPublicKey counterparty_node_id_ref;
20129 CHECK(counterparty_node_id->arr_len == 33);
20130 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20131 LDKCVec_u8Z output_script_ref;
20132 output_script_ref.datalen = output_script->arr_len;
20133 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
20134 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
20135 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20136 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
20137 uint32_t ret_ref = (uintptr_t)ret_copy;
20141 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20142 LDKThirtyTwoBytes payment_hash_ref;
20143 CHECK(payment_hash->arr_len == 32);
20144 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20145 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20146 CHECK_ACCESS(purpose_ptr);
20147 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20148 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20149 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20150 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
20151 uint32_t ret_ref = (uintptr_t)ret_copy;
20155 uint32_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20156 LDKThirtyTwoBytes payment_hash_ref;
20157 CHECK(payment_hash->arr_len == 32);
20158 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20159 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20160 CHECK_ACCESS(purpose_ptr);
20161 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20162 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20163 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20164 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
20165 uint32_t ret_ref = (uintptr_t)ret_copy;
20169 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) {
20170 LDKThirtyTwoBytes payment_id_ref;
20171 CHECK(payment_id->arr_len == 32);
20172 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20173 LDKThirtyTwoBytes payment_preimage_ref;
20174 CHECK(payment_preimage->arr_len == 32);
20175 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20176 LDKThirtyTwoBytes payment_hash_ref;
20177 CHECK(payment_hash->arr_len == 32);
20178 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20179 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
20180 CHECK_ACCESS(fee_paid_msat_ptr);
20181 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
20182 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
20183 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20184 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
20185 uint32_t ret_ref = (uintptr_t)ret_copy;
20189 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
20190 LDKThirtyTwoBytes payment_id_ref;
20191 CHECK(payment_id->arr_len == 32);
20192 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20193 LDKThirtyTwoBytes payment_hash_ref;
20194 CHECK(payment_hash->arr_len == 32);
20195 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20196 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20197 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
20198 uint32_t ret_ref = (uintptr_t)ret_copy;
20202 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) {
20203 LDKThirtyTwoBytes payment_id_ref;
20204 CHECK(payment_id->arr_len == 32);
20205 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20206 LDKThirtyTwoBytes payment_hash_ref;
20207 CHECK(payment_hash->arr_len == 32);
20208 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20209 LDKCVec_RouteHopZ path_constr;
20210 path_constr.datalen = path->arr_len;
20211 if (path_constr.datalen > 0)
20212 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20214 path_constr.data = NULL;
20215 uint32_t* path_vals = path->elems /* XXX path leaks */;
20216 for (size_t k = 0; k < path_constr.datalen; k++) {
20217 uint32_t path_conv_10 = path_vals[k];
20218 LDKRouteHop path_conv_10_conv;
20219 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20220 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20221 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20222 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20223 path_constr.data[k] = path_conv_10_conv;
20225 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20226 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
20227 uint32_t ret_ref = (uintptr_t)ret_copy;
20231 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) {
20232 LDKThirtyTwoBytes payment_id_ref;
20233 CHECK(payment_id->arr_len == 32);
20234 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20235 LDKThirtyTwoBytes payment_hash_ref;
20236 CHECK(payment_hash->arr_len == 32);
20237 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20238 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
20239 CHECK_ACCESS(network_update_ptr);
20240 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
20241 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
20242 LDKCVec_RouteHopZ path_constr;
20243 path_constr.datalen = path->arr_len;
20244 if (path_constr.datalen > 0)
20245 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20247 path_constr.data = NULL;
20248 uint32_t* path_vals = path->elems /* XXX path leaks */;
20249 for (size_t k = 0; k < path_constr.datalen; k++) {
20250 uint32_t path_conv_10 = path_vals[k];
20251 LDKRouteHop path_conv_10_conv;
20252 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20253 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20254 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20255 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20256 path_constr.data[k] = path_conv_10_conv;
20258 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
20259 CHECK_ACCESS(short_channel_id_ptr);
20260 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
20261 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
20262 LDKRouteParameters retry_conv;
20263 retry_conv.inner = (void*)(retry & (~1));
20264 retry_conv.is_owned = (retry & 1) || (retry == 0);
20265 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
20266 retry_conv = RouteParameters_clone(&retry_conv);
20267 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20268 *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);
20269 uint32_t ret_ref = (uintptr_t)ret_copy;
20273 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
20274 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20275 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
20276 uint32_t ret_ref = (uintptr_t)ret_copy;
20280 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
20281 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
20282 outputs_constr.datalen = outputs->arr_len;
20283 if (outputs_constr.datalen > 0)
20284 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20286 outputs_constr.data = NULL;
20287 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
20288 for (size_t b = 0; b < outputs_constr.datalen; b++) {
20289 uint32_t outputs_conv_27 = outputs_vals[b];
20290 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
20291 CHECK_ACCESS(outputs_conv_27_ptr);
20292 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
20293 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
20294 outputs_constr.data[b] = outputs_conv_27_conv;
20296 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20297 *ret_copy = Event_spendable_outputs(outputs_constr);
20298 uint32_t ret_ref = (uintptr_t)ret_copy;
20302 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) {
20303 LDKThirtyTwoBytes prev_channel_id_ref;
20304 CHECK(prev_channel_id->arr_len == 32);
20305 memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
20306 LDKThirtyTwoBytes next_channel_id_ref;
20307 CHECK(next_channel_id->arr_len == 32);
20308 memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
20309 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
20310 CHECK_ACCESS(fee_earned_msat_ptr);
20311 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
20312 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
20313 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20314 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
20315 uint32_t ret_ref = (uintptr_t)ret_copy;
20319 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) {
20320 LDKThirtyTwoBytes channel_id_ref;
20321 CHECK(channel_id->arr_len == 32);
20322 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20323 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
20324 CHECK_ACCESS(reason_ptr);
20325 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
20326 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
20327 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20328 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
20329 uint32_t ret_ref = (uintptr_t)ret_copy;
20333 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
20334 LDKThirtyTwoBytes channel_id_ref;
20335 CHECK(channel_id->arr_len == 32);
20336 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20337 LDKTransaction transaction_ref;
20338 transaction_ref.datalen = transaction->arr_len;
20339 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
20340 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
20341 transaction_ref.data_is_owned = true;
20342 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20343 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
20344 uint32_t ret_ref = (uintptr_t)ret_copy;
20348 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) {
20349 LDKThirtyTwoBytes temporary_channel_id_ref;
20350 CHECK(temporary_channel_id->arr_len == 32);
20351 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20352 LDKPublicKey counterparty_node_id_ref;
20353 CHECK(counterparty_node_id->arr_len == 33);
20354 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20355 LDKChannelTypeFeatures channel_type_conv;
20356 channel_type_conv.inner = (void*)(channel_type & (~1));
20357 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
20358 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
20359 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
20360 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20361 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
20362 uint32_t ret_ref = (uintptr_t)ret_copy;
20366 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
20367 LDKEvent* obj_conv = (LDKEvent*)obj;
20368 LDKCVec_u8Z ret_var = Event_write(obj_conv);
20369 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20370 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20371 CVec_u8Z_free(ret_var);
20375 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
20376 LDKu8slice ser_ref;
20377 ser_ref.datalen = ser->arr_len;
20378 ser_ref.data = ser->elems /* XXX ser leaks */;
20379 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
20380 *ret_conv = Event_read(ser_ref);
20381 return (uint32_t)ret_conv;
20384 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
20385 if ((this_ptr & 1) != 0) return;
20386 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20387 CHECK_ACCESS(this_ptr_ptr);
20388 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20389 FREE((void*)this_ptr);
20390 MessageSendEvent_free(this_ptr_conv);
20393 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20394 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20395 *ret_copy = MessageSendEvent_clone(arg);
20396 uint32_t ret_ref = (uintptr_t)ret_copy;
20399 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
20400 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
20401 uint32_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
20405 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
20406 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
20407 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20408 *ret_copy = MessageSendEvent_clone(orig_conv);
20409 uint32_t ret_ref = (uintptr_t)ret_copy;
20413 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
20414 LDKPublicKey node_id_ref;
20415 CHECK(node_id->arr_len == 33);
20416 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20417 LDKAcceptChannel msg_conv;
20418 msg_conv.inner = (void*)(msg & (~1));
20419 msg_conv.is_owned = (msg & 1) || (msg == 0);
20420 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20421 msg_conv = AcceptChannel_clone(&msg_conv);
20422 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20423 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20424 uint32_t ret_ref = (uintptr_t)ret_copy;
20428 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
20429 LDKPublicKey node_id_ref;
20430 CHECK(node_id->arr_len == 33);
20431 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20432 LDKOpenChannel msg_conv;
20433 msg_conv.inner = (void*)(msg & (~1));
20434 msg_conv.is_owned = (msg & 1) || (msg == 0);
20435 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20436 msg_conv = OpenChannel_clone(&msg_conv);
20437 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20438 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20439 uint32_t ret_ref = (uintptr_t)ret_copy;
20443 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
20444 LDKPublicKey node_id_ref;
20445 CHECK(node_id->arr_len == 33);
20446 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20447 LDKFundingCreated msg_conv;
20448 msg_conv.inner = (void*)(msg & (~1));
20449 msg_conv.is_owned = (msg & 1) || (msg == 0);
20450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20451 msg_conv = FundingCreated_clone(&msg_conv);
20452 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20453 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20454 uint32_t ret_ref = (uintptr_t)ret_copy;
20458 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
20459 LDKPublicKey node_id_ref;
20460 CHECK(node_id->arr_len == 33);
20461 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20462 LDKFundingSigned msg_conv;
20463 msg_conv.inner = (void*)(msg & (~1));
20464 msg_conv.is_owned = (msg & 1) || (msg == 0);
20465 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20466 msg_conv = FundingSigned_clone(&msg_conv);
20467 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20468 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20469 uint32_t ret_ref = (uintptr_t)ret_copy;
20473 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint32_t msg) {
20474 LDKPublicKey node_id_ref;
20475 CHECK(node_id->arr_len == 33);
20476 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20477 LDKChannelReady msg_conv;
20478 msg_conv.inner = (void*)(msg & (~1));
20479 msg_conv.is_owned = (msg & 1) || (msg == 0);
20480 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20481 msg_conv = ChannelReady_clone(&msg_conv);
20482 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20483 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
20484 uint32_t ret_ref = (uintptr_t)ret_copy;
20488 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
20489 LDKPublicKey node_id_ref;
20490 CHECK(node_id->arr_len == 33);
20491 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20492 LDKAnnouncementSignatures msg_conv;
20493 msg_conv.inner = (void*)(msg & (~1));
20494 msg_conv.is_owned = (msg & 1) || (msg == 0);
20495 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20496 msg_conv = AnnouncementSignatures_clone(&msg_conv);
20497 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20498 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20499 uint32_t ret_ref = (uintptr_t)ret_copy;
20503 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
20504 LDKPublicKey node_id_ref;
20505 CHECK(node_id->arr_len == 33);
20506 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20507 LDKCommitmentUpdate updates_conv;
20508 updates_conv.inner = (void*)(updates & (~1));
20509 updates_conv.is_owned = (updates & 1) || (updates == 0);
20510 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20511 updates_conv = CommitmentUpdate_clone(&updates_conv);
20512 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20513 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20514 uint32_t ret_ref = (uintptr_t)ret_copy;
20518 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
20519 LDKPublicKey node_id_ref;
20520 CHECK(node_id->arr_len == 33);
20521 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20522 LDKRevokeAndACK msg_conv;
20523 msg_conv.inner = (void*)(msg & (~1));
20524 msg_conv.is_owned = (msg & 1) || (msg == 0);
20525 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20526 msg_conv = RevokeAndACK_clone(&msg_conv);
20527 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20528 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20529 uint32_t ret_ref = (uintptr_t)ret_copy;
20533 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
20534 LDKPublicKey node_id_ref;
20535 CHECK(node_id->arr_len == 33);
20536 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20537 LDKClosingSigned msg_conv;
20538 msg_conv.inner = (void*)(msg & (~1));
20539 msg_conv.is_owned = (msg & 1) || (msg == 0);
20540 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20541 msg_conv = ClosingSigned_clone(&msg_conv);
20542 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20543 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20544 uint32_t ret_ref = (uintptr_t)ret_copy;
20548 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
20549 LDKPublicKey node_id_ref;
20550 CHECK(node_id->arr_len == 33);
20551 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20552 LDKShutdown msg_conv;
20553 msg_conv.inner = (void*)(msg & (~1));
20554 msg_conv.is_owned = (msg & 1) || (msg == 0);
20555 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20556 msg_conv = Shutdown_clone(&msg_conv);
20557 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20558 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20559 uint32_t ret_ref = (uintptr_t)ret_copy;
20563 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
20564 LDKPublicKey node_id_ref;
20565 CHECK(node_id->arr_len == 33);
20566 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20567 LDKChannelReestablish msg_conv;
20568 msg_conv.inner = (void*)(msg & (~1));
20569 msg_conv.is_owned = (msg & 1) || (msg == 0);
20570 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20571 msg_conv = ChannelReestablish_clone(&msg_conv);
20572 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20573 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20574 uint32_t ret_ref = (uintptr_t)ret_copy;
20578 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
20579 LDKChannelAnnouncement msg_conv;
20580 msg_conv.inner = (void*)(msg & (~1));
20581 msg_conv.is_owned = (msg & 1) || (msg == 0);
20582 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20583 msg_conv = ChannelAnnouncement_clone(&msg_conv);
20584 LDKChannelUpdate update_msg_conv;
20585 update_msg_conv.inner = (void*)(update_msg & (~1));
20586 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
20587 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20588 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20589 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20590 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20591 uint32_t ret_ref = (uintptr_t)ret_copy;
20595 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
20596 LDKNodeAnnouncement msg_conv;
20597 msg_conv.inner = (void*)(msg & (~1));
20598 msg_conv.is_owned = (msg & 1) || (msg == 0);
20599 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20600 msg_conv = NodeAnnouncement_clone(&msg_conv);
20601 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20602 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20603 uint32_t ret_ref = (uintptr_t)ret_copy;
20607 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
20608 LDKChannelUpdate msg_conv;
20609 msg_conv.inner = (void*)(msg & (~1));
20610 msg_conv.is_owned = (msg & 1) || (msg == 0);
20611 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20612 msg_conv = ChannelUpdate_clone(&msg_conv);
20613 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20614 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20615 uint32_t ret_ref = (uintptr_t)ret_copy;
20619 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
20620 LDKPublicKey node_id_ref;
20621 CHECK(node_id->arr_len == 33);
20622 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20623 LDKChannelUpdate msg_conv;
20624 msg_conv.inner = (void*)(msg & (~1));
20625 msg_conv.is_owned = (msg & 1) || (msg == 0);
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20627 msg_conv = ChannelUpdate_clone(&msg_conv);
20628 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20629 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20630 uint32_t ret_ref = (uintptr_t)ret_copy;
20634 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
20635 LDKPublicKey node_id_ref;
20636 CHECK(node_id->arr_len == 33);
20637 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20638 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
20639 CHECK_ACCESS(action_ptr);
20640 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20641 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
20642 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20643 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20644 uint32_t ret_ref = (uintptr_t)ret_copy;
20648 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
20649 LDKPublicKey node_id_ref;
20650 CHECK(node_id->arr_len == 33);
20651 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20652 LDKQueryChannelRange msg_conv;
20653 msg_conv.inner = (void*)(msg & (~1));
20654 msg_conv.is_owned = (msg & 1) || (msg == 0);
20655 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20656 msg_conv = QueryChannelRange_clone(&msg_conv);
20657 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20658 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20659 uint32_t ret_ref = (uintptr_t)ret_copy;
20663 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
20664 LDKPublicKey node_id_ref;
20665 CHECK(node_id->arr_len == 33);
20666 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20667 LDKQueryShortChannelIds msg_conv;
20668 msg_conv.inner = (void*)(msg & (~1));
20669 msg_conv.is_owned = (msg & 1) || (msg == 0);
20670 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20671 msg_conv = QueryShortChannelIds_clone(&msg_conv);
20672 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20673 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20674 uint32_t ret_ref = (uintptr_t)ret_copy;
20678 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
20679 LDKPublicKey node_id_ref;
20680 CHECK(node_id->arr_len == 33);
20681 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20682 LDKReplyChannelRange msg_conv;
20683 msg_conv.inner = (void*)(msg & (~1));
20684 msg_conv.is_owned = (msg & 1) || (msg == 0);
20685 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20686 msg_conv = ReplyChannelRange_clone(&msg_conv);
20687 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20688 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20689 uint32_t ret_ref = (uintptr_t)ret_copy;
20693 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint32_t msg) {
20694 LDKPublicKey node_id_ref;
20695 CHECK(node_id->arr_len == 33);
20696 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20697 LDKGossipTimestampFilter msg_conv;
20698 msg_conv.inner = (void*)(msg & (~1));
20699 msg_conv.is_owned = (msg & 1) || (msg == 0);
20700 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20701 msg_conv = GossipTimestampFilter_clone(&msg_conv);
20702 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20703 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
20704 uint32_t ret_ref = (uintptr_t)ret_copy;
20708 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
20709 if ((this_ptr & 1) != 0) return;
20710 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20711 CHECK_ACCESS(this_ptr_ptr);
20712 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20713 FREE((void*)this_ptr);
20714 MessageSendEventsProvider_free(this_ptr_conv);
20717 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_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 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20722 FREE((void*)this_ptr);
20723 EventsProvider_free(this_ptr_conv);
20726 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
20727 if ((this_ptr & 1) != 0) return;
20728 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20729 CHECK_ACCESS(this_ptr_ptr);
20730 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20731 FREE((void*)this_ptr);
20732 EventHandler_free(this_ptr_conv);
20735 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
20736 if ((this_ptr & 1) != 0) return;
20737 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20738 CHECK_ACCESS(this_ptr_ptr);
20739 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20740 FREE((void*)this_ptr);
20741 APIError_free(this_ptr_conv);
20744 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20745 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20746 *ret_copy = APIError_clone(arg);
20747 uint32_t ret_ref = (uintptr_t)ret_copy;
20750 uint32_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
20751 LDKAPIError* arg_conv = (LDKAPIError*)arg;
20752 uint32_t ret_conv = APIError_clone_ptr(arg_conv);
20756 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
20757 LDKAPIError* orig_conv = (LDKAPIError*)orig;
20758 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20759 *ret_copy = APIError_clone(orig_conv);
20760 uint32_t ret_ref = (uintptr_t)ret_copy;
20764 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20765 LDKStr err_conv = str_ref_to_owned_c(err);
20766 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20767 *ret_copy = APIError_apimisuse_error(err_conv);
20768 uint32_t ret_ref = (uintptr_t)ret_copy;
20772 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20773 LDKStr err_conv = str_ref_to_owned_c(err);
20774 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20775 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20776 uint32_t ret_ref = (uintptr_t)ret_copy;
20780 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20781 LDKStr err_conv = str_ref_to_owned_c(err);
20782 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20783 *ret_copy = APIError_route_error(err_conv);
20784 uint32_t ret_ref = (uintptr_t)ret_copy;
20788 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20789 LDKStr err_conv = str_ref_to_owned_c(err);
20790 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20791 *ret_copy = APIError_channel_unavailable(err_conv);
20792 uint32_t ret_ref = (uintptr_t)ret_copy;
20796 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20797 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20798 *ret_copy = APIError_monitor_update_failed();
20799 uint32_t ret_ref = (uintptr_t)ret_copy;
20803 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
20804 LDKShutdownScript script_conv;
20805 script_conv.inner = (void*)(script & (~1));
20806 script_conv.is_owned = (script & 1) || (script == 0);
20807 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20808 script_conv = ShutdownScript_clone(&script_conv);
20809 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20810 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20811 uint32_t ret_ref = (uintptr_t)ret_copy;
20815 void __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint32_t this_obj) {
20816 LDKBigSize this_obj_conv;
20817 this_obj_conv.inner = (void*)(this_obj & (~1));
20818 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20820 BigSize_free(this_obj_conv);
20823 int64_t __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint32_t this_ptr) {
20824 LDKBigSize this_ptr_conv;
20825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20826 this_ptr_conv.is_owned = false;
20827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20828 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
20832 void __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint32_t this_ptr, int64_t val) {
20833 LDKBigSize this_ptr_conv;
20834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20835 this_ptr_conv.is_owned = false;
20836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20837 BigSize_set_a(&this_ptr_conv, val);
20840 uint32_t __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
20841 LDKBigSize ret_var = BigSize_new(a_arg);
20842 uint32_t ret_ref = 0;
20843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20846 ret_ref = (uintptr_t)ret_var.inner;
20847 if (ret_var.is_owned) {
20853 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20854 LDKu8slice msg_ref;
20855 msg_ref.datalen = msg->arr_len;
20856 msg_ref.data = msg->elems /* XXX msg leaks */;
20857 unsigned char sk_arr[32];
20858 CHECK(sk->arr_len == 32);
20859 memcpy(sk_arr, sk->elems, 32); FREE(sk);
20860 unsigned char (*sk_ref)[32] = &sk_arr;
20861 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20862 *ret_conv = sign(msg_ref, sk_ref);
20863 return (uint32_t)ret_conv;
20866 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20867 LDKu8slice msg_ref;
20868 msg_ref.datalen = msg->arr_len;
20869 msg_ref.data = msg->elems /* XXX msg leaks */;
20870 LDKStr sig_conv = str_ref_to_owned_c(sig);
20871 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20872 *ret_conv = recover_pk(msg_ref, sig_conv);
20873 return (uint32_t)ret_conv;
20876 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20877 LDKu8slice msg_ref;
20878 msg_ref.datalen = msg->arr_len;
20879 msg_ref.data = msg->elems /* XXX msg leaks */;
20880 LDKStr sig_conv = str_ref_to_owned_c(sig);
20881 LDKPublicKey pk_ref;
20882 CHECK(pk->arr_len == 33);
20883 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20884 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
20888 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20889 LDKu8slice hrp_bytes_ref;
20890 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20891 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
20892 LDKCVec_u5Z data_without_signature_constr;
20893 data_without_signature_constr.datalen = data_without_signature->arr_len;
20894 if (data_without_signature_constr.datalen > 0)
20895 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20897 data_without_signature_constr.data = NULL;
20898 int8_t* data_without_signature_vals = (void*) data_without_signature->elems /* XXX data_without_signature leaks */;
20899 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20900 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20902 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20904 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20905 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20906 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20907 CVec_u8Z_free(ret_var);
20911 void __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint32_t this_ptr) {
20912 if ((this_ptr & 1) != 0) return;
20913 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20914 CHECK_ACCESS(this_ptr_ptr);
20915 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
20916 FREE((void*)this_ptr);
20917 Persister_free(this_ptr_conv);
20920 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
20921 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
20922 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
20926 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
20927 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
20931 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
20932 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
20936 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
20937 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
20941 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
20942 uint32_t ret_conv = LDKLevel_to_js(Level_info());
20946 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
20947 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
20951 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
20952 uint32_t ret_conv = LDKLevel_to_js(Level_error());
20956 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
20957 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
20958 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
20959 jboolean ret_conv = Level_eq(a_conv, b_conv);
20963 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
20964 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
20965 int64_t ret_conv = Level_hash(o_conv);
20969 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
20970 uint32_t ret_conv = LDKLevel_to_js(Level_max());
20974 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
20975 LDKRecord this_obj_conv;
20976 this_obj_conv.inner = (void*)(this_obj & (~1));
20977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20979 Record_free(this_obj_conv);
20982 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
20983 LDKRecord this_ptr_conv;
20984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20985 this_ptr_conv.is_owned = false;
20986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20987 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
20991 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
20992 LDKRecord this_ptr_conv;
20993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20994 this_ptr_conv.is_owned = false;
20995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20996 LDKLevel val_conv = LDKLevel_from_js(val);
20997 Record_set_level(&this_ptr_conv, val_conv);
21000 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
21001 LDKRecord this_ptr_conv;
21002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21003 this_ptr_conv.is_owned = false;
21004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21005 LDKStr ret_str = Record_get_args(&this_ptr_conv);
21006 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21011 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
21012 LDKRecord this_ptr_conv;
21013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21014 this_ptr_conv.is_owned = false;
21015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21016 LDKStr val_conv = str_ref_to_owned_c(val);
21017 Record_set_args(&this_ptr_conv, val_conv);
21020 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
21021 LDKRecord this_ptr_conv;
21022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21023 this_ptr_conv.is_owned = false;
21024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21025 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
21026 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21031 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
21032 LDKRecord this_ptr_conv;
21033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21034 this_ptr_conv.is_owned = false;
21035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21036 LDKStr val_conv = str_ref_to_owned_c(val);
21037 Record_set_module_path(&this_ptr_conv, val_conv);
21040 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
21041 LDKRecord this_ptr_conv;
21042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21043 this_ptr_conv.is_owned = false;
21044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21045 LDKStr ret_str = Record_get_file(&this_ptr_conv);
21046 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21051 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
21052 LDKRecord this_ptr_conv;
21053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21054 this_ptr_conv.is_owned = false;
21055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21056 LDKStr val_conv = str_ref_to_owned_c(val);
21057 Record_set_file(&this_ptr_conv, val_conv);
21060 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
21061 LDKRecord this_ptr_conv;
21062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21063 this_ptr_conv.is_owned = false;
21064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21065 int32_t ret_conv = Record_get_line(&this_ptr_conv);
21069 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
21070 LDKRecord this_ptr_conv;
21071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21072 this_ptr_conv.is_owned = false;
21073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21074 Record_set_line(&this_ptr_conv, val);
21077 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
21078 LDKRecord ret_var = Record_clone(arg);
21079 uint32_t ret_ref = 0;
21080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21083 ret_ref = (uintptr_t)ret_var.inner;
21084 if (ret_var.is_owned) {
21089 uint32_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
21090 LDKRecord arg_conv;
21091 arg_conv.inner = (void*)(arg & (~1));
21092 arg_conv.is_owned = false;
21093 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21094 uint32_t ret_conv = Record_clone_ptr(&arg_conv);
21098 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
21099 LDKRecord orig_conv;
21100 orig_conv.inner = (void*)(orig & (~1));
21101 orig_conv.is_owned = false;
21102 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21103 LDKRecord ret_var = Record_clone(&orig_conv);
21104 uint32_t ret_ref = 0;
21105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21108 ret_ref = (uintptr_t)ret_var.inner;
21109 if (ret_var.is_owned) {
21115 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
21116 if ((this_ptr & 1) != 0) return;
21117 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21118 CHECK_ACCESS(this_ptr_ptr);
21119 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
21120 FREE((void*)this_ptr);
21121 Logger_free(this_ptr_conv);
21124 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
21125 LDKChannelHandshakeConfig this_obj_conv;
21126 this_obj_conv.inner = (void*)(this_obj & (~1));
21127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21129 ChannelHandshakeConfig_free(this_obj_conv);
21132 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
21133 LDKChannelHandshakeConfig this_ptr_conv;
21134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21135 this_ptr_conv.is_owned = false;
21136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21137 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
21141 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
21142 LDKChannelHandshakeConfig this_ptr_conv;
21143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21144 this_ptr_conv.is_owned = false;
21145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21146 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
21149 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
21150 LDKChannelHandshakeConfig this_ptr_conv;
21151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21152 this_ptr_conv.is_owned = false;
21153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21154 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
21158 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) {
21159 LDKChannelHandshakeConfig this_ptr_conv;
21160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21161 this_ptr_conv.is_owned = false;
21162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21163 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
21166 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
21167 LDKChannelHandshakeConfig this_ptr_conv;
21168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21169 this_ptr_conv.is_owned = false;
21170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21171 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
21175 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) {
21176 LDKChannelHandshakeConfig this_ptr_conv;
21177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21178 this_ptr_conv.is_owned = false;
21179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21180 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
21183 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) {
21184 LDKChannelHandshakeConfig this_ptr_conv;
21185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21186 this_ptr_conv.is_owned = false;
21187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21188 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
21192 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) {
21193 LDKChannelHandshakeConfig this_ptr_conv;
21194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21195 this_ptr_conv.is_owned = false;
21196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21197 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
21200 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint32_t this_ptr) {
21201 LDKChannelHandshakeConfig this_ptr_conv;
21202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21203 this_ptr_conv.is_owned = false;
21204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21205 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
21209 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint32_t this_ptr, jboolean val) {
21210 LDKChannelHandshakeConfig this_ptr_conv;
21211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21212 this_ptr_conv.is_owned = false;
21213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21214 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
21217 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) {
21218 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);
21219 uint32_t ret_ref = 0;
21220 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21221 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21223 ret_ref = (uintptr_t)ret_var.inner;
21224 if (ret_var.is_owned) {
21230 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
21231 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
21232 uint32_t ret_ref = 0;
21233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21236 ret_ref = (uintptr_t)ret_var.inner;
21237 if (ret_var.is_owned) {
21242 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
21243 LDKChannelHandshakeConfig arg_conv;
21244 arg_conv.inner = (void*)(arg & (~1));
21245 arg_conv.is_owned = false;
21246 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21247 uint32_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
21251 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
21252 LDKChannelHandshakeConfig orig_conv;
21253 orig_conv.inner = (void*)(orig & (~1));
21254 orig_conv.is_owned = false;
21255 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21256 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
21257 uint32_t ret_ref = 0;
21258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21261 ret_ref = (uintptr_t)ret_var.inner;
21262 if (ret_var.is_owned) {
21268 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
21269 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
21270 uint32_t ret_ref = 0;
21271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21274 ret_ref = (uintptr_t)ret_var.inner;
21275 if (ret_var.is_owned) {
21281 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
21282 LDKChannelHandshakeLimits this_obj_conv;
21283 this_obj_conv.inner = (void*)(this_obj & (~1));
21284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21286 ChannelHandshakeLimits_free(this_obj_conv);
21289 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
21290 LDKChannelHandshakeLimits this_ptr_conv;
21291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21292 this_ptr_conv.is_owned = false;
21293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21294 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
21298 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
21299 LDKChannelHandshakeLimits this_ptr_conv;
21300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21301 this_ptr_conv.is_owned = false;
21302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21303 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21306 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint32_t this_ptr) {
21307 LDKChannelHandshakeLimits this_ptr_conv;
21308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21309 this_ptr_conv.is_owned = false;
21310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21311 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
21315 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint32_t this_ptr, int64_t val) {
21316 LDKChannelHandshakeLimits this_ptr_conv;
21317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21318 this_ptr_conv.is_owned = false;
21319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21320 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
21323 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
21324 LDKChannelHandshakeLimits this_ptr_conv;
21325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21326 this_ptr_conv.is_owned = false;
21327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21328 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21332 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) {
21333 LDKChannelHandshakeLimits this_ptr_conv;
21334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21335 this_ptr_conv.is_owned = false;
21336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21337 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21340 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) {
21341 LDKChannelHandshakeLimits this_ptr_conv;
21342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21343 this_ptr_conv.is_owned = false;
21344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21345 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21349 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) {
21350 LDKChannelHandshakeLimits this_ptr_conv;
21351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21352 this_ptr_conv.is_owned = false;
21353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21354 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21357 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
21358 LDKChannelHandshakeLimits this_ptr_conv;
21359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21360 this_ptr_conv.is_owned = false;
21361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21362 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21366 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) {
21367 LDKChannelHandshakeLimits this_ptr_conv;
21368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21369 this_ptr_conv.is_owned = false;
21370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21371 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21374 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
21375 LDKChannelHandshakeLimits this_ptr_conv;
21376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21377 this_ptr_conv.is_owned = false;
21378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21379 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21383 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) {
21384 LDKChannelHandshakeLimits this_ptr_conv;
21385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21386 this_ptr_conv.is_owned = false;
21387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21388 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21391 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
21392 LDKChannelHandshakeLimits this_ptr_conv;
21393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21394 this_ptr_conv.is_owned = false;
21395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21396 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21400 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
21401 LDKChannelHandshakeLimits this_ptr_conv;
21402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21403 this_ptr_conv.is_owned = false;
21404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21405 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21408 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint32_t this_ptr) {
21409 LDKChannelHandshakeLimits this_ptr_conv;
21410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21411 this_ptr_conv.is_owned = false;
21412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21413 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
21417 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint32_t this_ptr, jboolean val) {
21418 LDKChannelHandshakeLimits this_ptr_conv;
21419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21420 this_ptr_conv.is_owned = false;
21421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21422 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
21425 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
21426 LDKChannelHandshakeLimits this_ptr_conv;
21427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21428 this_ptr_conv.is_owned = false;
21429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21430 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21434 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
21435 LDKChannelHandshakeLimits this_ptr_conv;
21436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21437 this_ptr_conv.is_owned = false;
21438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21439 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21442 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
21443 LDKChannelHandshakeLimits this_ptr_conv;
21444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21445 this_ptr_conv.is_owned = false;
21446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21447 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21451 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) {
21452 LDKChannelHandshakeLimits this_ptr_conv;
21453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21454 this_ptr_conv.is_owned = false;
21455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21456 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21459 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) {
21460 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);
21461 uint32_t ret_ref = 0;
21462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21465 ret_ref = (uintptr_t)ret_var.inner;
21466 if (ret_var.is_owned) {
21472 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21473 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21474 uint32_t ret_ref = 0;
21475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21478 ret_ref = (uintptr_t)ret_var.inner;
21479 if (ret_var.is_owned) {
21484 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
21485 LDKChannelHandshakeLimits arg_conv;
21486 arg_conv.inner = (void*)(arg & (~1));
21487 arg_conv.is_owned = false;
21488 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21489 uint32_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21493 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
21494 LDKChannelHandshakeLimits orig_conv;
21495 orig_conv.inner = (void*)(orig & (~1));
21496 orig_conv.is_owned = false;
21497 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21498 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21499 uint32_t ret_ref = 0;
21500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21503 ret_ref = (uintptr_t)ret_var.inner;
21504 if (ret_var.is_owned) {
21510 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
21511 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21512 uint32_t ret_ref = 0;
21513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21516 ret_ref = (uintptr_t)ret_var.inner;
21517 if (ret_var.is_owned) {
21523 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
21524 LDKChannelConfig this_obj_conv;
21525 this_obj_conv.inner = (void*)(this_obj & (~1));
21526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21528 ChannelConfig_free(this_obj_conv);
21531 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
21532 LDKChannelConfig this_ptr_conv;
21533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21534 this_ptr_conv.is_owned = false;
21535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21536 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21540 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) {
21541 LDKChannelConfig this_ptr_conv;
21542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21543 this_ptr_conv.is_owned = false;
21544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21545 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21548 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
21549 LDKChannelConfig this_ptr_conv;
21550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21551 this_ptr_conv.is_owned = false;
21552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21553 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21557 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) {
21558 LDKChannelConfig this_ptr_conv;
21559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21560 this_ptr_conv.is_owned = false;
21561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21562 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21565 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
21566 LDKChannelConfig this_ptr_conv;
21567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21568 this_ptr_conv.is_owned = false;
21569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21570 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21574 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21575 LDKChannelConfig this_ptr_conv;
21576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21577 this_ptr_conv.is_owned = false;
21578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21579 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21582 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
21583 LDKChannelConfig this_ptr_conv;
21584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21585 this_ptr_conv.is_owned = false;
21586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21587 jboolean ret_conv = ChannelConfig_get_announced_channel(&this_ptr_conv);
21591 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
21592 LDKChannelConfig this_ptr_conv;
21593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21594 this_ptr_conv.is_owned = false;
21595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21596 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
21599 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
21600 LDKChannelConfig this_ptr_conv;
21601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21602 this_ptr_conv.is_owned = false;
21603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21604 jboolean ret_conv = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
21608 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
21609 LDKChannelConfig this_ptr_conv;
21610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21611 this_ptr_conv.is_owned = false;
21612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21613 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
21616 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) {
21617 LDKChannelConfig this_ptr_conv;
21618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21619 this_ptr_conv.is_owned = false;
21620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21621 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21625 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) {
21626 LDKChannelConfig this_ptr_conv;
21627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21628 this_ptr_conv.is_owned = false;
21629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21630 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21633 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) {
21634 LDKChannelConfig this_ptr_conv;
21635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21636 this_ptr_conv.is_owned = false;
21637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21638 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21642 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) {
21643 LDKChannelConfig this_ptr_conv;
21644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21645 this_ptr_conv.is_owned = false;
21646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21647 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21650 uint32_t __attribute__((export_name("TS_ChannelConfig_new"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
21651 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
21652 uint32_t ret_ref = 0;
21653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21656 ret_ref = (uintptr_t)ret_var.inner;
21657 if (ret_var.is_owned) {
21663 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21664 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21665 uint32_t ret_ref = 0;
21666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21669 ret_ref = (uintptr_t)ret_var.inner;
21670 if (ret_var.is_owned) {
21675 uint32_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
21676 LDKChannelConfig arg_conv;
21677 arg_conv.inner = (void*)(arg & (~1));
21678 arg_conv.is_owned = false;
21679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21680 uint32_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
21684 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
21685 LDKChannelConfig orig_conv;
21686 orig_conv.inner = (void*)(orig & (~1));
21687 orig_conv.is_owned = false;
21688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21689 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21690 uint32_t ret_ref = 0;
21691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21694 ret_ref = (uintptr_t)ret_var.inner;
21695 if (ret_var.is_owned) {
21701 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
21702 LDKChannelConfig ret_var = ChannelConfig_default();
21703 uint32_t ret_ref = 0;
21704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21707 ret_ref = (uintptr_t)ret_var.inner;
21708 if (ret_var.is_owned) {
21714 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
21715 LDKChannelConfig obj_conv;
21716 obj_conv.inner = (void*)(obj & (~1));
21717 obj_conv.is_owned = false;
21718 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21719 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
21720 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21721 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21722 CVec_u8Z_free(ret_var);
21726 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
21727 LDKu8slice ser_ref;
21728 ser_ref.datalen = ser->arr_len;
21729 ser_ref.data = ser->elems /* XXX ser leaks */;
21730 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21731 *ret_conv = ChannelConfig_read(ser_ref);
21732 return (uint32_t)ret_conv;
21735 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
21736 LDKUserConfig this_obj_conv;
21737 this_obj_conv.inner = (void*)(this_obj & (~1));
21738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21740 UserConfig_free(this_obj_conv);
21743 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
21744 LDKUserConfig this_ptr_conv;
21745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21746 this_ptr_conv.is_owned = false;
21747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21748 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
21749 uint32_t ret_ref = 0;
21750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21753 ret_ref = (uintptr_t)ret_var.inner;
21754 if (ret_var.is_owned) {
21760 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
21761 LDKUserConfig this_ptr_conv;
21762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21763 this_ptr_conv.is_owned = false;
21764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21765 LDKChannelHandshakeConfig val_conv;
21766 val_conv.inner = (void*)(val & (~1));
21767 val_conv.is_owned = (val & 1) || (val == 0);
21768 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21769 val_conv = ChannelHandshakeConfig_clone(&val_conv);
21770 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
21773 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
21774 LDKUserConfig this_ptr_conv;
21775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21776 this_ptr_conv.is_owned = false;
21777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21778 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
21779 uint32_t ret_ref = 0;
21780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21783 ret_ref = (uintptr_t)ret_var.inner;
21784 if (ret_var.is_owned) {
21790 void __attribute__((export_name("TS_UserConfig_set_peer_channel_config_limits"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
21791 LDKUserConfig this_ptr_conv;
21792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21793 this_ptr_conv.is_owned = false;
21794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21795 LDKChannelHandshakeLimits val_conv;
21796 val_conv.inner = (void*)(val & (~1));
21797 val_conv.is_owned = (val & 1) || (val == 0);
21798 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21799 val_conv = ChannelHandshakeLimits_clone(&val_conv);
21800 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
21803 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
21804 LDKUserConfig this_ptr_conv;
21805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21806 this_ptr_conv.is_owned = false;
21807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21808 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
21809 uint32_t ret_ref = 0;
21810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21813 ret_ref = (uintptr_t)ret_var.inner;
21814 if (ret_var.is_owned) {
21820 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
21821 LDKUserConfig this_ptr_conv;
21822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21823 this_ptr_conv.is_owned = false;
21824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21825 LDKChannelConfig val_conv;
21826 val_conv.inner = (void*)(val & (~1));
21827 val_conv.is_owned = (val & 1) || (val == 0);
21828 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21829 val_conv = ChannelConfig_clone(&val_conv);
21830 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
21833 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
21834 LDKUserConfig this_ptr_conv;
21835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21836 this_ptr_conv.is_owned = false;
21837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21838 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21842 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) {
21843 LDKUserConfig this_ptr_conv;
21844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21845 this_ptr_conv.is_owned = false;
21846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21847 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21850 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
21851 LDKUserConfig this_ptr_conv;
21852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21853 this_ptr_conv.is_owned = false;
21854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21855 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21859 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21860 LDKUserConfig this_ptr_conv;
21861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21862 this_ptr_conv.is_owned = false;
21863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21864 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21867 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
21868 LDKUserConfig this_ptr_conv;
21869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21870 this_ptr_conv.is_owned = false;
21871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21872 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21876 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21877 LDKUserConfig this_ptr_conv;
21878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21879 this_ptr_conv.is_owned = false;
21880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21881 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21884 uint32_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
21885 LDKChannelHandshakeConfig own_channel_config_arg_conv;
21886 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
21887 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
21888 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
21889 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
21890 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
21891 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
21892 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
21893 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
21894 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
21895 LDKChannelConfig channel_options_arg_conv;
21896 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
21897 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
21898 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
21899 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
21900 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg);
21901 uint32_t ret_ref = 0;
21902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21905 ret_ref = (uintptr_t)ret_var.inner;
21906 if (ret_var.is_owned) {
21912 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21913 LDKUserConfig ret_var = UserConfig_clone(arg);
21914 uint32_t ret_ref = 0;
21915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21918 ret_ref = (uintptr_t)ret_var.inner;
21919 if (ret_var.is_owned) {
21924 uint32_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
21925 LDKUserConfig arg_conv;
21926 arg_conv.inner = (void*)(arg & (~1));
21927 arg_conv.is_owned = false;
21928 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21929 uint32_t ret_conv = UserConfig_clone_ptr(&arg_conv);
21933 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
21934 LDKUserConfig orig_conv;
21935 orig_conv.inner = (void*)(orig & (~1));
21936 orig_conv.is_owned = false;
21937 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21938 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
21939 uint32_t ret_ref = 0;
21940 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21941 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21943 ret_ref = (uintptr_t)ret_var.inner;
21944 if (ret_var.is_owned) {
21950 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
21951 LDKUserConfig ret_var = UserConfig_default();
21952 uint32_t ret_ref = 0;
21953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21956 ret_ref = (uintptr_t)ret_var.inner;
21957 if (ret_var.is_owned) {
21963 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
21964 LDKBestBlock this_obj_conv;
21965 this_obj_conv.inner = (void*)(this_obj & (~1));
21966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21968 BestBlock_free(this_obj_conv);
21971 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
21972 LDKBestBlock ret_var = BestBlock_clone(arg);
21973 uint32_t ret_ref = 0;
21974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21977 ret_ref = (uintptr_t)ret_var.inner;
21978 if (ret_var.is_owned) {
21983 uint32_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
21984 LDKBestBlock arg_conv;
21985 arg_conv.inner = (void*)(arg & (~1));
21986 arg_conv.is_owned = false;
21987 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21988 uint32_t ret_conv = BestBlock_clone_ptr(&arg_conv);
21992 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
21993 LDKBestBlock orig_conv;
21994 orig_conv.inner = (void*)(orig & (~1));
21995 orig_conv.is_owned = false;
21996 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21997 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21998 uint32_t ret_ref = 0;
21999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22002 ret_ref = (uintptr_t)ret_var.inner;
22003 if (ret_var.is_owned) {
22009 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
22010 LDKNetwork network_conv = LDKNetwork_from_js(network);
22011 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
22012 uint32_t ret_ref = 0;
22013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22016 ret_ref = (uintptr_t)ret_var.inner;
22017 if (ret_var.is_owned) {
22023 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
22024 LDKThirtyTwoBytes block_hash_ref;
22025 CHECK(block_hash->arr_len == 32);
22026 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
22027 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
22028 uint32_t ret_ref = 0;
22029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22032 ret_ref = (uintptr_t)ret_var.inner;
22033 if (ret_var.is_owned) {
22039 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
22040 LDKBestBlock this_arg_conv;
22041 this_arg_conv.inner = (void*)(this_arg & (~1));
22042 this_arg_conv.is_owned = false;
22043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22044 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22045 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
22049 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
22050 LDKBestBlock this_arg_conv;
22051 this_arg_conv.inner = (void*)(this_arg & (~1));
22052 this_arg_conv.is_owned = false;
22053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22054 int32_t ret_conv = BestBlock_height(&this_arg_conv);
22058 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
22059 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
22060 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
22064 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
22065 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
22069 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
22070 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
22074 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
22075 if ((this_ptr & 1) != 0) return;
22076 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22077 CHECK_ACCESS(this_ptr_ptr);
22078 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
22079 FREE((void*)this_ptr);
22080 Access_free(this_ptr_conv);
22083 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
22084 if ((this_ptr & 1) != 0) return;
22085 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22086 CHECK_ACCESS(this_ptr_ptr);
22087 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
22088 FREE((void*)this_ptr);
22089 Listen_free(this_ptr_conv);
22092 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
22093 if ((this_ptr & 1) != 0) return;
22094 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22095 CHECK_ACCESS(this_ptr_ptr);
22096 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
22097 FREE((void*)this_ptr);
22098 Confirm_free(this_ptr_conv);
22101 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
22102 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
22103 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
22107 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
22108 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
22112 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
22113 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
22117 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
22118 if ((this_ptr & 1) != 0) return;
22119 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22120 CHECK_ACCESS(this_ptr_ptr);
22121 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
22122 FREE((void*)this_ptr);
22123 Watch_free(this_ptr_conv);
22126 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
22127 if ((this_ptr & 1) != 0) return;
22128 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22129 CHECK_ACCESS(this_ptr_ptr);
22130 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
22131 FREE((void*)this_ptr);
22132 Filter_free(this_ptr_conv);
22135 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
22136 LDKWatchedOutput this_obj_conv;
22137 this_obj_conv.inner = (void*)(this_obj & (~1));
22138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22140 WatchedOutput_free(this_obj_conv);
22143 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
22144 LDKWatchedOutput this_ptr_conv;
22145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22146 this_ptr_conv.is_owned = false;
22147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22148 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22149 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
22153 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
22154 LDKWatchedOutput this_ptr_conv;
22155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22156 this_ptr_conv.is_owned = false;
22157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22158 LDKThirtyTwoBytes val_ref;
22159 CHECK(val->arr_len == 32);
22160 memcpy(val_ref.data, val->elems, 32); FREE(val);
22161 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
22164 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
22165 LDKWatchedOutput this_ptr_conv;
22166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22167 this_ptr_conv.is_owned = false;
22168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22169 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
22170 uint32_t ret_ref = 0;
22171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22174 ret_ref = (uintptr_t)ret_var.inner;
22175 if (ret_var.is_owned) {
22181 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
22182 LDKWatchedOutput this_ptr_conv;
22183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22184 this_ptr_conv.is_owned = false;
22185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22186 LDKOutPoint val_conv;
22187 val_conv.inner = (void*)(val & (~1));
22188 val_conv.is_owned = (val & 1) || (val == 0);
22189 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22190 val_conv = OutPoint_clone(&val_conv);
22191 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
22194 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
22195 LDKWatchedOutput this_ptr_conv;
22196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22197 this_ptr_conv.is_owned = false;
22198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22199 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
22200 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22201 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22205 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
22206 LDKWatchedOutput this_ptr_conv;
22207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22208 this_ptr_conv.is_owned = false;
22209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22210 LDKCVec_u8Z val_ref;
22211 val_ref.datalen = val->arr_len;
22212 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22213 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
22214 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
22217 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) {
22218 LDKThirtyTwoBytes block_hash_arg_ref;
22219 CHECK(block_hash_arg->arr_len == 32);
22220 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
22221 LDKOutPoint outpoint_arg_conv;
22222 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22223 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22224 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22225 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22226 LDKCVec_u8Z script_pubkey_arg_ref;
22227 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
22228 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22229 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
22230 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
22231 uint32_t ret_ref = 0;
22232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22235 ret_ref = (uintptr_t)ret_var.inner;
22236 if (ret_var.is_owned) {
22242 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
22243 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
22244 uint32_t ret_ref = 0;
22245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22248 ret_ref = (uintptr_t)ret_var.inner;
22249 if (ret_var.is_owned) {
22254 uint32_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
22255 LDKWatchedOutput arg_conv;
22256 arg_conv.inner = (void*)(arg & (~1));
22257 arg_conv.is_owned = false;
22258 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22259 uint32_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
22263 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
22264 LDKWatchedOutput orig_conv;
22265 orig_conv.inner = (void*)(orig & (~1));
22266 orig_conv.is_owned = false;
22267 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22268 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
22269 uint32_t ret_ref = 0;
22270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22273 ret_ref = (uintptr_t)ret_var.inner;
22274 if (ret_var.is_owned) {
22280 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
22281 LDKWatchedOutput o_conv;
22282 o_conv.inner = (void*)(o & (~1));
22283 o_conv.is_owned = false;
22284 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22285 int64_t ret_conv = WatchedOutput_hash(&o_conv);
22289 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
22290 if ((this_ptr & 1) != 0) return;
22291 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22292 CHECK_ACCESS(this_ptr_ptr);
22293 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
22294 FREE((void*)this_ptr);
22295 BroadcasterInterface_free(this_ptr_conv);
22298 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
22299 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
22300 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
22304 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
22305 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
22309 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
22310 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
22314 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
22315 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
22319 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
22320 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
22321 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
22322 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
22326 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
22327 if ((this_ptr & 1) != 0) return;
22328 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22329 CHECK_ACCESS(this_ptr_ptr);
22330 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
22331 FREE((void*)this_ptr);
22332 FeeEstimator_free(this_ptr_conv);
22335 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
22336 LDKMonitorUpdateId this_obj_conv;
22337 this_obj_conv.inner = (void*)(this_obj & (~1));
22338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22340 MonitorUpdateId_free(this_obj_conv);
22343 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
22344 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
22345 uint32_t ret_ref = 0;
22346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22349 ret_ref = (uintptr_t)ret_var.inner;
22350 if (ret_var.is_owned) {
22355 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
22356 LDKMonitorUpdateId arg_conv;
22357 arg_conv.inner = (void*)(arg & (~1));
22358 arg_conv.is_owned = false;
22359 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22360 uint32_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
22364 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
22365 LDKMonitorUpdateId orig_conv;
22366 orig_conv.inner = (void*)(orig & (~1));
22367 orig_conv.is_owned = false;
22368 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22369 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
22370 uint32_t ret_ref = 0;
22371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22374 ret_ref = (uintptr_t)ret_var.inner;
22375 if (ret_var.is_owned) {
22381 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
22382 LDKMonitorUpdateId o_conv;
22383 o_conv.inner = (void*)(o & (~1));
22384 o_conv.is_owned = false;
22385 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22386 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
22390 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
22391 LDKMonitorUpdateId a_conv;
22392 a_conv.inner = (void*)(a & (~1));
22393 a_conv.is_owned = false;
22394 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22395 LDKMonitorUpdateId b_conv;
22396 b_conv.inner = (void*)(b & (~1));
22397 b_conv.is_owned = false;
22398 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22399 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
22403 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
22404 if ((this_ptr & 1) != 0) return;
22405 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22406 CHECK_ACCESS(this_ptr_ptr);
22407 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22408 FREE((void*)this_ptr);
22409 Persist_free(this_ptr_conv);
22412 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
22413 LDKLockedChannelMonitor this_obj_conv;
22414 this_obj_conv.inner = (void*)(this_obj & (~1));
22415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22417 LockedChannelMonitor_free(this_obj_conv);
22420 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
22421 LDKChainMonitor this_obj_conv;
22422 this_obj_conv.inner = (void*)(this_obj & (~1));
22423 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22425 ChainMonitor_free(this_obj_conv);
22428 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) {
22429 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
22430 CHECK_ACCESS(chain_source_ptr);
22431 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22432 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
22433 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22434 // Manually implement clone for Java trait instances
22435 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22436 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22437 LDKFilter_JCalls_cloned(&chain_source_conv.some);
22440 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22441 CHECK_ACCESS(broadcaster_ptr);
22442 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22443 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22444 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22445 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22447 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22448 CHECK_ACCESS(logger_ptr);
22449 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22450 if (logger_conv.free == LDKLogger_JCalls_free) {
22451 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22452 LDKLogger_JCalls_cloned(&logger_conv);
22454 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
22455 CHECK_ACCESS(feeest_ptr);
22456 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22457 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22458 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22459 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22461 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
22462 CHECK_ACCESS(persister_ptr);
22463 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22464 if (persister_conv.free == LDKPersist_JCalls_free) {
22465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22466 LDKPersist_JCalls_cloned(&persister_conv);
22468 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22469 uint32_t ret_ref = 0;
22470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22473 ret_ref = (uintptr_t)ret_var.inner;
22474 if (ret_var.is_owned) {
22480 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
22481 LDKChainMonitor this_arg_conv;
22482 this_arg_conv.inner = (void*)(this_arg & (~1));
22483 this_arg_conv.is_owned = false;
22484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22485 LDKCVec_ChannelDetailsZ ignored_channels_constr;
22486 ignored_channels_constr.datalen = ignored_channels->arr_len;
22487 if (ignored_channels_constr.datalen > 0)
22488 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22490 ignored_channels_constr.data = NULL;
22491 uint32_t* ignored_channels_vals = ignored_channels->elems /* XXX ignored_channels leaks */;
22492 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22493 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
22494 LDKChannelDetails ignored_channels_conv_16_conv;
22495 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
22496 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
22497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22498 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22499 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22501 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22502 uint32_tArray ret_arr = NULL;
22503 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22504 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22505 for (size_t j = 0; j < ret_var.datalen; j++) {
22506 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22507 *ret_conv_9_copy = ret_var.data[j];
22508 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
22509 ret_arr_ptr[j] = ret_conv_9_ref;
22512 FREE(ret_var.data);
22516 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
22517 LDKChainMonitor this_arg_conv;
22518 this_arg_conv.inner = (void*)(this_arg & (~1));
22519 this_arg_conv.is_owned = false;
22520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22521 LDKOutPoint funding_txo_conv;
22522 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22523 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22524 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22525 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22526 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22527 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22528 return (uint32_t)ret_conv;
22531 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
22532 LDKChainMonitor this_arg_conv;
22533 this_arg_conv.inner = (void*)(this_arg & (~1));
22534 this_arg_conv.is_owned = false;
22535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22536 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22537 uint32_tArray ret_arr = NULL;
22538 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22539 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22540 for (size_t k = 0; k < ret_var.datalen; k++) {
22541 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22542 uint32_t ret_conv_10_ref = 0;
22543 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22544 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22546 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
22547 if (ret_conv_10_var.is_owned) {
22548 ret_conv_10_ref |= 1;
22550 ret_arr_ptr[k] = ret_conv_10_ref;
22553 FREE(ret_var.data);
22557 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) {
22558 LDKChainMonitor this_arg_conv;
22559 this_arg_conv.inner = (void*)(this_arg & (~1));
22560 this_arg_conv.is_owned = false;
22561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22562 LDKOutPoint funding_txo_conv;
22563 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22564 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22565 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22566 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22567 LDKMonitorUpdateId completed_update_id_conv;
22568 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
22569 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
22570 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22571 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22572 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22573 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22574 return (uint32_t)ret_conv;
22577 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
22578 LDKChainMonitor this_arg_conv;
22579 this_arg_conv.inner = (void*)(this_arg & (~1));
22580 this_arg_conv.is_owned = false;
22581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22582 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22583 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22584 return (uint32_t)ret_ret;
22587 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
22588 LDKChainMonitor this_arg_conv;
22589 this_arg_conv.inner = (void*)(this_arg & (~1));
22590 this_arg_conv.is_owned = false;
22591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22592 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22593 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22594 return (uint32_t)ret_ret;
22597 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
22598 LDKChainMonitor this_arg_conv;
22599 this_arg_conv.inner = (void*)(this_arg & (~1));
22600 this_arg_conv.is_owned = false;
22601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22602 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22603 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22604 return (uint32_t)ret_ret;
22607 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
22608 LDKChainMonitor this_arg_conv;
22609 this_arg_conv.inner = (void*)(this_arg & (~1));
22610 this_arg_conv.is_owned = false;
22611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22612 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22613 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22614 return (uint32_t)ret_ret;
22617 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
22618 LDKChannelMonitorUpdate this_obj_conv;
22619 this_obj_conv.inner = (void*)(this_obj & (~1));
22620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22622 ChannelMonitorUpdate_free(this_obj_conv);
22625 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
22626 LDKChannelMonitorUpdate this_ptr_conv;
22627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22628 this_ptr_conv.is_owned = false;
22629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22630 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22634 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
22635 LDKChannelMonitorUpdate this_ptr_conv;
22636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22637 this_ptr_conv.is_owned = false;
22638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22639 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22642 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22643 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22644 uint32_t ret_ref = 0;
22645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22648 ret_ref = (uintptr_t)ret_var.inner;
22649 if (ret_var.is_owned) {
22654 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
22655 LDKChannelMonitorUpdate arg_conv;
22656 arg_conv.inner = (void*)(arg & (~1));
22657 arg_conv.is_owned = false;
22658 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22659 uint32_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22663 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
22664 LDKChannelMonitorUpdate orig_conv;
22665 orig_conv.inner = (void*)(orig & (~1));
22666 orig_conv.is_owned = false;
22667 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22668 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22669 uint32_t ret_ref = 0;
22670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22673 ret_ref = (uintptr_t)ret_var.inner;
22674 if (ret_var.is_owned) {
22680 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
22681 LDKChannelMonitorUpdate obj_conv;
22682 obj_conv.inner = (void*)(obj & (~1));
22683 obj_conv.is_owned = false;
22684 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22685 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22686 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22687 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22688 CVec_u8Z_free(ret_var);
22692 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
22693 LDKu8slice ser_ref;
22694 ser_ref.datalen = ser->arr_len;
22695 ser_ref.data = ser->elems /* XXX ser leaks */;
22696 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22697 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22698 return (uint32_t)ret_conv;
22701 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
22702 if ((this_ptr & 1) != 0) return;
22703 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22704 CHECK_ACCESS(this_ptr_ptr);
22705 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22706 FREE((void*)this_ptr);
22707 MonitorEvent_free(this_ptr_conv);
22710 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22711 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22712 *ret_copy = MonitorEvent_clone(arg);
22713 uint32_t ret_ref = (uintptr_t)ret_copy;
22716 uint32_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
22717 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
22718 uint32_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
22722 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
22723 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
22724 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22725 *ret_copy = MonitorEvent_clone(orig_conv);
22726 uint32_t ret_ref = (uintptr_t)ret_copy;
22730 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
22731 LDKHTLCUpdate a_conv;
22732 a_conv.inner = (void*)(a & (~1));
22733 a_conv.is_owned = (a & 1) || (a == 0);
22734 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22735 a_conv = HTLCUpdate_clone(&a_conv);
22736 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22737 *ret_copy = MonitorEvent_htlcevent(a_conv);
22738 uint32_t ret_ref = (uintptr_t)ret_copy;
22742 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
22743 LDKOutPoint a_conv;
22744 a_conv.inner = (void*)(a & (~1));
22745 a_conv.is_owned = (a & 1) || (a == 0);
22746 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22747 a_conv = OutPoint_clone(&a_conv);
22748 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22749 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22750 uint32_t ret_ref = (uintptr_t)ret_copy;
22754 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
22755 LDKOutPoint funding_txo_conv;
22756 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22757 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22758 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22759 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22760 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22761 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22762 uint32_t ret_ref = (uintptr_t)ret_copy;
22766 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
22767 LDKOutPoint a_conv;
22768 a_conv.inner = (void*)(a & (~1));
22769 a_conv.is_owned = (a & 1) || (a == 0);
22770 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22771 a_conv = OutPoint_clone(&a_conv);
22772 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22773 *ret_copy = MonitorEvent_update_failed(a_conv);
22774 uint32_t ret_ref = (uintptr_t)ret_copy;
22778 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
22779 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
22780 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22781 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22782 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22783 CVec_u8Z_free(ret_var);
22787 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
22788 LDKu8slice ser_ref;
22789 ser_ref.datalen = ser->arr_len;
22790 ser_ref.data = ser->elems /* XXX ser leaks */;
22791 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22792 *ret_conv = MonitorEvent_read(ser_ref);
22793 return (uint32_t)ret_conv;
22796 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
22797 LDKHTLCUpdate this_obj_conv;
22798 this_obj_conv.inner = (void*)(this_obj & (~1));
22799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22801 HTLCUpdate_free(this_obj_conv);
22804 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22805 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22806 uint32_t ret_ref = 0;
22807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22810 ret_ref = (uintptr_t)ret_var.inner;
22811 if (ret_var.is_owned) {
22816 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
22817 LDKHTLCUpdate arg_conv;
22818 arg_conv.inner = (void*)(arg & (~1));
22819 arg_conv.is_owned = false;
22820 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22821 uint32_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
22825 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
22826 LDKHTLCUpdate orig_conv;
22827 orig_conv.inner = (void*)(orig & (~1));
22828 orig_conv.is_owned = false;
22829 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22830 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22831 uint32_t ret_ref = 0;
22832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22835 ret_ref = (uintptr_t)ret_var.inner;
22836 if (ret_var.is_owned) {
22842 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
22843 LDKHTLCUpdate obj_conv;
22844 obj_conv.inner = (void*)(obj & (~1));
22845 obj_conv.is_owned = false;
22846 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22847 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22848 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22849 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22850 CVec_u8Z_free(ret_var);
22854 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22855 LDKu8slice ser_ref;
22856 ser_ref.datalen = ser->arr_len;
22857 ser_ref.data = ser->elems /* XXX ser leaks */;
22858 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22859 *ret_conv = HTLCUpdate_read(ser_ref);
22860 return (uint32_t)ret_conv;
22863 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
22864 if ((this_ptr & 1) != 0) return;
22865 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22866 CHECK_ACCESS(this_ptr_ptr);
22867 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22868 FREE((void*)this_ptr);
22869 Balance_free(this_ptr_conv);
22872 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22873 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22874 *ret_copy = Balance_clone(arg);
22875 uint32_t ret_ref = (uintptr_t)ret_copy;
22878 uint32_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
22879 LDKBalance* arg_conv = (LDKBalance*)arg;
22880 uint32_t ret_conv = Balance_clone_ptr(arg_conv);
22884 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
22885 LDKBalance* orig_conv = (LDKBalance*)orig;
22886 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22887 *ret_copy = Balance_clone(orig_conv);
22888 uint32_t ret_ref = (uintptr_t)ret_copy;
22892 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22893 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22894 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22895 uint32_t ret_ref = (uintptr_t)ret_copy;
22899 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22900 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22901 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22902 uint32_t ret_ref = (uintptr_t)ret_copy;
22906 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22907 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22908 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22909 uint32_t ret_ref = (uintptr_t)ret_copy;
22913 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) {
22914 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22915 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22916 uint32_t ret_ref = (uintptr_t)ret_copy;
22920 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
22921 LDKBalance* a_conv = (LDKBalance*)a;
22922 LDKBalance* b_conv = (LDKBalance*)b;
22923 jboolean ret_conv = Balance_eq(a_conv, b_conv);
22927 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
22928 LDKChannelMonitor this_obj_conv;
22929 this_obj_conv.inner = (void*)(this_obj & (~1));
22930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22932 ChannelMonitor_free(this_obj_conv);
22935 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
22936 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
22937 uint32_t ret_ref = 0;
22938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22941 ret_ref = (uintptr_t)ret_var.inner;
22942 if (ret_var.is_owned) {
22947 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
22948 LDKChannelMonitor arg_conv;
22949 arg_conv.inner = (void*)(arg & (~1));
22950 arg_conv.is_owned = false;
22951 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22952 uint32_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
22956 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
22957 LDKChannelMonitor orig_conv;
22958 orig_conv.inner = (void*)(orig & (~1));
22959 orig_conv.is_owned = false;
22960 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22961 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
22962 uint32_t ret_ref = 0;
22963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22966 ret_ref = (uintptr_t)ret_var.inner;
22967 if (ret_var.is_owned) {
22973 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
22974 LDKChannelMonitor obj_conv;
22975 obj_conv.inner = (void*)(obj & (~1));
22976 obj_conv.is_owned = false;
22977 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22978 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
22979 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22980 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22981 CVec_u8Z_free(ret_var);
22985 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) {
22986 LDKChannelMonitor this_arg_conv;
22987 this_arg_conv.inner = (void*)(this_arg & (~1));
22988 this_arg_conv.is_owned = false;
22989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22990 LDKChannelMonitorUpdate updates_conv;
22991 updates_conv.inner = (void*)(updates & (~1));
22992 updates_conv.is_owned = false;
22993 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22994 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22995 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
22996 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22997 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22998 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
22999 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
23000 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23001 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23002 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23003 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23004 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
23005 return (uint32_t)ret_conv;
23008 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
23009 LDKChannelMonitor this_arg_conv;
23010 this_arg_conv.inner = (void*)(this_arg & (~1));
23011 this_arg_conv.is_owned = false;
23012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23013 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
23017 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
23018 LDKChannelMonitor this_arg_conv;
23019 this_arg_conv.inner = (void*)(this_arg & (~1));
23020 this_arg_conv.is_owned = false;
23021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23022 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
23023 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
23024 return ((uint32_t)ret_conv);
23027 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
23028 LDKChannelMonitor this_arg_conv;
23029 this_arg_conv.inner = (void*)(this_arg & (~1));
23030 this_arg_conv.is_owned = false;
23031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23032 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
23033 uint32_tArray ret_arr = NULL;
23034 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23035 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23036 for (size_t o = 0; o < ret_var.datalen; o++) {
23037 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
23038 *ret_conv_40_conv = ret_var.data[o];
23039 ret_arr_ptr[o] = ((uint32_t)ret_conv_40_conv);
23042 FREE(ret_var.data);
23046 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
23047 LDKChannelMonitor this_arg_conv;
23048 this_arg_conv.inner = (void*)(this_arg & (~1));
23049 this_arg_conv.is_owned = false;
23050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23051 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
23052 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
23053 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
23054 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
23057 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) {
23058 LDKChannelMonitor this_arg_conv;
23059 this_arg_conv.inner = (void*)(this_arg & (~1));
23060 this_arg_conv.is_owned = false;
23061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23062 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
23063 uint32_tArray ret_arr = NULL;
23064 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23065 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23066 for (size_t o = 0; o < ret_var.datalen; o++) {
23067 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23068 *ret_conv_14_copy = ret_var.data[o];
23069 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
23070 ret_arr_ptr[o] = ret_conv_14_ref;
23073 FREE(ret_var.data);
23077 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
23078 LDKChannelMonitor this_arg_conv;
23079 this_arg_conv.inner = (void*)(this_arg & (~1));
23080 this_arg_conv.is_owned = false;
23081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23082 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
23083 uint32_tArray ret_arr = NULL;
23084 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23085 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23086 for (size_t h = 0; h < ret_var.datalen; h++) {
23087 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23088 *ret_conv_7_copy = ret_var.data[h];
23089 uint32_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
23090 ret_arr_ptr[h] = ret_conv_7_ref;
23093 FREE(ret_var.data);
23097 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) {
23098 LDKChannelMonitor this_arg_conv;
23099 this_arg_conv.inner = (void*)(this_arg & (~1));
23100 this_arg_conv.is_owned = false;
23101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23102 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23103 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23104 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23105 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
23106 ptrArray ret_arr = NULL;
23107 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23108 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23109 for (size_t m = 0; m < ret_var.datalen; m++) {
23110 LDKTransaction ret_conv_12_var = ret_var.data[m];
23111 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
23112 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
23113 Transaction_free(ret_conv_12_var);
23114 ret_arr_ptr[m] = ret_conv_12_arr;
23117 FREE(ret_var.data);
23121 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) {
23122 LDKChannelMonitor this_arg_conv;
23123 this_arg_conv.inner = (void*)(this_arg & (~1));
23124 this_arg_conv.is_owned = false;
23125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23126 unsigned char header_arr[80];
23127 CHECK(header->arr_len == 80);
23128 memcpy(header_arr, header->elems, 80); FREE(header);
23129 unsigned char (*header_ref)[80] = &header_arr;
23130 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23131 txdata_constr.datalen = txdata->arr_len;
23132 if (txdata_constr.datalen > 0)
23133 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23135 txdata_constr.data = NULL;
23136 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
23137 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23138 uint32_t txdata_conv_28 = txdata_vals[c];
23139 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23140 CHECK_ACCESS(txdata_conv_28_ptr);
23141 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23142 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23143 txdata_constr.data[c] = txdata_conv_28_conv;
23145 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23146 CHECK_ACCESS(broadcaster_ptr);
23147 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23148 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23149 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23150 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23152 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23153 CHECK_ACCESS(fee_estimator_ptr);
23154 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23155 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23157 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23159 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23160 CHECK_ACCESS(logger_ptr);
23161 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23162 if (logger_conv.free == LDKLogger_JCalls_free) {
23163 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23164 LDKLogger_JCalls_cloned(&logger_conv);
23166 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);
23167 uint32_tArray ret_arr = NULL;
23168 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23169 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23170 for (size_t n = 0; n < ret_var.datalen; n++) {
23171 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23172 *ret_conv_39_conv = ret_var.data[n];
23173 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23176 FREE(ret_var.data);
23180 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) {
23181 LDKChannelMonitor this_arg_conv;
23182 this_arg_conv.inner = (void*)(this_arg & (~1));
23183 this_arg_conv.is_owned = false;
23184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23185 unsigned char header_arr[80];
23186 CHECK(header->arr_len == 80);
23187 memcpy(header_arr, header->elems, 80); FREE(header);
23188 unsigned char (*header_ref)[80] = &header_arr;
23189 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23190 CHECK_ACCESS(broadcaster_ptr);
23191 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23192 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23193 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23194 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23196 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23197 CHECK_ACCESS(fee_estimator_ptr);
23198 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23199 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23201 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23203 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23204 CHECK_ACCESS(logger_ptr);
23205 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23206 if (logger_conv.free == LDKLogger_JCalls_free) {
23207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23208 LDKLogger_JCalls_cloned(&logger_conv);
23210 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23213 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) {
23214 LDKChannelMonitor this_arg_conv;
23215 this_arg_conv.inner = (void*)(this_arg & (~1));
23216 this_arg_conv.is_owned = false;
23217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23218 unsigned char header_arr[80];
23219 CHECK(header->arr_len == 80);
23220 memcpy(header_arr, header->elems, 80); FREE(header);
23221 unsigned char (*header_ref)[80] = &header_arr;
23222 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23223 txdata_constr.datalen = txdata->arr_len;
23224 if (txdata_constr.datalen > 0)
23225 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23227 txdata_constr.data = NULL;
23228 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
23229 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23230 uint32_t txdata_conv_28 = txdata_vals[c];
23231 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23232 CHECK_ACCESS(txdata_conv_28_ptr);
23233 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23234 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23235 txdata_constr.data[c] = txdata_conv_28_conv;
23237 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23238 CHECK_ACCESS(broadcaster_ptr);
23239 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23240 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23241 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23242 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23244 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23245 CHECK_ACCESS(fee_estimator_ptr);
23246 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23247 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23248 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23249 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23251 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23252 CHECK_ACCESS(logger_ptr);
23253 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23254 if (logger_conv.free == LDKLogger_JCalls_free) {
23255 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23256 LDKLogger_JCalls_cloned(&logger_conv);
23258 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);
23259 uint32_tArray ret_arr = NULL;
23260 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23261 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23262 for (size_t n = 0; n < ret_var.datalen; n++) {
23263 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23264 *ret_conv_39_conv = ret_var.data[n];
23265 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23268 FREE(ret_var.data);
23272 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) {
23273 LDKChannelMonitor this_arg_conv;
23274 this_arg_conv.inner = (void*)(this_arg & (~1));
23275 this_arg_conv.is_owned = false;
23276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23277 unsigned char txid_arr[32];
23278 CHECK(txid->arr_len == 32);
23279 memcpy(txid_arr, txid->elems, 32); FREE(txid);
23280 unsigned char (*txid_ref)[32] = &txid_arr;
23281 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23282 CHECK_ACCESS(broadcaster_ptr);
23283 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23284 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23285 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23286 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23288 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23289 CHECK_ACCESS(fee_estimator_ptr);
23290 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23291 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23292 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23293 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23295 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23296 CHECK_ACCESS(logger_ptr);
23297 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23298 if (logger_conv.free == LDKLogger_JCalls_free) {
23299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23300 LDKLogger_JCalls_cloned(&logger_conv);
23302 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
23305 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) {
23306 LDKChannelMonitor this_arg_conv;
23307 this_arg_conv.inner = (void*)(this_arg & (~1));
23308 this_arg_conv.is_owned = false;
23309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23310 unsigned char header_arr[80];
23311 CHECK(header->arr_len == 80);
23312 memcpy(header_arr, header->elems, 80); FREE(header);
23313 unsigned char (*header_ref)[80] = &header_arr;
23314 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23315 CHECK_ACCESS(broadcaster_ptr);
23316 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23317 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23318 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23319 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23321 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23322 CHECK_ACCESS(fee_estimator_ptr);
23323 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23324 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23326 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23328 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23329 CHECK_ACCESS(logger_ptr);
23330 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23331 if (logger_conv.free == LDKLogger_JCalls_free) {
23332 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23333 LDKLogger_JCalls_cloned(&logger_conv);
23335 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23336 uint32_tArray ret_arr = NULL;
23337 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23338 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23339 for (size_t n = 0; n < ret_var.datalen; n++) {
23340 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23341 *ret_conv_39_conv = ret_var.data[n];
23342 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23345 FREE(ret_var.data);
23349 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
23350 LDKChannelMonitor this_arg_conv;
23351 this_arg_conv.inner = (void*)(this_arg & (~1));
23352 this_arg_conv.is_owned = false;
23353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23354 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
23355 ptrArray ret_arr = NULL;
23356 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23357 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23358 for (size_t m = 0; m < ret_var.datalen; m++) {
23359 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
23360 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
23361 ret_arr_ptr[m] = ret_conv_12_arr;
23364 FREE(ret_var.data);
23368 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
23369 LDKChannelMonitor this_arg_conv;
23370 this_arg_conv.inner = (void*)(this_arg & (~1));
23371 this_arg_conv.is_owned = false;
23372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23373 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
23374 uint32_t ret_ref = 0;
23375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23378 ret_ref = (uintptr_t)ret_var.inner;
23379 if (ret_var.is_owned) {
23385 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
23386 LDKChannelMonitor this_arg_conv;
23387 this_arg_conv.inner = (void*)(this_arg & (~1));
23388 this_arg_conv.is_owned = false;
23389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23390 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23391 uint32_tArray ret_arr = NULL;
23392 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23393 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23394 for (size_t j = 0; j < ret_var.datalen; j++) {
23395 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23396 *ret_conv_9_copy = ret_var.data[j];
23397 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
23398 ret_arr_ptr[j] = ret_conv_9_ref;
23401 FREE(ret_var.data);
23405 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
23406 LDKu8slice ser_ref;
23407 ser_ref.datalen = ser->arr_len;
23408 ser_ref.data = ser->elems /* XXX ser leaks */;
23409 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
23410 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23411 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23412 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23413 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23414 return (uint32_t)ret_conv;
23417 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
23418 LDKOutPoint this_obj_conv;
23419 this_obj_conv.inner = (void*)(this_obj & (~1));
23420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23422 OutPoint_free(this_obj_conv);
23425 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
23426 LDKOutPoint this_ptr_conv;
23427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23428 this_ptr_conv.is_owned = false;
23429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23430 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23431 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
23435 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
23436 LDKOutPoint this_ptr_conv;
23437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23438 this_ptr_conv.is_owned = false;
23439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23440 LDKThirtyTwoBytes val_ref;
23441 CHECK(val->arr_len == 32);
23442 memcpy(val_ref.data, val->elems, 32); FREE(val);
23443 OutPoint_set_txid(&this_ptr_conv, val_ref);
23446 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
23447 LDKOutPoint this_ptr_conv;
23448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23449 this_ptr_conv.is_owned = false;
23450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23451 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
23455 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
23456 LDKOutPoint this_ptr_conv;
23457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23458 this_ptr_conv.is_owned = false;
23459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23460 OutPoint_set_index(&this_ptr_conv, val);
23463 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
23464 LDKThirtyTwoBytes txid_arg_ref;
23465 CHECK(txid_arg->arr_len == 32);
23466 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
23467 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23468 uint32_t ret_ref = 0;
23469 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23470 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23472 ret_ref = (uintptr_t)ret_var.inner;
23473 if (ret_var.is_owned) {
23479 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23480 LDKOutPoint ret_var = OutPoint_clone(arg);
23481 uint32_t ret_ref = 0;
23482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23485 ret_ref = (uintptr_t)ret_var.inner;
23486 if (ret_var.is_owned) {
23491 uint32_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
23492 LDKOutPoint arg_conv;
23493 arg_conv.inner = (void*)(arg & (~1));
23494 arg_conv.is_owned = false;
23495 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23496 uint32_t ret_conv = OutPoint_clone_ptr(&arg_conv);
23500 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
23501 LDKOutPoint orig_conv;
23502 orig_conv.inner = (void*)(orig & (~1));
23503 orig_conv.is_owned = false;
23504 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23505 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23506 uint32_t ret_ref = 0;
23507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23510 ret_ref = (uintptr_t)ret_var.inner;
23511 if (ret_var.is_owned) {
23517 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
23518 LDKOutPoint a_conv;
23519 a_conv.inner = (void*)(a & (~1));
23520 a_conv.is_owned = false;
23521 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23522 LDKOutPoint b_conv;
23523 b_conv.inner = (void*)(b & (~1));
23524 b_conv.is_owned = false;
23525 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23526 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
23530 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
23531 LDKOutPoint o_conv;
23532 o_conv.inner = (void*)(o & (~1));
23533 o_conv.is_owned = false;
23534 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23535 int64_t ret_conv = OutPoint_hash(&o_conv);
23539 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
23540 LDKOutPoint this_arg_conv;
23541 this_arg_conv.inner = (void*)(this_arg & (~1));
23542 this_arg_conv.is_owned = false;
23543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23544 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23545 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
23549 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
23550 LDKOutPoint obj_conv;
23551 obj_conv.inner = (void*)(obj & (~1));
23552 obj_conv.is_owned = false;
23553 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23554 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23555 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23556 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23557 CVec_u8Z_free(ret_var);
23561 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
23562 LDKu8slice ser_ref;
23563 ser_ref.datalen = ser->arr_len;
23564 ser_ref.data = ser->elems /* XXX ser leaks */;
23565 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23566 *ret_conv = OutPoint_read(ser_ref);
23567 return (uint32_t)ret_conv;
23570 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
23571 LDKDelayedPaymentOutputDescriptor this_obj_conv;
23572 this_obj_conv.inner = (void*)(this_obj & (~1));
23573 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23575 DelayedPaymentOutputDescriptor_free(this_obj_conv);
23578 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23579 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23581 this_ptr_conv.is_owned = false;
23582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23583 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23584 uint32_t ret_ref = 0;
23585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23588 ret_ref = (uintptr_t)ret_var.inner;
23589 if (ret_var.is_owned) {
23595 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23596 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23598 this_ptr_conv.is_owned = false;
23599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23600 LDKOutPoint val_conv;
23601 val_conv.inner = (void*)(val & (~1));
23602 val_conv.is_owned = (val & 1) || (val == 0);
23603 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23604 val_conv = OutPoint_clone(&val_conv);
23605 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23608 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
23609 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23611 this_ptr_conv.is_owned = false;
23612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23613 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23614 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23618 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23619 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23621 this_ptr_conv.is_owned = false;
23622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23623 LDKPublicKey val_ref;
23624 CHECK(val->arr_len == 33);
23625 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23626 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23629 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
23630 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23632 this_ptr_conv.is_owned = false;
23633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23634 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23638 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23639 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23641 this_ptr_conv.is_owned = false;
23642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23643 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23646 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23647 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23649 this_ptr_conv.is_owned = false;
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23651 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23652 CHECK_ACCESS(val_ptr);
23653 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23654 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23655 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23658 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
23659 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23661 this_ptr_conv.is_owned = false;
23662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23663 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23664 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
23668 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
23669 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23671 this_ptr_conv.is_owned = false;
23672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23673 LDKPublicKey val_ref;
23674 CHECK(val->arr_len == 33);
23675 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23676 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23679 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23680 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23682 this_ptr_conv.is_owned = false;
23683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23684 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23685 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23689 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23690 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23692 this_ptr_conv.is_owned = false;
23693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23694 LDKThirtyTwoBytes val_ref;
23695 CHECK(val->arr_len == 32);
23696 memcpy(val_ref.data, val->elems, 32); FREE(val);
23697 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23700 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23701 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23703 this_ptr_conv.is_owned = false;
23704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23705 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23709 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23710 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23712 this_ptr_conv.is_owned = false;
23713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23714 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23717 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) {
23718 LDKOutPoint outpoint_arg_conv;
23719 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23720 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23721 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23722 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23723 LDKPublicKey per_commitment_point_arg_ref;
23724 CHECK(per_commitment_point_arg->arr_len == 33);
23725 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
23726 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23727 CHECK_ACCESS(output_arg_ptr);
23728 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23729 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23730 LDKPublicKey revocation_pubkey_arg_ref;
23731 CHECK(revocation_pubkey_arg->arr_len == 33);
23732 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
23733 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23734 CHECK(channel_keys_id_arg->arr_len == 32);
23735 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23736 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);
23737 uint32_t ret_ref = 0;
23738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23741 ret_ref = (uintptr_t)ret_var.inner;
23742 if (ret_var.is_owned) {
23748 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23749 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23750 uint32_t ret_ref = 0;
23751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23754 ret_ref = (uintptr_t)ret_var.inner;
23755 if (ret_var.is_owned) {
23760 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
23761 LDKDelayedPaymentOutputDescriptor arg_conv;
23762 arg_conv.inner = (void*)(arg & (~1));
23763 arg_conv.is_owned = false;
23764 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23765 uint32_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23769 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
23770 LDKDelayedPaymentOutputDescriptor orig_conv;
23771 orig_conv.inner = (void*)(orig & (~1));
23772 orig_conv.is_owned = false;
23773 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23774 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
23775 uint32_t ret_ref = 0;
23776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23779 ret_ref = (uintptr_t)ret_var.inner;
23780 if (ret_var.is_owned) {
23786 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
23787 LDKDelayedPaymentOutputDescriptor obj_conv;
23788 obj_conv.inner = (void*)(obj & (~1));
23789 obj_conv.is_owned = false;
23790 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23791 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23792 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23793 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23794 CVec_u8Z_free(ret_var);
23798 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
23799 LDKu8slice ser_ref;
23800 ser_ref.datalen = ser->arr_len;
23801 ser_ref.data = ser->elems /* XXX ser leaks */;
23802 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23803 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23804 return (uint32_t)ret_conv;
23807 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
23808 LDKStaticPaymentOutputDescriptor this_obj_conv;
23809 this_obj_conv.inner = (void*)(this_obj & (~1));
23810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23812 StaticPaymentOutputDescriptor_free(this_obj_conv);
23815 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23816 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23818 this_ptr_conv.is_owned = false;
23819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23820 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23821 uint32_t ret_ref = 0;
23822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23825 ret_ref = (uintptr_t)ret_var.inner;
23826 if (ret_var.is_owned) {
23832 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23833 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23835 this_ptr_conv.is_owned = false;
23836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23837 LDKOutPoint val_conv;
23838 val_conv.inner = (void*)(val & (~1));
23839 val_conv.is_owned = (val & 1) || (val == 0);
23840 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23841 val_conv = OutPoint_clone(&val_conv);
23842 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23845 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23846 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23848 this_ptr_conv.is_owned = false;
23849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23850 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23851 CHECK_ACCESS(val_ptr);
23852 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23853 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23854 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23857 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23858 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23860 this_ptr_conv.is_owned = false;
23861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23862 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23863 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23867 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23868 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23870 this_ptr_conv.is_owned = false;
23871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23872 LDKThirtyTwoBytes val_ref;
23873 CHECK(val->arr_len == 32);
23874 memcpy(val_ref.data, val->elems, 32); FREE(val);
23875 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23878 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23879 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23881 this_ptr_conv.is_owned = false;
23882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23883 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23887 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23888 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23890 this_ptr_conv.is_owned = false;
23891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23892 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23895 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) {
23896 LDKOutPoint outpoint_arg_conv;
23897 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23898 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23899 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23900 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23901 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23902 CHECK_ACCESS(output_arg_ptr);
23903 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23904 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23905 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23906 CHECK(channel_keys_id_arg->arr_len == 32);
23907 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23908 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23909 uint32_t ret_ref = 0;
23910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23913 ret_ref = (uintptr_t)ret_var.inner;
23914 if (ret_var.is_owned) {
23920 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
23921 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
23922 uint32_t ret_ref = 0;
23923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23926 ret_ref = (uintptr_t)ret_var.inner;
23927 if (ret_var.is_owned) {
23932 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
23933 LDKStaticPaymentOutputDescriptor arg_conv;
23934 arg_conv.inner = (void*)(arg & (~1));
23935 arg_conv.is_owned = false;
23936 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23937 uint32_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
23941 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
23942 LDKStaticPaymentOutputDescriptor orig_conv;
23943 orig_conv.inner = (void*)(orig & (~1));
23944 orig_conv.is_owned = false;
23945 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23946 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
23947 uint32_t ret_ref = 0;
23948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23951 ret_ref = (uintptr_t)ret_var.inner;
23952 if (ret_var.is_owned) {
23958 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
23959 LDKStaticPaymentOutputDescriptor obj_conv;
23960 obj_conv.inner = (void*)(obj & (~1));
23961 obj_conv.is_owned = false;
23962 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23963 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
23964 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23965 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23966 CVec_u8Z_free(ret_var);
23970 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
23971 LDKu8slice ser_ref;
23972 ser_ref.datalen = ser->arr_len;
23973 ser_ref.data = ser->elems /* XXX ser leaks */;
23974 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
23975 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
23976 return (uint32_t)ret_conv;
23979 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
23980 if ((this_ptr & 1) != 0) return;
23981 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23982 CHECK_ACCESS(this_ptr_ptr);
23983 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
23984 FREE((void*)this_ptr);
23985 SpendableOutputDescriptor_free(this_ptr_conv);
23988 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
23989 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23990 *ret_copy = SpendableOutputDescriptor_clone(arg);
23991 uint32_t ret_ref = (uintptr_t)ret_copy;
23994 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
23995 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
23996 uint32_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
24000 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
24001 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
24002 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24003 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
24004 uint32_t ret_ref = (uintptr_t)ret_copy;
24008 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
24009 LDKOutPoint outpoint_conv;
24010 outpoint_conv.inner = (void*)(outpoint & (~1));
24011 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
24012 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
24013 outpoint_conv = OutPoint_clone(&outpoint_conv);
24014 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
24015 CHECK_ACCESS(output_ptr);
24016 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
24017 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
24018 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24019 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
24020 uint32_t ret_ref = (uintptr_t)ret_copy;
24024 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
24025 LDKDelayedPaymentOutputDescriptor a_conv;
24026 a_conv.inner = (void*)(a & (~1));
24027 a_conv.is_owned = (a & 1) || (a == 0);
24028 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24029 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
24030 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24031 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
24032 uint32_t ret_ref = (uintptr_t)ret_copy;
24036 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
24037 LDKStaticPaymentOutputDescriptor a_conv;
24038 a_conv.inner = (void*)(a & (~1));
24039 a_conv.is_owned = (a & 1) || (a == 0);
24040 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24041 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
24042 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24043 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
24044 uint32_t ret_ref = (uintptr_t)ret_copy;
24048 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
24049 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
24050 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
24051 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24052 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24053 CVec_u8Z_free(ret_var);
24057 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
24058 LDKu8slice ser_ref;
24059 ser_ref.datalen = ser->arr_len;
24060 ser_ref.data = ser->elems /* XXX ser leaks */;
24061 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
24062 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
24063 return (uint32_t)ret_conv;
24066 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
24067 if ((this_ptr & 1) != 0) return;
24068 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24069 CHECK_ACCESS(this_ptr_ptr);
24070 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
24071 FREE((void*)this_ptr);
24072 BaseSign_free(this_ptr_conv);
24075 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
24076 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24077 *ret_ret = Sign_clone(arg);
24078 return (uint32_t)ret_ret;
24080 uint32_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
24081 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
24082 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
24083 LDKSign* arg_conv = (LDKSign*)arg_ptr;
24084 uint32_t ret_conv = Sign_clone_ptr(arg_conv);
24088 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
24089 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
24090 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
24091 LDKSign* orig_conv = (LDKSign*)orig_ptr;
24092 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24093 *ret_ret = Sign_clone(orig_conv);
24094 return (uint32_t)ret_ret;
24097 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
24098 if ((this_ptr & 1) != 0) return;
24099 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24100 CHECK_ACCESS(this_ptr_ptr);
24101 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
24102 FREE((void*)this_ptr);
24103 Sign_free(this_ptr_conv);
24106 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
24107 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
24108 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
24112 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
24113 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
24117 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
24118 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
24122 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
24123 if ((this_ptr & 1) != 0) return;
24124 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24125 CHECK_ACCESS(this_ptr_ptr);
24126 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
24127 FREE((void*)this_ptr);
24128 KeysInterface_free(this_ptr_conv);
24131 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
24132 LDKInMemorySigner this_obj_conv;
24133 this_obj_conv.inner = (void*)(this_obj & (~1));
24134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24136 InMemorySigner_free(this_obj_conv);
24139 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
24140 LDKInMemorySigner this_ptr_conv;
24141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24142 this_ptr_conv.is_owned = false;
24143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24144 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24145 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
24149 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
24150 LDKInMemorySigner this_ptr_conv;
24151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24152 this_ptr_conv.is_owned = false;
24153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24154 LDKSecretKey val_ref;
24155 CHECK(val->arr_len == 32);
24156 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24157 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
24160 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
24161 LDKInMemorySigner this_ptr_conv;
24162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24163 this_ptr_conv.is_owned = false;
24164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24165 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24166 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
24170 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
24171 LDKInMemorySigner this_ptr_conv;
24172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24173 this_ptr_conv.is_owned = false;
24174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24175 LDKSecretKey val_ref;
24176 CHECK(val->arr_len == 32);
24177 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24178 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
24181 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
24182 LDKInMemorySigner this_ptr_conv;
24183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24184 this_ptr_conv.is_owned = false;
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24186 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24187 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
24191 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
24192 LDKInMemorySigner this_ptr_conv;
24193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24194 this_ptr_conv.is_owned = false;
24195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24196 LDKSecretKey val_ref;
24197 CHECK(val->arr_len == 32);
24198 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24199 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
24202 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
24203 LDKInMemorySigner this_ptr_conv;
24204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24205 this_ptr_conv.is_owned = false;
24206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24207 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24208 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
24212 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) {
24213 LDKInMemorySigner this_ptr_conv;
24214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24215 this_ptr_conv.is_owned = false;
24216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24217 LDKSecretKey val_ref;
24218 CHECK(val->arr_len == 32);
24219 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24220 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
24223 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
24224 LDKInMemorySigner this_ptr_conv;
24225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24226 this_ptr_conv.is_owned = false;
24227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24228 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24229 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
24233 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
24234 LDKInMemorySigner this_ptr_conv;
24235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24236 this_ptr_conv.is_owned = false;
24237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24238 LDKSecretKey val_ref;
24239 CHECK(val->arr_len == 32);
24240 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24241 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
24244 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
24245 LDKInMemorySigner this_ptr_conv;
24246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24247 this_ptr_conv.is_owned = false;
24248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24249 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24250 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
24254 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
24255 LDKInMemorySigner this_ptr_conv;
24256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24257 this_ptr_conv.is_owned = false;
24258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24259 LDKThirtyTwoBytes val_ref;
24260 CHECK(val->arr_len == 32);
24261 memcpy(val_ref.data, val->elems, 32); FREE(val);
24262 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
24265 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
24266 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
24267 uint32_t ret_ref = 0;
24268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24271 ret_ref = (uintptr_t)ret_var.inner;
24272 if (ret_var.is_owned) {
24277 uint32_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
24278 LDKInMemorySigner arg_conv;
24279 arg_conv.inner = (void*)(arg & (~1));
24280 arg_conv.is_owned = false;
24281 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24282 uint32_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
24286 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
24287 LDKInMemorySigner orig_conv;
24288 orig_conv.inner = (void*)(orig & (~1));
24289 orig_conv.is_owned = false;
24290 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24291 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
24292 uint32_t ret_ref = 0;
24293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24296 ret_ref = (uintptr_t)ret_var.inner;
24297 if (ret_var.is_owned) {
24303 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) {
24304 LDKSecretKey node_secret_ref;
24305 CHECK(node_secret->arr_len == 32);
24306 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
24307 LDKSecretKey funding_key_ref;
24308 CHECK(funding_key->arr_len == 32);
24309 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
24310 LDKSecretKey revocation_base_key_ref;
24311 CHECK(revocation_base_key->arr_len == 32);
24312 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
24313 LDKSecretKey payment_key_ref;
24314 CHECK(payment_key->arr_len == 32);
24315 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
24316 LDKSecretKey delayed_payment_base_key_ref;
24317 CHECK(delayed_payment_base_key->arr_len == 32);
24318 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
24319 LDKSecretKey htlc_base_key_ref;
24320 CHECK(htlc_base_key->arr_len == 32);
24321 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
24322 LDKThirtyTwoBytes commitment_seed_ref;
24323 CHECK(commitment_seed->arr_len == 32);
24324 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
24325 LDKThirtyTwoBytes channel_keys_id_ref;
24326 CHECK(channel_keys_id->arr_len == 32);
24327 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
24328 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);
24329 uint32_t ret_ref = 0;
24330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24333 ret_ref = (uintptr_t)ret_var.inner;
24334 if (ret_var.is_owned) {
24340 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
24341 LDKInMemorySigner this_arg_conv;
24342 this_arg_conv.inner = (void*)(this_arg & (~1));
24343 this_arg_conv.is_owned = false;
24344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24345 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
24346 uint32_t ret_ref = 0;
24347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24350 ret_ref = (uintptr_t)ret_var.inner;
24351 if (ret_var.is_owned) {
24357 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
24358 LDKInMemorySigner this_arg_conv;
24359 this_arg_conv.inner = (void*)(this_arg & (~1));
24360 this_arg_conv.is_owned = false;
24361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24362 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
24366 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
24367 LDKInMemorySigner this_arg_conv;
24368 this_arg_conv.inner = (void*)(this_arg & (~1));
24369 this_arg_conv.is_owned = false;
24370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24371 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
24375 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
24376 LDKInMemorySigner this_arg_conv;
24377 this_arg_conv.inner = (void*)(this_arg & (~1));
24378 this_arg_conv.is_owned = false;
24379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24380 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
24384 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
24385 LDKInMemorySigner this_arg_conv;
24386 this_arg_conv.inner = (void*)(this_arg & (~1));
24387 this_arg_conv.is_owned = false;
24388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24389 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24390 uint32_t ret_ref = 0;
24391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24394 ret_ref = (uintptr_t)ret_var.inner;
24395 if (ret_var.is_owned) {
24401 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
24402 LDKInMemorySigner this_arg_conv;
24403 this_arg_conv.inner = (void*)(this_arg & (~1));
24404 this_arg_conv.is_owned = false;
24405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24406 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24407 uint32_t ret_ref = 0;
24408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24411 ret_ref = (uintptr_t)ret_var.inner;
24412 if (ret_var.is_owned) {
24418 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
24419 LDKInMemorySigner this_arg_conv;
24420 this_arg_conv.inner = (void*)(this_arg & (~1));
24421 this_arg_conv.is_owned = false;
24422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24423 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
24427 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) {
24428 LDKInMemorySigner this_arg_conv;
24429 this_arg_conv.inner = (void*)(this_arg & (~1));
24430 this_arg_conv.is_owned = false;
24431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24432 LDKTransaction spend_tx_ref;
24433 spend_tx_ref.datalen = spend_tx->arr_len;
24434 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24435 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24436 spend_tx_ref.data_is_owned = true;
24437 LDKStaticPaymentOutputDescriptor descriptor_conv;
24438 descriptor_conv.inner = (void*)(descriptor & (~1));
24439 descriptor_conv.is_owned = false;
24440 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24441 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24442 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24443 return (uint32_t)ret_conv;
24446 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) {
24447 LDKInMemorySigner this_arg_conv;
24448 this_arg_conv.inner = (void*)(this_arg & (~1));
24449 this_arg_conv.is_owned = false;
24450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24451 LDKTransaction spend_tx_ref;
24452 spend_tx_ref.datalen = spend_tx->arr_len;
24453 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24454 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24455 spend_tx_ref.data_is_owned = true;
24456 LDKDelayedPaymentOutputDescriptor descriptor_conv;
24457 descriptor_conv.inner = (void*)(descriptor & (~1));
24458 descriptor_conv.is_owned = false;
24459 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24460 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24461 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24462 return (uint32_t)ret_conv;
24465 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
24466 LDKInMemorySigner this_arg_conv;
24467 this_arg_conv.inner = (void*)(this_arg & (~1));
24468 this_arg_conv.is_owned = false;
24469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24470 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24471 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24472 return (uint32_t)ret_ret;
24475 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
24476 LDKInMemorySigner this_arg_conv;
24477 this_arg_conv.inner = (void*)(this_arg & (~1));
24478 this_arg_conv.is_owned = false;
24479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24480 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24481 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24482 return (uint32_t)ret_ret;
24485 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
24486 LDKInMemorySigner obj_conv;
24487 obj_conv.inner = (void*)(obj & (~1));
24488 obj_conv.is_owned = false;
24489 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24490 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24491 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24492 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24493 CVec_u8Z_free(ret_var);
24497 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
24498 LDKu8slice ser_ref;
24499 ser_ref.datalen = ser->arr_len;
24500 ser_ref.data = ser->elems /* XXX ser leaks */;
24501 LDKSecretKey arg_ref;
24502 CHECK(arg->arr_len == 32);
24503 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
24504 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24505 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
24506 return (uint32_t)ret_conv;
24509 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
24510 LDKKeysManager this_obj_conv;
24511 this_obj_conv.inner = (void*)(this_obj & (~1));
24512 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24514 KeysManager_free(this_obj_conv);
24517 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
24518 unsigned char seed_arr[32];
24519 CHECK(seed->arr_len == 32);
24520 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24521 unsigned char (*seed_ref)[32] = &seed_arr;
24522 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24523 uint32_t ret_ref = 0;
24524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24527 ret_ref = (uintptr_t)ret_var.inner;
24528 if (ret_var.is_owned) {
24534 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) {
24535 LDKKeysManager this_arg_conv;
24536 this_arg_conv.inner = (void*)(this_arg & (~1));
24537 this_arg_conv.is_owned = false;
24538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24539 unsigned char params_arr[32];
24540 CHECK(params->arr_len == 32);
24541 memcpy(params_arr, params->elems, 32); FREE(params);
24542 unsigned char (*params_ref)[32] = ¶ms_arr;
24543 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24544 uint32_t ret_ref = 0;
24545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24548 ret_ref = (uintptr_t)ret_var.inner;
24549 if (ret_var.is_owned) {
24555 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) {
24556 LDKKeysManager this_arg_conv;
24557 this_arg_conv.inner = (void*)(this_arg & (~1));
24558 this_arg_conv.is_owned = false;
24559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24560 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24561 descriptors_constr.datalen = descriptors->arr_len;
24562 if (descriptors_constr.datalen > 0)
24563 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24565 descriptors_constr.data = NULL;
24566 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
24567 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24568 uint32_t descriptors_conv_27 = descriptors_vals[b];
24569 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24570 CHECK_ACCESS(descriptors_conv_27_ptr);
24571 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24572 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24573 descriptors_constr.data[b] = descriptors_conv_27_conv;
24575 LDKCVec_TxOutZ outputs_constr;
24576 outputs_constr.datalen = outputs->arr_len;
24577 if (outputs_constr.datalen > 0)
24578 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24580 outputs_constr.data = NULL;
24581 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
24582 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24583 uint32_t outputs_conv_7 = outputs_vals[h];
24584 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24585 CHECK_ACCESS(outputs_conv_7_ptr);
24586 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24587 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24588 outputs_constr.data[h] = outputs_conv_7_conv;
24590 LDKCVec_u8Z change_destination_script_ref;
24591 change_destination_script_ref.datalen = change_destination_script->arr_len;
24592 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24593 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24594 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24595 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24596 return (uint32_t)ret_conv;
24599 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
24600 LDKKeysManager this_arg_conv;
24601 this_arg_conv.inner = (void*)(this_arg & (~1));
24602 this_arg_conv.is_owned = false;
24603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24604 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24605 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24606 return (uint32_t)ret_ret;
24609 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
24610 LDKPhantomKeysManager this_obj_conv;
24611 this_obj_conv.inner = (void*)(this_obj & (~1));
24612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24614 PhantomKeysManager_free(this_obj_conv);
24617 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
24618 LDKPhantomKeysManager this_arg_conv;
24619 this_arg_conv.inner = (void*)(this_arg & (~1));
24620 this_arg_conv.is_owned = false;
24621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24622 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24623 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
24624 return (uint32_t)ret_ret;
24627 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) {
24628 unsigned char seed_arr[32];
24629 CHECK(seed->arr_len == 32);
24630 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24631 unsigned char (*seed_ref)[32] = &seed_arr;
24632 unsigned char cross_node_seed_arr[32];
24633 CHECK(cross_node_seed->arr_len == 32);
24634 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
24635 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
24636 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
24637 uint32_t ret_ref = 0;
24638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24641 ret_ref = (uintptr_t)ret_var.inner;
24642 if (ret_var.is_owned) {
24648 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) {
24649 LDKPhantomKeysManager this_arg_conv;
24650 this_arg_conv.inner = (void*)(this_arg & (~1));
24651 this_arg_conv.is_owned = false;
24652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24653 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24654 descriptors_constr.datalen = descriptors->arr_len;
24655 if (descriptors_constr.datalen > 0)
24656 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24658 descriptors_constr.data = NULL;
24659 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
24660 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24661 uint32_t descriptors_conv_27 = descriptors_vals[b];
24662 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24663 CHECK_ACCESS(descriptors_conv_27_ptr);
24664 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24665 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24666 descriptors_constr.data[b] = descriptors_conv_27_conv;
24668 LDKCVec_TxOutZ outputs_constr;
24669 outputs_constr.datalen = outputs->arr_len;
24670 if (outputs_constr.datalen > 0)
24671 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24673 outputs_constr.data = NULL;
24674 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
24675 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24676 uint32_t outputs_conv_7 = outputs_vals[h];
24677 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24678 CHECK_ACCESS(outputs_conv_7_ptr);
24679 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24680 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24681 outputs_constr.data[h] = outputs_conv_7_conv;
24683 LDKCVec_u8Z change_destination_script_ref;
24684 change_destination_script_ref.datalen = change_destination_script->arr_len;
24685 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24686 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24687 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24688 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24689 return (uint32_t)ret_conv;
24692 uint32_t __attribute__((export_name("TS_PhantomKeysManager_derive_channel_keys"))) TS_PhantomKeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
24693 LDKPhantomKeysManager this_arg_conv;
24694 this_arg_conv.inner = (void*)(this_arg & (~1));
24695 this_arg_conv.is_owned = false;
24696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24697 unsigned char params_arr[32];
24698 CHECK(params->arr_len == 32);
24699 memcpy(params_arr, params->elems, 32); FREE(params);
24700 unsigned char (*params_ref)[32] = ¶ms_arr;
24701 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24702 uint32_t ret_ref = 0;
24703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24706 ret_ref = (uintptr_t)ret_var.inner;
24707 if (ret_var.is_owned) {
24713 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
24714 LDKChannelManager this_obj_conv;
24715 this_obj_conv.inner = (void*)(this_obj & (~1));
24716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24718 ChannelManager_free(this_obj_conv);
24721 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
24722 LDKChainParameters this_obj_conv;
24723 this_obj_conv.inner = (void*)(this_obj & (~1));
24724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24726 ChainParameters_free(this_obj_conv);
24729 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
24730 LDKChainParameters this_ptr_conv;
24731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24732 this_ptr_conv.is_owned = false;
24733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24734 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
24738 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
24739 LDKChainParameters this_ptr_conv;
24740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24741 this_ptr_conv.is_owned = false;
24742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24743 LDKNetwork val_conv = LDKNetwork_from_js(val);
24744 ChainParameters_set_network(&this_ptr_conv, val_conv);
24747 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
24748 LDKChainParameters this_ptr_conv;
24749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24750 this_ptr_conv.is_owned = false;
24751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24752 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24753 uint32_t ret_ref = 0;
24754 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24755 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24757 ret_ref = (uintptr_t)ret_var.inner;
24758 if (ret_var.is_owned) {
24764 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
24765 LDKChainParameters this_ptr_conv;
24766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24767 this_ptr_conv.is_owned = false;
24768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24769 LDKBestBlock val_conv;
24770 val_conv.inner = (void*)(val & (~1));
24771 val_conv.is_owned = (val & 1) || (val == 0);
24772 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24773 val_conv = BestBlock_clone(&val_conv);
24774 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24777 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
24778 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
24779 LDKBestBlock best_block_arg_conv;
24780 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
24781 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
24782 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24783 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24784 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24785 uint32_t ret_ref = 0;
24786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24789 ret_ref = (uintptr_t)ret_var.inner;
24790 if (ret_var.is_owned) {
24796 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24797 LDKChainParameters ret_var = ChainParameters_clone(arg);
24798 uint32_t ret_ref = 0;
24799 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24800 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24802 ret_ref = (uintptr_t)ret_var.inner;
24803 if (ret_var.is_owned) {
24808 uint32_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
24809 LDKChainParameters arg_conv;
24810 arg_conv.inner = (void*)(arg & (~1));
24811 arg_conv.is_owned = false;
24812 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24813 uint32_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
24817 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
24818 LDKChainParameters orig_conv;
24819 orig_conv.inner = (void*)(orig & (~1));
24820 orig_conv.is_owned = false;
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24822 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24823 uint32_t ret_ref = 0;
24824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24827 ret_ref = (uintptr_t)ret_var.inner;
24828 if (ret_var.is_owned) {
24834 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
24835 LDKCounterpartyForwardingInfo this_obj_conv;
24836 this_obj_conv.inner = (void*)(this_obj & (~1));
24837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24839 CounterpartyForwardingInfo_free(this_obj_conv);
24842 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
24843 LDKCounterpartyForwardingInfo this_ptr_conv;
24844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24845 this_ptr_conv.is_owned = false;
24846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24847 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24851 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
24852 LDKCounterpartyForwardingInfo this_ptr_conv;
24853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24854 this_ptr_conv.is_owned = false;
24855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24856 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24859 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
24860 LDKCounterpartyForwardingInfo 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 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24868 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
24869 LDKCounterpartyForwardingInfo this_ptr_conv;
24870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24871 this_ptr_conv.is_owned = false;
24872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24873 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24876 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24877 LDKCounterpartyForwardingInfo this_ptr_conv;
24878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24879 this_ptr_conv.is_owned = false;
24880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24881 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24885 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24886 LDKCounterpartyForwardingInfo this_ptr_conv;
24887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24888 this_ptr_conv.is_owned = false;
24889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24890 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24893 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) {
24894 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24895 uint32_t ret_ref = 0;
24896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24899 ret_ref = (uintptr_t)ret_var.inner;
24900 if (ret_var.is_owned) {
24906 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
24907 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
24908 uint32_t ret_ref = 0;
24909 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24910 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24911 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24912 ret_ref = (uintptr_t)ret_var.inner;
24913 if (ret_var.is_owned) {
24918 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
24919 LDKCounterpartyForwardingInfo arg_conv;
24920 arg_conv.inner = (void*)(arg & (~1));
24921 arg_conv.is_owned = false;
24922 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24923 uint32_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
24927 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
24928 LDKCounterpartyForwardingInfo orig_conv;
24929 orig_conv.inner = (void*)(orig & (~1));
24930 orig_conv.is_owned = false;
24931 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24932 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
24933 uint32_t ret_ref = 0;
24934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24937 ret_ref = (uintptr_t)ret_var.inner;
24938 if (ret_var.is_owned) {
24944 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
24945 LDKChannelCounterparty this_obj_conv;
24946 this_obj_conv.inner = (void*)(this_obj & (~1));
24947 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24949 ChannelCounterparty_free(this_obj_conv);
24952 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
24953 LDKChannelCounterparty this_ptr_conv;
24954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24955 this_ptr_conv.is_owned = false;
24956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24957 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24958 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
24962 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
24963 LDKChannelCounterparty this_ptr_conv;
24964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24965 this_ptr_conv.is_owned = false;
24966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24967 LDKPublicKey val_ref;
24968 CHECK(val->arr_len == 33);
24969 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24970 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
24973 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
24974 LDKChannelCounterparty this_ptr_conv;
24975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24976 this_ptr_conv.is_owned = false;
24977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24978 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
24979 uint32_t ret_ref = 0;
24980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24983 ret_ref = (uintptr_t)ret_var.inner;
24984 if (ret_var.is_owned) {
24990 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
24991 LDKChannelCounterparty this_ptr_conv;
24992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24993 this_ptr_conv.is_owned = false;
24994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24995 LDKInitFeatures val_conv;
24996 val_conv.inner = (void*)(val & (~1));
24997 val_conv.is_owned = (val & 1) || (val == 0);
24998 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24999 val_conv = InitFeatures_clone(&val_conv);
25000 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
25003 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25004 LDKChannelCounterparty this_ptr_conv;
25005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25006 this_ptr_conv.is_owned = false;
25007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25008 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
25012 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
25013 LDKChannelCounterparty this_ptr_conv;
25014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25015 this_ptr_conv.is_owned = false;
25016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25017 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
25020 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
25021 LDKChannelCounterparty this_ptr_conv;
25022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25023 this_ptr_conv.is_owned = false;
25024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25025 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
25026 uint32_t ret_ref = 0;
25027 if ((uintptr_t)ret_var.inner > 4096) {
25028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25031 ret_ref = (uintptr_t)ret_var.inner;
25032 if (ret_var.is_owned) {
25039 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
25040 LDKChannelCounterparty this_ptr_conv;
25041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25042 this_ptr_conv.is_owned = false;
25043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25044 LDKCounterpartyForwardingInfo val_conv;
25045 val_conv.inner = (void*)(val & (~1));
25046 val_conv.is_owned = (val & 1) || (val == 0);
25047 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25048 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
25049 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
25052 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint32_t this_ptr) {
25053 LDKChannelCounterparty this_ptr_conv;
25054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25055 this_ptr_conv.is_owned = false;
25056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25057 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25058 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
25059 uint32_t ret_ref = (uintptr_t)ret_copy;
25063 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) {
25064 LDKChannelCounterparty this_ptr_conv;
25065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25066 this_ptr_conv.is_owned = false;
25067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25068 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25069 CHECK_ACCESS(val_ptr);
25070 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25071 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25072 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25075 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint32_t this_ptr) {
25076 LDKChannelCounterparty this_ptr_conv;
25077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25078 this_ptr_conv.is_owned = false;
25079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25080 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25081 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
25082 uint32_t ret_ref = (uintptr_t)ret_copy;
25086 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) {
25087 LDKChannelCounterparty this_ptr_conv;
25088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25089 this_ptr_conv.is_owned = false;
25090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25091 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25092 CHECK_ACCESS(val_ptr);
25093 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25094 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25095 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25098 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) {
25099 LDKPublicKey node_id_arg_ref;
25100 CHECK(node_id_arg->arr_len == 33);
25101 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
25102 LDKInitFeatures features_arg_conv;
25103 features_arg_conv.inner = (void*)(features_arg & (~1));
25104 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25105 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
25106 features_arg_conv = InitFeatures_clone(&features_arg_conv);
25107 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
25108 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
25109 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
25110 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
25111 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
25112 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
25113 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
25114 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
25115 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
25116 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
25117 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
25118 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
25119 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
25120 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);
25121 uint32_t ret_ref = 0;
25122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25125 ret_ref = (uintptr_t)ret_var.inner;
25126 if (ret_var.is_owned) {
25132 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
25133 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
25134 uint32_t ret_ref = 0;
25135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25138 ret_ref = (uintptr_t)ret_var.inner;
25139 if (ret_var.is_owned) {
25144 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
25145 LDKChannelCounterparty arg_conv;
25146 arg_conv.inner = (void*)(arg & (~1));
25147 arg_conv.is_owned = false;
25148 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25149 uint32_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
25153 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
25154 LDKChannelCounterparty orig_conv;
25155 orig_conv.inner = (void*)(orig & (~1));
25156 orig_conv.is_owned = false;
25157 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25158 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
25159 uint32_t ret_ref = 0;
25160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25163 ret_ref = (uintptr_t)ret_var.inner;
25164 if (ret_var.is_owned) {
25170 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
25171 LDKChannelDetails this_obj_conv;
25172 this_obj_conv.inner = (void*)(this_obj & (~1));
25173 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25175 ChannelDetails_free(this_obj_conv);
25178 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
25179 LDKChannelDetails this_ptr_conv;
25180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25181 this_ptr_conv.is_owned = false;
25182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25183 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25184 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
25188 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25189 LDKChannelDetails this_ptr_conv;
25190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25191 this_ptr_conv.is_owned = false;
25192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25193 LDKThirtyTwoBytes val_ref;
25194 CHECK(val->arr_len == 32);
25195 memcpy(val_ref.data, val->elems, 32); FREE(val);
25196 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
25199 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
25200 LDKChannelDetails this_ptr_conv;
25201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25202 this_ptr_conv.is_owned = false;
25203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25204 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
25205 uint32_t ret_ref = 0;
25206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25209 ret_ref = (uintptr_t)ret_var.inner;
25210 if (ret_var.is_owned) {
25216 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
25217 LDKChannelDetails this_ptr_conv;
25218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25219 this_ptr_conv.is_owned = false;
25220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25221 LDKChannelCounterparty val_conv;
25222 val_conv.inner = (void*)(val & (~1));
25223 val_conv.is_owned = (val & 1) || (val == 0);
25224 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25225 val_conv = ChannelCounterparty_clone(&val_conv);
25226 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
25229 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
25230 LDKChannelDetails this_ptr_conv;
25231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25232 this_ptr_conv.is_owned = false;
25233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25234 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
25235 uint32_t ret_ref = 0;
25236 if ((uintptr_t)ret_var.inner > 4096) {
25237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25240 ret_ref = (uintptr_t)ret_var.inner;
25241 if (ret_var.is_owned) {
25248 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
25249 LDKChannelDetails this_ptr_conv;
25250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25251 this_ptr_conv.is_owned = false;
25252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25253 LDKOutPoint val_conv;
25254 val_conv.inner = (void*)(val & (~1));
25255 val_conv.is_owned = (val & 1) || (val == 0);
25256 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25257 val_conv = OutPoint_clone(&val_conv);
25258 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
25261 uint32_t __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint32_t this_ptr) {
25262 LDKChannelDetails this_ptr_conv;
25263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25264 this_ptr_conv.is_owned = false;
25265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25266 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
25267 uint32_t ret_ref = 0;
25268 if ((uintptr_t)ret_var.inner > 4096) {
25269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25272 ret_ref = (uintptr_t)ret_var.inner;
25273 if (ret_var.is_owned) {
25280 void __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint32_t this_ptr, uint32_t val) {
25281 LDKChannelDetails this_ptr_conv;
25282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25283 this_ptr_conv.is_owned = false;
25284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25285 LDKChannelTypeFeatures val_conv;
25286 val_conv.inner = (void*)(val & (~1));
25287 val_conv.is_owned = (val & 1) || (val == 0);
25288 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25289 val_conv = ChannelTypeFeatures_clone(&val_conv);
25290 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
25293 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
25294 LDKChannelDetails this_ptr_conv;
25295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25296 this_ptr_conv.is_owned = false;
25297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25298 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25299 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
25300 uint32_t ret_ref = (uintptr_t)ret_copy;
25304 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
25305 LDKChannelDetails this_ptr_conv;
25306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25307 this_ptr_conv.is_owned = false;
25308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25309 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25310 CHECK_ACCESS(val_ptr);
25311 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25312 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25313 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
25316 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint32_t this_ptr) {
25317 LDKChannelDetails this_ptr_conv;
25318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25319 this_ptr_conv.is_owned = false;
25320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25321 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25322 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
25323 uint32_t ret_ref = (uintptr_t)ret_copy;
25327 void __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25328 LDKChannelDetails this_ptr_conv;
25329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25330 this_ptr_conv.is_owned = false;
25331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25332 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25333 CHECK_ACCESS(val_ptr);
25334 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25335 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25336 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
25339 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint32_t this_ptr) {
25340 LDKChannelDetails this_ptr_conv;
25341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25342 this_ptr_conv.is_owned = false;
25343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25344 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25345 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
25346 uint32_t ret_ref = (uintptr_t)ret_copy;
25350 void __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25351 LDKChannelDetails this_ptr_conv;
25352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25353 this_ptr_conv.is_owned = false;
25354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25355 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25356 CHECK_ACCESS(val_ptr);
25357 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25358 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25359 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
25362 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
25363 LDKChannelDetails this_ptr_conv;
25364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25365 this_ptr_conv.is_owned = false;
25366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25367 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
25371 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
25372 LDKChannelDetails this_ptr_conv;
25373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25374 this_ptr_conv.is_owned = false;
25375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25376 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
25379 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25380 LDKChannelDetails this_ptr_conv;
25381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25382 this_ptr_conv.is_owned = false;
25383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25384 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25385 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
25386 uint32_t ret_ref = (uintptr_t)ret_copy;
25390 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
25391 LDKChannelDetails this_ptr_conv;
25392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25393 this_ptr_conv.is_owned = false;
25394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25395 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25396 CHECK_ACCESS(val_ptr);
25397 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25398 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25399 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
25402 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
25403 LDKChannelDetails this_ptr_conv;
25404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25405 this_ptr_conv.is_owned = false;
25406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25407 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
25411 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
25412 LDKChannelDetails this_ptr_conv;
25413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25414 this_ptr_conv.is_owned = false;
25415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25416 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
25419 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
25420 LDKChannelDetails this_ptr_conv;
25421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25422 this_ptr_conv.is_owned = false;
25423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25424 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
25428 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
25429 LDKChannelDetails this_ptr_conv;
25430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25431 this_ptr_conv.is_owned = false;
25432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25433 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
25436 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
25437 LDKChannelDetails this_ptr_conv;
25438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25439 this_ptr_conv.is_owned = false;
25440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25441 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
25445 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25446 LDKChannelDetails this_ptr_conv;
25447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25448 this_ptr_conv.is_owned = false;
25449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25450 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
25453 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) {
25454 LDKChannelDetails this_ptr_conv;
25455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25456 this_ptr_conv.is_owned = false;
25457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25458 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
25462 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) {
25463 LDKChannelDetails this_ptr_conv;
25464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25465 this_ptr_conv.is_owned = false;
25466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25467 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
25470 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
25471 LDKChannelDetails this_ptr_conv;
25472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25473 this_ptr_conv.is_owned = false;
25474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25475 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
25479 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25480 LDKChannelDetails this_ptr_conv;
25481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25482 this_ptr_conv.is_owned = false;
25483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25484 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
25487 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
25488 LDKChannelDetails this_ptr_conv;
25489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25490 this_ptr_conv.is_owned = false;
25491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25492 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25493 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
25494 uint32_t ret_ref = (uintptr_t)ret_copy;
25498 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
25499 LDKChannelDetails this_ptr_conv;
25500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25501 this_ptr_conv.is_owned = false;
25502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25503 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25504 CHECK_ACCESS(val_ptr);
25505 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25506 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
25507 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25510 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
25511 LDKChannelDetails this_ptr_conv;
25512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25513 this_ptr_conv.is_owned = false;
25514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25515 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25516 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25517 uint32_t ret_ref = (uintptr_t)ret_copy;
25521 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) {
25522 LDKChannelDetails this_ptr_conv;
25523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25524 this_ptr_conv.is_owned = false;
25525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25526 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25527 CHECK_ACCESS(val_ptr);
25528 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25529 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
25530 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25533 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
25534 LDKChannelDetails this_ptr_conv;
25535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25536 this_ptr_conv.is_owned = false;
25537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25538 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
25542 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
25543 LDKChannelDetails this_ptr_conv;
25544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25545 this_ptr_conv.is_owned = false;
25546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25547 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25550 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint32_t this_ptr) {
25551 LDKChannelDetails this_ptr_conv;
25552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25553 this_ptr_conv.is_owned = false;
25554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25555 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
25559 void __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint32_t this_ptr, jboolean val) {
25560 LDKChannelDetails this_ptr_conv;
25561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25562 this_ptr_conv.is_owned = false;
25563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25564 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
25567 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
25568 LDKChannelDetails this_ptr_conv;
25569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25570 this_ptr_conv.is_owned = false;
25571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25572 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
25576 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
25577 LDKChannelDetails this_ptr_conv;
25578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25579 this_ptr_conv.is_owned = false;
25580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25581 ChannelDetails_set_is_usable(&this_ptr_conv, val);
25584 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
25585 LDKChannelDetails this_ptr_conv;
25586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25587 this_ptr_conv.is_owned = false;
25588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25589 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
25593 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
25594 LDKChannelDetails this_ptr_conv;
25595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25596 this_ptr_conv.is_owned = false;
25597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25598 ChannelDetails_set_is_public(&this_ptr_conv, val);
25601 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint32_t this_ptr) {
25602 LDKChannelDetails this_ptr_conv;
25603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25604 this_ptr_conv.is_owned = false;
25605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25606 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25607 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
25608 uint32_t ret_ref = (uintptr_t)ret_copy;
25612 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) {
25613 LDKChannelDetails this_ptr_conv;
25614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25615 this_ptr_conv.is_owned = false;
25616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25617 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25618 CHECK_ACCESS(val_ptr);
25619 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25620 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25621 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25624 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint32_t this_ptr) {
25625 LDKChannelDetails this_ptr_conv;
25626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25627 this_ptr_conv.is_owned = false;
25628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25629 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25630 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
25631 uint32_t ret_ref = (uintptr_t)ret_copy;
25635 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) {
25636 LDKChannelDetails this_ptr_conv;
25637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25638 this_ptr_conv.is_owned = false;
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25640 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25641 CHECK_ACCESS(val_ptr);
25642 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25643 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25644 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25647 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) {
25648 LDKThirtyTwoBytes channel_id_arg_ref;
25649 CHECK(channel_id_arg->arr_len == 32);
25650 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25651 LDKChannelCounterparty counterparty_arg_conv;
25652 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
25653 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
25654 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25655 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25656 LDKOutPoint funding_txo_arg_conv;
25657 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
25658 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
25659 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25660 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25661 LDKChannelTypeFeatures channel_type_arg_conv;
25662 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
25663 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
25664 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
25665 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
25666 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
25667 CHECK_ACCESS(short_channel_id_arg_ptr);
25668 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25669 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
25670 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
25671 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
25672 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
25673 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
25674 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
25675 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
25676 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
25677 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
25678 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
25679 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25680 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25681 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
25682 CHECK_ACCESS(confirmations_required_arg_ptr);
25683 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25684 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
25685 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
25686 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25687 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25688 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
25689 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
25690 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
25691 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
25692 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
25693 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
25694 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
25695 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
25696 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
25697 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);
25698 uint32_t ret_ref = 0;
25699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25702 ret_ref = (uintptr_t)ret_var.inner;
25703 if (ret_var.is_owned) {
25709 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25710 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25711 uint32_t ret_ref = 0;
25712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25715 ret_ref = (uintptr_t)ret_var.inner;
25716 if (ret_var.is_owned) {
25721 uint32_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
25722 LDKChannelDetails arg_conv;
25723 arg_conv.inner = (void*)(arg & (~1));
25724 arg_conv.is_owned = false;
25725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25726 uint32_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
25730 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
25731 LDKChannelDetails orig_conv;
25732 orig_conv.inner = (void*)(orig & (~1));
25733 orig_conv.is_owned = false;
25734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25735 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25736 uint32_t ret_ref = 0;
25737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25740 ret_ref = (uintptr_t)ret_var.inner;
25741 if (ret_var.is_owned) {
25747 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint32_t this_arg) {
25748 LDKChannelDetails this_arg_conv;
25749 this_arg_conv.inner = (void*)(this_arg & (~1));
25750 this_arg_conv.is_owned = false;
25751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25752 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25753 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
25754 uint32_t ret_ref = (uintptr_t)ret_copy;
25758 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint32_t this_arg) {
25759 LDKChannelDetails this_arg_conv;
25760 this_arg_conv.inner = (void*)(this_arg & (~1));
25761 this_arg_conv.is_owned = false;
25762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25763 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25764 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
25765 uint32_t ret_ref = (uintptr_t)ret_copy;
25769 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
25770 if ((this_ptr & 1) != 0) return;
25771 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25772 CHECK_ACCESS(this_ptr_ptr);
25773 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25774 FREE((void*)this_ptr);
25775 PaymentSendFailure_free(this_ptr_conv);
25778 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25779 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25780 *ret_copy = PaymentSendFailure_clone(arg);
25781 uint32_t ret_ref = (uintptr_t)ret_copy;
25784 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
25785 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
25786 uint32_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
25790 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
25791 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
25792 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25793 *ret_copy = PaymentSendFailure_clone(orig_conv);
25794 uint32_t ret_ref = (uintptr_t)ret_copy;
25798 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
25799 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
25800 CHECK_ACCESS(a_ptr);
25801 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25802 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
25803 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25804 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25805 uint32_t ret_ref = (uintptr_t)ret_copy;
25809 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
25810 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25811 a_constr.datalen = a->arr_len;
25812 if (a_constr.datalen > 0)
25813 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25815 a_constr.data = NULL;
25816 uint32_t* a_vals = a->elems /* XXX a leaks */;
25817 for (size_t w = 0; w < a_constr.datalen; w++) {
25818 uint32_t a_conv_22 = a_vals[w];
25819 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
25820 CHECK_ACCESS(a_conv_22_ptr);
25821 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25822 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
25823 a_constr.data[w] = a_conv_22_conv;
25825 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25826 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25827 uint32_t ret_ref = (uintptr_t)ret_copy;
25831 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
25832 LDKCVec_APIErrorZ a_constr;
25833 a_constr.datalen = a->arr_len;
25834 if (a_constr.datalen > 0)
25835 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25837 a_constr.data = NULL;
25838 uint32_t* a_vals = a->elems /* XXX a leaks */;
25839 for (size_t k = 0; k < a_constr.datalen; k++) {
25840 uint32_t a_conv_10 = a_vals[k];
25841 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
25842 CHECK_ACCESS(a_conv_10_ptr);
25843 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25844 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
25845 a_constr.data[k] = a_conv_10_conv;
25847 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25848 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25849 uint32_t ret_ref = (uintptr_t)ret_copy;
25853 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) {
25854 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25855 results_constr.datalen = results->arr_len;
25856 if (results_constr.datalen > 0)
25857 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25859 results_constr.data = NULL;
25860 uint32_t* results_vals = results->elems /* XXX results leaks */;
25861 for (size_t w = 0; w < results_constr.datalen; w++) {
25862 uint32_t results_conv_22 = results_vals[w];
25863 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
25864 CHECK_ACCESS(results_conv_22_ptr);
25865 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25866 results_constr.data[w] = results_conv_22_conv;
25868 LDKRouteParameters failed_paths_retry_conv;
25869 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
25870 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
25871 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25872 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25873 LDKThirtyTwoBytes payment_id_ref;
25874 CHECK(payment_id->arr_len == 32);
25875 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25876 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25877 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25878 uint32_t ret_ref = (uintptr_t)ret_copy;
25882 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
25883 LDKPhantomRouteHints this_obj_conv;
25884 this_obj_conv.inner = (void*)(this_obj & (~1));
25885 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25887 PhantomRouteHints_free(this_obj_conv);
25890 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
25891 LDKPhantomRouteHints this_ptr_conv;
25892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25893 this_ptr_conv.is_owned = false;
25894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25895 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
25896 uint32_tArray ret_arr = NULL;
25897 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
25898 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
25899 for (size_t q = 0; q < ret_var.datalen; q++) {
25900 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25901 uint32_t ret_conv_16_ref = 0;
25902 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25903 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25905 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
25906 if (ret_conv_16_var.is_owned) {
25907 ret_conv_16_ref |= 1;
25909 ret_arr_ptr[q] = ret_conv_16_ref;
25912 FREE(ret_var.data);
25916 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
25917 LDKPhantomRouteHints this_ptr_conv;
25918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25919 this_ptr_conv.is_owned = false;
25920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25921 LDKCVec_ChannelDetailsZ val_constr;
25922 val_constr.datalen = val->arr_len;
25923 if (val_constr.datalen > 0)
25924 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25926 val_constr.data = NULL;
25927 uint32_t* val_vals = val->elems /* XXX val leaks */;
25928 for (size_t q = 0; q < val_constr.datalen; q++) {
25929 uint32_t val_conv_16 = val_vals[q];
25930 LDKChannelDetails val_conv_16_conv;
25931 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
25932 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
25933 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
25934 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
25935 val_constr.data[q] = val_conv_16_conv;
25937 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
25940 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
25941 LDKPhantomRouteHints this_ptr_conv;
25942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25943 this_ptr_conv.is_owned = false;
25944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25945 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
25949 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
25950 LDKPhantomRouteHints this_ptr_conv;
25951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25952 this_ptr_conv.is_owned = false;
25953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25954 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
25957 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
25958 LDKPhantomRouteHints this_ptr_conv;
25959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25960 this_ptr_conv.is_owned = false;
25961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25962 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25963 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
25967 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
25968 LDKPhantomRouteHints this_ptr_conv;
25969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25970 this_ptr_conv.is_owned = false;
25971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25972 LDKPublicKey val_ref;
25973 CHECK(val->arr_len == 33);
25974 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25975 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
25978 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) {
25979 LDKCVec_ChannelDetailsZ channels_arg_constr;
25980 channels_arg_constr.datalen = channels_arg->arr_len;
25981 if (channels_arg_constr.datalen > 0)
25982 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25984 channels_arg_constr.data = NULL;
25985 uint32_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
25986 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
25987 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
25988 LDKChannelDetails channels_arg_conv_16_conv;
25989 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
25990 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
25991 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
25992 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
25993 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
25995 LDKPublicKey real_node_pubkey_arg_ref;
25996 CHECK(real_node_pubkey_arg->arr_len == 33);
25997 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
25998 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
25999 uint32_t ret_ref = 0;
26000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26003 ret_ref = (uintptr_t)ret_var.inner;
26004 if (ret_var.is_owned) {
26010 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
26011 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
26012 uint32_t ret_ref = 0;
26013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26016 ret_ref = (uintptr_t)ret_var.inner;
26017 if (ret_var.is_owned) {
26022 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
26023 LDKPhantomRouteHints arg_conv;
26024 arg_conv.inner = (void*)(arg & (~1));
26025 arg_conv.is_owned = false;
26026 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26027 uint32_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
26031 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
26032 LDKPhantomRouteHints orig_conv;
26033 orig_conv.inner = (void*)(orig & (~1));
26034 orig_conv.is_owned = false;
26035 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26036 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
26037 uint32_t ret_ref = 0;
26038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26041 ret_ref = (uintptr_t)ret_var.inner;
26042 if (ret_var.is_owned) {
26048 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) {
26049 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
26050 CHECK_ACCESS(fee_est_ptr);
26051 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
26052 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
26053 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26054 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
26056 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
26057 CHECK_ACCESS(chain_monitor_ptr);
26058 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26059 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26060 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26061 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26063 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
26064 CHECK_ACCESS(tx_broadcaster_ptr);
26065 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26066 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26067 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26068 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26070 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26071 CHECK_ACCESS(logger_ptr);
26072 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26073 if (logger_conv.free == LDKLogger_JCalls_free) {
26074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26075 LDKLogger_JCalls_cloned(&logger_conv);
26077 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26078 CHECK_ACCESS(keys_manager_ptr);
26079 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26080 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26082 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26084 LDKUserConfig config_conv;
26085 config_conv.inner = (void*)(config & (~1));
26086 config_conv.is_owned = (config & 1) || (config == 0);
26087 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26088 config_conv = UserConfig_clone(&config_conv);
26089 LDKChainParameters params_conv;
26090 params_conv.inner = (void*)(params & (~1));
26091 params_conv.is_owned = (params & 1) || (params == 0);
26092 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
26093 params_conv = ChainParameters_clone(¶ms_conv);
26094 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
26095 uint32_t ret_ref = 0;
26096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26099 ret_ref = (uintptr_t)ret_var.inner;
26100 if (ret_var.is_owned) {
26106 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
26107 LDKChannelManager this_arg_conv;
26108 this_arg_conv.inner = (void*)(this_arg & (~1));
26109 this_arg_conv.is_owned = false;
26110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26111 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
26112 uint32_t ret_ref = 0;
26113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26116 ret_ref = (uintptr_t)ret_var.inner;
26117 if (ret_var.is_owned) {
26123 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) {
26124 LDKChannelManager this_arg_conv;
26125 this_arg_conv.inner = (void*)(this_arg & (~1));
26126 this_arg_conv.is_owned = false;
26127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26128 LDKPublicKey their_network_key_ref;
26129 CHECK(their_network_key->arr_len == 33);
26130 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
26131 LDKUserConfig override_config_conv;
26132 override_config_conv.inner = (void*)(override_config & (~1));
26133 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
26134 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
26135 override_config_conv = UserConfig_clone(&override_config_conv);
26136 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
26137 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
26138 return (uint32_t)ret_conv;
26141 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
26142 LDKChannelManager this_arg_conv;
26143 this_arg_conv.inner = (void*)(this_arg & (~1));
26144 this_arg_conv.is_owned = false;
26145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26146 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
26147 uint32_tArray ret_arr = NULL;
26148 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26149 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26150 for (size_t q = 0; q < ret_var.datalen; q++) {
26151 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26152 uint32_t ret_conv_16_ref = 0;
26153 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26154 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26156 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26157 if (ret_conv_16_var.is_owned) {
26158 ret_conv_16_ref |= 1;
26160 ret_arr_ptr[q] = ret_conv_16_ref;
26163 FREE(ret_var.data);
26167 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
26168 LDKChannelManager this_arg_conv;
26169 this_arg_conv.inner = (void*)(this_arg & (~1));
26170 this_arg_conv.is_owned = false;
26171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26172 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
26173 uint32_tArray ret_arr = NULL;
26174 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26175 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26176 for (size_t q = 0; q < ret_var.datalen; q++) {
26177 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26178 uint32_t ret_conv_16_ref = 0;
26179 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26180 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26182 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26183 if (ret_conv_16_var.is_owned) {
26184 ret_conv_16_ref |= 1;
26186 ret_arr_ptr[q] = ret_conv_16_ref;
26189 FREE(ret_var.data);
26193 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) {
26194 LDKChannelManager this_arg_conv;
26195 this_arg_conv.inner = (void*)(this_arg & (~1));
26196 this_arg_conv.is_owned = false;
26197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26198 unsigned char channel_id_arr[32];
26199 CHECK(channel_id->arr_len == 32);
26200 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26201 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26202 LDKPublicKey counterparty_node_id_ref;
26203 CHECK(counterparty_node_id->arr_len == 33);
26204 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26205 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26206 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26207 return (uint32_t)ret_conv;
26210 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) {
26211 LDKChannelManager this_arg_conv;
26212 this_arg_conv.inner = (void*)(this_arg & (~1));
26213 this_arg_conv.is_owned = false;
26214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26215 unsigned char channel_id_arr[32];
26216 CHECK(channel_id->arr_len == 32);
26217 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26218 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26219 LDKPublicKey counterparty_node_id_ref;
26220 CHECK(counterparty_node_id->arr_len == 33);
26221 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26222 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26223 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
26224 return (uint32_t)ret_conv;
26227 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
26228 LDKChannelManager this_arg_conv;
26229 this_arg_conv.inner = (void*)(this_arg & (~1));
26230 this_arg_conv.is_owned = false;
26231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26232 unsigned char channel_id_arr[32];
26233 CHECK(channel_id->arr_len == 32);
26234 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26235 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26236 LDKPublicKey counterparty_node_id_ref;
26237 CHECK(counterparty_node_id->arr_len == 33);
26238 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26239 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26240 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26241 return (uint32_t)ret_conv;
26244 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
26245 LDKChannelManager this_arg_conv;
26246 this_arg_conv.inner = (void*)(this_arg & (~1));
26247 this_arg_conv.is_owned = false;
26248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26249 ChannelManager_force_close_all_channels(&this_arg_conv);
26252 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) {
26253 LDKChannelManager this_arg_conv;
26254 this_arg_conv.inner = (void*)(this_arg & (~1));
26255 this_arg_conv.is_owned = false;
26256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26257 LDKRoute route_conv;
26258 route_conv.inner = (void*)(route & (~1));
26259 route_conv.is_owned = false;
26260 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26261 LDKThirtyTwoBytes payment_hash_ref;
26262 CHECK(payment_hash->arr_len == 32);
26263 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26264 LDKThirtyTwoBytes payment_secret_ref;
26265 CHECK(payment_secret->arr_len == 32);
26266 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26267 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
26268 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
26269 return (uint32_t)ret_conv;
26272 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
26273 LDKChannelManager this_arg_conv;
26274 this_arg_conv.inner = (void*)(this_arg & (~1));
26275 this_arg_conv.is_owned = false;
26276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26277 LDKRoute route_conv;
26278 route_conv.inner = (void*)(route & (~1));
26279 route_conv.is_owned = false;
26280 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26281 LDKThirtyTwoBytes payment_id_ref;
26282 CHECK(payment_id->arr_len == 32);
26283 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26284 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
26285 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
26286 return (uint32_t)ret_conv;
26289 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
26290 LDKChannelManager this_arg_conv;
26291 this_arg_conv.inner = (void*)(this_arg & (~1));
26292 this_arg_conv.is_owned = false;
26293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26294 LDKThirtyTwoBytes payment_id_ref;
26295 CHECK(payment_id->arr_len == 32);
26296 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26297 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
26300 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) {
26301 LDKChannelManager this_arg_conv;
26302 this_arg_conv.inner = (void*)(this_arg & (~1));
26303 this_arg_conv.is_owned = false;
26304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26305 LDKRoute route_conv;
26306 route_conv.inner = (void*)(route & (~1));
26307 route_conv.is_owned = false;
26308 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26309 LDKThirtyTwoBytes payment_preimage_ref;
26310 CHECK(payment_preimage->arr_len == 32);
26311 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26312 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
26313 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
26314 return (uint32_t)ret_conv;
26317 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) {
26318 LDKChannelManager this_arg_conv;
26319 this_arg_conv.inner = (void*)(this_arg & (~1));
26320 this_arg_conv.is_owned = false;
26321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26322 unsigned char temporary_channel_id_arr[32];
26323 CHECK(temporary_channel_id->arr_len == 32);
26324 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26325 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26326 LDKPublicKey counterparty_node_id_ref;
26327 CHECK(counterparty_node_id->arr_len == 33);
26328 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26329 LDKTransaction funding_transaction_ref;
26330 funding_transaction_ref.datalen = funding_transaction->arr_len;
26331 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
26332 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
26333 funding_transaction_ref.data_is_owned = true;
26334 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26335 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
26336 return (uint32_t)ret_conv;
26339 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) {
26340 LDKChannelManager this_arg_conv;
26341 this_arg_conv.inner = (void*)(this_arg & (~1));
26342 this_arg_conv.is_owned = false;
26343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26344 LDKThreeBytes rgb_ref;
26345 CHECK(rgb->arr_len == 3);
26346 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
26347 LDKThirtyTwoBytes alias_ref;
26348 CHECK(alias->arr_len == 32);
26349 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
26350 LDKCVec_NetAddressZ addresses_constr;
26351 addresses_constr.datalen = addresses->arr_len;
26352 if (addresses_constr.datalen > 0)
26353 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26355 addresses_constr.data = NULL;
26356 uint32_t* addresses_vals = addresses->elems /* XXX addresses leaks */;
26357 for (size_t m = 0; m < addresses_constr.datalen; m++) {
26358 uint32_t addresses_conv_12 = addresses_vals[m];
26359 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
26360 CHECK_ACCESS(addresses_conv_12_ptr);
26361 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
26362 addresses_constr.data[m] = addresses_conv_12_conv;
26364 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
26367 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
26368 LDKChannelManager this_arg_conv;
26369 this_arg_conv.inner = (void*)(this_arg & (~1));
26370 this_arg_conv.is_owned = false;
26371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26372 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
26375 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
26376 LDKChannelManager this_arg_conv;
26377 this_arg_conv.inner = (void*)(this_arg & (~1));
26378 this_arg_conv.is_owned = false;
26379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26380 ChannelManager_timer_tick_occurred(&this_arg_conv);
26383 void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
26384 LDKChannelManager this_arg_conv;
26385 this_arg_conv.inner = (void*)(this_arg & (~1));
26386 this_arg_conv.is_owned = false;
26387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26388 unsigned char payment_hash_arr[32];
26389 CHECK(payment_hash->arr_len == 32);
26390 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
26391 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
26392 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
26395 void __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
26396 LDKChannelManager this_arg_conv;
26397 this_arg_conv.inner = (void*)(this_arg & (~1));
26398 this_arg_conv.is_owned = false;
26399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26400 LDKThirtyTwoBytes payment_preimage_ref;
26401 CHECK(payment_preimage->arr_len == 32);
26402 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26403 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
26406 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
26407 LDKChannelManager this_arg_conv;
26408 this_arg_conv.inner = (void*)(this_arg & (~1));
26409 this_arg_conv.is_owned = false;
26410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26411 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26412 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
26416 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) {
26417 LDKChannelManager this_arg_conv;
26418 this_arg_conv.inner = (void*)(this_arg & (~1));
26419 this_arg_conv.is_owned = false;
26420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26421 unsigned char temporary_channel_id_arr[32];
26422 CHECK(temporary_channel_id->arr_len == 32);
26423 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26424 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26425 LDKPublicKey counterparty_node_id_ref;
26426 CHECK(counterparty_node_id->arr_len == 33);
26427 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26428 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26429 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26430 return (uint32_t)ret_conv;
26433 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) {
26434 LDKChannelManager this_arg_conv;
26435 this_arg_conv.inner = (void*)(this_arg & (~1));
26436 this_arg_conv.is_owned = false;
26437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26438 unsigned char temporary_channel_id_arr[32];
26439 CHECK(temporary_channel_id->arr_len == 32);
26440 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26441 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26442 LDKPublicKey counterparty_node_id_ref;
26443 CHECK(counterparty_node_id->arr_len == 33);
26444 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26445 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26446 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26447 return (uint32_t)ret_conv;
26450 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) {
26451 LDKChannelManager this_arg_conv;
26452 this_arg_conv.inner = (void*)(this_arg & (~1));
26453 this_arg_conv.is_owned = false;
26454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26455 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26456 CHECK_ACCESS(min_value_msat_ptr);
26457 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26458 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26459 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26460 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26461 return (uint32_t)ret_conv;
26464 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) {
26465 LDKChannelManager this_arg_conv;
26466 this_arg_conv.inner = (void*)(this_arg & (~1));
26467 this_arg_conv.is_owned = false;
26468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26469 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26470 CHECK_ACCESS(min_value_msat_ptr);
26471 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26472 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26473 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
26474 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26475 return (uint32_t)ret_conv;
26478 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) {
26479 LDKChannelManager this_arg_conv;
26480 this_arg_conv.inner = (void*)(this_arg & (~1));
26481 this_arg_conv.is_owned = false;
26482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26483 LDKThirtyTwoBytes payment_hash_ref;
26484 CHECK(payment_hash->arr_len == 32);
26485 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26486 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26487 CHECK_ACCESS(min_value_msat_ptr);
26488 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26489 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26490 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26491 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26492 return (uint32_t)ret_conv;
26495 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) {
26496 LDKChannelManager this_arg_conv;
26497 this_arg_conv.inner = (void*)(this_arg & (~1));
26498 this_arg_conv.is_owned = false;
26499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26500 LDKThirtyTwoBytes payment_hash_ref;
26501 CHECK(payment_hash->arr_len == 32);
26502 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26503 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26504 CHECK_ACCESS(min_value_msat_ptr);
26505 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26506 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26507 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
26508 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26509 return (uint32_t)ret_conv;
26512 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) {
26513 LDKChannelManager this_arg_conv;
26514 this_arg_conv.inner = (void*)(this_arg & (~1));
26515 this_arg_conv.is_owned = false;
26516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26517 LDKThirtyTwoBytes payment_hash_ref;
26518 CHECK(payment_hash->arr_len == 32);
26519 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26520 LDKThirtyTwoBytes payment_secret_ref;
26521 CHECK(payment_secret->arr_len == 32);
26522 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26523 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
26524 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
26525 return (uint32_t)ret_conv;
26528 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
26529 LDKChannelManager this_arg_conv;
26530 this_arg_conv.inner = (void*)(this_arg & (~1));
26531 this_arg_conv.is_owned = false;
26532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26533 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
26537 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
26538 LDKChannelManager this_arg_conv;
26539 this_arg_conv.inner = (void*)(this_arg & (~1));
26540 this_arg_conv.is_owned = false;
26541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26542 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
26543 uint32_t ret_ref = 0;
26544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26547 ret_ref = (uintptr_t)ret_var.inner;
26548 if (ret_var.is_owned) {
26554 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
26555 LDKChannelManager this_arg_conv;
26556 this_arg_conv.inner = (void*)(this_arg & (~1));
26557 this_arg_conv.is_owned = false;
26558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26559 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26560 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
26561 return (uint32_t)ret_ret;
26564 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
26565 LDKChannelManager this_arg_conv;
26566 this_arg_conv.inner = (void*)(this_arg & (~1));
26567 this_arg_conv.is_owned = false;
26568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26569 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26570 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
26571 return (uint32_t)ret_ret;
26574 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
26575 LDKChannelManager this_arg_conv;
26576 this_arg_conv.inner = (void*)(this_arg & (~1));
26577 this_arg_conv.is_owned = false;
26578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26579 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26580 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
26581 return (uint32_t)ret_ret;
26584 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
26585 LDKChannelManager this_arg_conv;
26586 this_arg_conv.inner = (void*)(this_arg & (~1));
26587 this_arg_conv.is_owned = false;
26588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26589 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26590 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
26591 return (uint32_t)ret_ret;
26594 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
26595 LDKChannelManager this_arg_conv;
26596 this_arg_conv.inner = (void*)(this_arg & (~1));
26597 this_arg_conv.is_owned = false;
26598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26599 ChannelManager_await_persistable_update(&this_arg_conv);
26602 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
26603 LDKChannelManager this_arg_conv;
26604 this_arg_conv.inner = (void*)(this_arg & (~1));
26605 this_arg_conv.is_owned = false;
26606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26607 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
26608 uint32_t ret_ref = 0;
26609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26612 ret_ref = (uintptr_t)ret_var.inner;
26613 if (ret_var.is_owned) {
26619 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
26620 LDKChannelManager this_arg_conv;
26621 this_arg_conv.inner = (void*)(this_arg & (~1));
26622 this_arg_conv.is_owned = false;
26623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26624 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26625 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
26626 return (uint32_t)ret_ret;
26629 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
26630 LDKCounterpartyForwardingInfo obj_conv;
26631 obj_conv.inner = (void*)(obj & (~1));
26632 obj_conv.is_owned = false;
26633 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26634 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
26635 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26636 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26637 CVec_u8Z_free(ret_var);
26641 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
26642 LDKu8slice ser_ref;
26643 ser_ref.datalen = ser->arr_len;
26644 ser_ref.data = ser->elems /* XXX ser leaks */;
26645 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26646 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
26647 return (uint32_t)ret_conv;
26650 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
26651 LDKChannelCounterparty obj_conv;
26652 obj_conv.inner = (void*)(obj & (~1));
26653 obj_conv.is_owned = false;
26654 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26655 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
26656 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26657 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26658 CVec_u8Z_free(ret_var);
26662 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
26663 LDKu8slice ser_ref;
26664 ser_ref.datalen = ser->arr_len;
26665 ser_ref.data = ser->elems /* XXX ser leaks */;
26666 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26667 *ret_conv = ChannelCounterparty_read(ser_ref);
26668 return (uint32_t)ret_conv;
26671 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
26672 LDKChannelDetails obj_conv;
26673 obj_conv.inner = (void*)(obj & (~1));
26674 obj_conv.is_owned = false;
26675 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26676 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
26677 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26678 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26679 CVec_u8Z_free(ret_var);
26683 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
26684 LDKu8slice ser_ref;
26685 ser_ref.datalen = ser->arr_len;
26686 ser_ref.data = ser->elems /* XXX ser leaks */;
26687 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26688 *ret_conv = ChannelDetails_read(ser_ref);
26689 return (uint32_t)ret_conv;
26692 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
26693 LDKPhantomRouteHints obj_conv;
26694 obj_conv.inner = (void*)(obj & (~1));
26695 obj_conv.is_owned = false;
26696 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26697 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
26698 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26699 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26700 CVec_u8Z_free(ret_var);
26704 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
26705 LDKu8slice ser_ref;
26706 ser_ref.datalen = ser->arr_len;
26707 ser_ref.data = ser->elems /* XXX ser leaks */;
26708 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26709 *ret_conv = PhantomRouteHints_read(ser_ref);
26710 return (uint32_t)ret_conv;
26713 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
26714 LDKChannelManager obj_conv;
26715 obj_conv.inner = (void*)(obj & (~1));
26716 obj_conv.is_owned = false;
26717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26718 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
26719 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26720 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26721 CVec_u8Z_free(ret_var);
26725 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
26726 LDKChannelManagerReadArgs this_obj_conv;
26727 this_obj_conv.inner = (void*)(this_obj & (~1));
26728 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26730 ChannelManagerReadArgs_free(this_obj_conv);
26733 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
26734 LDKChannelManagerReadArgs this_ptr_conv;
26735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26736 this_ptr_conv.is_owned = false;
26737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26738 // WARNING: This object doesn't live past this scope, needs clone!
26739 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
26743 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
26744 LDKChannelManagerReadArgs this_ptr_conv;
26745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26746 this_ptr_conv.is_owned = false;
26747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26748 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26749 CHECK_ACCESS(val_ptr);
26750 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
26751 if (val_conv.free == LDKKeysInterface_JCalls_free) {
26752 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26753 LDKKeysInterface_JCalls_cloned(&val_conv);
26755 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
26758 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
26759 LDKChannelManagerReadArgs this_ptr_conv;
26760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26761 this_ptr_conv.is_owned = false;
26762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26763 // WARNING: This object doesn't live past this scope, needs clone!
26764 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
26768 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
26769 LDKChannelManagerReadArgs this_ptr_conv;
26770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26771 this_ptr_conv.is_owned = false;
26772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26773 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26774 CHECK_ACCESS(val_ptr);
26775 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
26776 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
26777 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26778 LDKFeeEstimator_JCalls_cloned(&val_conv);
26780 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
26783 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
26784 LDKChannelManagerReadArgs this_ptr_conv;
26785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26786 this_ptr_conv.is_owned = false;
26787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26788 // WARNING: This object doesn't live past this scope, needs clone!
26789 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
26793 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
26794 LDKChannelManagerReadArgs this_ptr_conv;
26795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26796 this_ptr_conv.is_owned = false;
26797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26798 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26799 CHECK_ACCESS(val_ptr);
26800 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
26801 if (val_conv.free == LDKWatch_JCalls_free) {
26802 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26803 LDKWatch_JCalls_cloned(&val_conv);
26805 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
26808 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
26809 LDKChannelManagerReadArgs this_ptr_conv;
26810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26811 this_ptr_conv.is_owned = false;
26812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26813 // WARNING: This object doesn't live past this scope, needs clone!
26814 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
26818 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
26819 LDKChannelManagerReadArgs this_ptr_conv;
26820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26821 this_ptr_conv.is_owned = false;
26822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26823 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26824 CHECK_ACCESS(val_ptr);
26825 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
26826 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
26827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26828 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
26830 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
26833 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
26834 LDKChannelManagerReadArgs this_ptr_conv;
26835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26836 this_ptr_conv.is_owned = false;
26837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26838 // WARNING: This object doesn't live past this scope, needs clone!
26839 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
26843 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
26844 LDKChannelManagerReadArgs this_ptr_conv;
26845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26846 this_ptr_conv.is_owned = false;
26847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26848 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26849 CHECK_ACCESS(val_ptr);
26850 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
26851 if (val_conv.free == LDKLogger_JCalls_free) {
26852 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26853 LDKLogger_JCalls_cloned(&val_conv);
26855 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
26858 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
26859 LDKChannelManagerReadArgs this_ptr_conv;
26860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26861 this_ptr_conv.is_owned = false;
26862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26863 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
26864 uint32_t ret_ref = 0;
26865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26868 ret_ref = (uintptr_t)ret_var.inner;
26869 if (ret_var.is_owned) {
26875 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
26876 LDKChannelManagerReadArgs this_ptr_conv;
26877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26878 this_ptr_conv.is_owned = false;
26879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26880 LDKUserConfig val_conv;
26881 val_conv.inner = (void*)(val & (~1));
26882 val_conv.is_owned = (val & 1) || (val == 0);
26883 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26884 val_conv = UserConfig_clone(&val_conv);
26885 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
26888 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) {
26889 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26890 CHECK_ACCESS(keys_manager_ptr);
26891 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26892 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26893 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26894 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26896 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26897 CHECK_ACCESS(fee_estimator_ptr);
26898 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26899 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26900 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26901 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26903 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
26904 CHECK_ACCESS(chain_monitor_ptr);
26905 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26906 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26907 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26908 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26910 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
26911 CHECK_ACCESS(tx_broadcaster_ptr);
26912 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26913 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26914 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26915 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26917 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26918 CHECK_ACCESS(logger_ptr);
26919 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26920 if (logger_conv.free == LDKLogger_JCalls_free) {
26921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26922 LDKLogger_JCalls_cloned(&logger_conv);
26924 LDKUserConfig default_config_conv;
26925 default_config_conv.inner = (void*)(default_config & (~1));
26926 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
26927 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
26928 default_config_conv = UserConfig_clone(&default_config_conv);
26929 LDKCVec_ChannelMonitorZ channel_monitors_constr;
26930 channel_monitors_constr.datalen = channel_monitors->arr_len;
26931 if (channel_monitors_constr.datalen > 0)
26932 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26934 channel_monitors_constr.data = NULL;
26935 uint32_t* channel_monitors_vals = channel_monitors->elems /* XXX channel_monitors leaks */;
26936 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
26937 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
26938 LDKChannelMonitor channel_monitors_conv_16_conv;
26939 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
26940 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
26941 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
26942 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
26944 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);
26945 uint32_t ret_ref = 0;
26946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26949 ret_ref = (uintptr_t)ret_var.inner;
26950 if (ret_var.is_owned) {
26956 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
26957 LDKu8slice ser_ref;
26958 ser_ref.datalen = ser->arr_len;
26959 ser_ref.data = ser->elems /* XXX ser leaks */;
26960 LDKChannelManagerReadArgs arg_conv;
26961 arg_conv.inner = (void*)(arg & (~1));
26962 arg_conv.is_owned = (arg & 1) || (arg == 0);
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26964 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
26965 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
26966 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
26967 return (uint32_t)ret_conv;
26970 void __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint32_t this_obj) {
26971 LDKExpandedKey this_obj_conv;
26972 this_obj_conv.inner = (void*)(this_obj & (~1));
26973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26975 ExpandedKey_free(this_obj_conv);
26978 uint32_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
26979 unsigned char key_material_arr[32];
26980 CHECK(key_material->arr_len == 32);
26981 memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
26982 unsigned char (*key_material_ref)[32] = &key_material_arr;
26983 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
26984 uint32_t ret_ref = 0;
26985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26988 ret_ref = (uintptr_t)ret_var.inner;
26989 if (ret_var.is_owned) {
26995 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) {
26996 LDKExpandedKey keys_conv;
26997 keys_conv.inner = (void*)(keys & (~1));
26998 keys_conv.is_owned = false;
26999 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27000 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27001 CHECK_ACCESS(min_value_msat_ptr);
27002 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27003 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27004 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
27005 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
27006 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
27007 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27008 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
27009 return (uint32_t)ret_conv;
27012 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) {
27013 LDKExpandedKey keys_conv;
27014 keys_conv.inner = (void*)(keys & (~1));
27015 keys_conv.is_owned = false;
27016 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27017 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27018 CHECK_ACCESS(min_value_msat_ptr);
27019 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27020 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27021 LDKThirtyTwoBytes payment_hash_ref;
27022 CHECK(payment_hash->arr_len == 32);
27023 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27024 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27025 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
27026 return (uint32_t)ret_conv;
27029 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
27030 LDKDecodeError this_obj_conv;
27031 this_obj_conv.inner = (void*)(this_obj & (~1));
27032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27034 DecodeError_free(this_obj_conv);
27037 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
27038 LDKDecodeError ret_var = DecodeError_clone(arg);
27039 uint32_t ret_ref = 0;
27040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27043 ret_ref = (uintptr_t)ret_var.inner;
27044 if (ret_var.is_owned) {
27049 uint32_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
27050 LDKDecodeError arg_conv;
27051 arg_conv.inner = (void*)(arg & (~1));
27052 arg_conv.is_owned = false;
27053 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27054 uint32_t ret_conv = DecodeError_clone_ptr(&arg_conv);
27058 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
27059 LDKDecodeError orig_conv;
27060 orig_conv.inner = (void*)(orig & (~1));
27061 orig_conv.is_owned = false;
27062 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27063 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
27064 uint32_t ret_ref = 0;
27065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27068 ret_ref = (uintptr_t)ret_var.inner;
27069 if (ret_var.is_owned) {
27075 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
27076 LDKInit this_obj_conv;
27077 this_obj_conv.inner = (void*)(this_obj & (~1));
27078 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27080 Init_free(this_obj_conv);
27083 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
27084 LDKInit this_ptr_conv;
27085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27086 this_ptr_conv.is_owned = false;
27087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27088 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
27089 uint32_t ret_ref = 0;
27090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27093 ret_ref = (uintptr_t)ret_var.inner;
27094 if (ret_var.is_owned) {
27100 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
27101 LDKInit this_ptr_conv;
27102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27103 this_ptr_conv.is_owned = false;
27104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27105 LDKInitFeatures val_conv;
27106 val_conv.inner = (void*)(val & (~1));
27107 val_conv.is_owned = (val & 1) || (val == 0);
27108 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27109 val_conv = InitFeatures_clone(&val_conv);
27110 Init_set_features(&this_ptr_conv, val_conv);
27113 uint32_t __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint32_t this_ptr) {
27114 LDKInit this_ptr_conv;
27115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27116 this_ptr_conv.is_owned = false;
27117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27118 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
27119 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
27120 uint32_t ret_ref = (uintptr_t)ret_copy;
27124 void __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint32_t this_ptr, uint32_t val) {
27125 LDKInit this_ptr_conv;
27126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27127 this_ptr_conv.is_owned = false;
27128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27129 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27130 CHECK_ACCESS(val_ptr);
27131 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
27132 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
27133 Init_set_remote_network_address(&this_ptr_conv, val_conv);
27136 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg, uint32_t remote_network_address_arg) {
27137 LDKInitFeatures features_arg_conv;
27138 features_arg_conv.inner = (void*)(features_arg & (~1));
27139 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27140 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27141 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27142 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
27143 CHECK_ACCESS(remote_network_address_arg_ptr);
27144 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
27145 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
27146 uint32_t ret_ref = 0;
27147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27150 ret_ref = (uintptr_t)ret_var.inner;
27151 if (ret_var.is_owned) {
27157 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
27158 LDKInit ret_var = Init_clone(arg);
27159 uint32_t ret_ref = 0;
27160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27163 ret_ref = (uintptr_t)ret_var.inner;
27164 if (ret_var.is_owned) {
27169 uint32_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
27171 arg_conv.inner = (void*)(arg & (~1));
27172 arg_conv.is_owned = false;
27173 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27174 uint32_t ret_conv = Init_clone_ptr(&arg_conv);
27178 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
27180 orig_conv.inner = (void*)(orig & (~1));
27181 orig_conv.is_owned = false;
27182 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27183 LDKInit ret_var = Init_clone(&orig_conv);
27184 uint32_t ret_ref = 0;
27185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27188 ret_ref = (uintptr_t)ret_var.inner;
27189 if (ret_var.is_owned) {
27195 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
27196 LDKErrorMessage this_obj_conv;
27197 this_obj_conv.inner = (void*)(this_obj & (~1));
27198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27200 ErrorMessage_free(this_obj_conv);
27203 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
27204 LDKErrorMessage this_ptr_conv;
27205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27206 this_ptr_conv.is_owned = false;
27207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27208 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27209 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
27213 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27214 LDKErrorMessage this_ptr_conv;
27215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27216 this_ptr_conv.is_owned = false;
27217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27218 LDKThirtyTwoBytes val_ref;
27219 CHECK(val->arr_len == 32);
27220 memcpy(val_ref.data, val->elems, 32); FREE(val);
27221 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
27224 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
27225 LDKErrorMessage this_ptr_conv;
27226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27227 this_ptr_conv.is_owned = false;
27228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27229 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
27230 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27235 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
27236 LDKErrorMessage this_ptr_conv;
27237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27238 this_ptr_conv.is_owned = false;
27239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27240 LDKStr val_conv = str_ref_to_owned_c(val);
27241 ErrorMessage_set_data(&this_ptr_conv, val_conv);
27244 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27245 LDKThirtyTwoBytes channel_id_arg_ref;
27246 CHECK(channel_id_arg->arr_len == 32);
27247 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27248 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27249 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
27250 uint32_t ret_ref = 0;
27251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27254 ret_ref = (uintptr_t)ret_var.inner;
27255 if (ret_var.is_owned) {
27261 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
27262 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
27263 uint32_t ret_ref = 0;
27264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27267 ret_ref = (uintptr_t)ret_var.inner;
27268 if (ret_var.is_owned) {
27273 uint32_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
27274 LDKErrorMessage arg_conv;
27275 arg_conv.inner = (void*)(arg & (~1));
27276 arg_conv.is_owned = false;
27277 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27278 uint32_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
27282 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
27283 LDKErrorMessage orig_conv;
27284 orig_conv.inner = (void*)(orig & (~1));
27285 orig_conv.is_owned = false;
27286 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27287 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
27288 uint32_t ret_ref = 0;
27289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27292 ret_ref = (uintptr_t)ret_var.inner;
27293 if (ret_var.is_owned) {
27299 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
27300 LDKWarningMessage this_obj_conv;
27301 this_obj_conv.inner = (void*)(this_obj & (~1));
27302 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27304 WarningMessage_free(this_obj_conv);
27307 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
27308 LDKWarningMessage this_ptr_conv;
27309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27310 this_ptr_conv.is_owned = false;
27311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27312 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27313 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
27317 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27318 LDKWarningMessage this_ptr_conv;
27319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27320 this_ptr_conv.is_owned = false;
27321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27322 LDKThirtyTwoBytes val_ref;
27323 CHECK(val->arr_len == 32);
27324 memcpy(val_ref.data, val->elems, 32); FREE(val);
27325 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
27328 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
27329 LDKWarningMessage this_ptr_conv;
27330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27331 this_ptr_conv.is_owned = false;
27332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27333 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
27334 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27339 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
27340 LDKWarningMessage this_ptr_conv;
27341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27342 this_ptr_conv.is_owned = false;
27343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27344 LDKStr val_conv = str_ref_to_owned_c(val);
27345 WarningMessage_set_data(&this_ptr_conv, val_conv);
27348 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27349 LDKThirtyTwoBytes channel_id_arg_ref;
27350 CHECK(channel_id_arg->arr_len == 32);
27351 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27352 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27353 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
27354 uint32_t ret_ref = 0;
27355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27358 ret_ref = (uintptr_t)ret_var.inner;
27359 if (ret_var.is_owned) {
27365 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
27366 LDKWarningMessage ret_var = WarningMessage_clone(arg);
27367 uint32_t ret_ref = 0;
27368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27371 ret_ref = (uintptr_t)ret_var.inner;
27372 if (ret_var.is_owned) {
27377 uint32_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
27378 LDKWarningMessage arg_conv;
27379 arg_conv.inner = (void*)(arg & (~1));
27380 arg_conv.is_owned = false;
27381 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27382 uint32_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
27386 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
27387 LDKWarningMessage orig_conv;
27388 orig_conv.inner = (void*)(orig & (~1));
27389 orig_conv.is_owned = false;
27390 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27391 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
27392 uint32_t ret_ref = 0;
27393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27396 ret_ref = (uintptr_t)ret_var.inner;
27397 if (ret_var.is_owned) {
27403 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
27404 LDKPing this_obj_conv;
27405 this_obj_conv.inner = (void*)(this_obj & (~1));
27406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27408 Ping_free(this_obj_conv);
27411 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
27412 LDKPing this_ptr_conv;
27413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27414 this_ptr_conv.is_owned = false;
27415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27416 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
27420 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
27421 LDKPing this_ptr_conv;
27422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27423 this_ptr_conv.is_owned = false;
27424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27425 Ping_set_ponglen(&this_ptr_conv, val);
27428 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
27429 LDKPing this_ptr_conv;
27430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27431 this_ptr_conv.is_owned = false;
27432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27433 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
27437 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
27438 LDKPing this_ptr_conv;
27439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27440 this_ptr_conv.is_owned = false;
27441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27442 Ping_set_byteslen(&this_ptr_conv, val);
27445 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
27446 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27447 uint32_t ret_ref = 0;
27448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27451 ret_ref = (uintptr_t)ret_var.inner;
27452 if (ret_var.is_owned) {
27458 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27459 LDKPing ret_var = Ping_clone(arg);
27460 uint32_t ret_ref = 0;
27461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27464 ret_ref = (uintptr_t)ret_var.inner;
27465 if (ret_var.is_owned) {
27470 uint32_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
27472 arg_conv.inner = (void*)(arg & (~1));
27473 arg_conv.is_owned = false;
27474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27475 uint32_t ret_conv = Ping_clone_ptr(&arg_conv);
27479 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
27481 orig_conv.inner = (void*)(orig & (~1));
27482 orig_conv.is_owned = false;
27483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27484 LDKPing ret_var = Ping_clone(&orig_conv);
27485 uint32_t ret_ref = 0;
27486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27489 ret_ref = (uintptr_t)ret_var.inner;
27490 if (ret_var.is_owned) {
27496 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
27497 LDKPong this_obj_conv;
27498 this_obj_conv.inner = (void*)(this_obj & (~1));
27499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27501 Pong_free(this_obj_conv);
27504 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
27505 LDKPong this_ptr_conv;
27506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27507 this_ptr_conv.is_owned = false;
27508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27509 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
27513 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
27514 LDKPong this_ptr_conv;
27515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27516 this_ptr_conv.is_owned = false;
27517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27518 Pong_set_byteslen(&this_ptr_conv, val);
27521 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
27522 LDKPong ret_var = Pong_new(byteslen_arg);
27523 uint32_t ret_ref = 0;
27524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27527 ret_ref = (uintptr_t)ret_var.inner;
27528 if (ret_var.is_owned) {
27534 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27535 LDKPong ret_var = Pong_clone(arg);
27536 uint32_t ret_ref = 0;
27537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27540 ret_ref = (uintptr_t)ret_var.inner;
27541 if (ret_var.is_owned) {
27546 uint32_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
27548 arg_conv.inner = (void*)(arg & (~1));
27549 arg_conv.is_owned = false;
27550 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27551 uint32_t ret_conv = Pong_clone_ptr(&arg_conv);
27555 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
27557 orig_conv.inner = (void*)(orig & (~1));
27558 orig_conv.is_owned = false;
27559 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27560 LDKPong ret_var = Pong_clone(&orig_conv);
27561 uint32_t ret_ref = 0;
27562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27565 ret_ref = (uintptr_t)ret_var.inner;
27566 if (ret_var.is_owned) {
27572 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
27573 LDKOpenChannel this_obj_conv;
27574 this_obj_conv.inner = (void*)(this_obj & (~1));
27575 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27577 OpenChannel_free(this_obj_conv);
27580 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
27581 LDKOpenChannel this_ptr_conv;
27582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27583 this_ptr_conv.is_owned = false;
27584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27585 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27586 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
27590 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
27591 LDKOpenChannel this_ptr_conv;
27592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27593 this_ptr_conv.is_owned = false;
27594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27595 LDKThirtyTwoBytes val_ref;
27596 CHECK(val->arr_len == 32);
27597 memcpy(val_ref.data, val->elems, 32); FREE(val);
27598 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
27601 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
27602 LDKOpenChannel this_ptr_conv;
27603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27604 this_ptr_conv.is_owned = false;
27605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27606 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27607 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27611 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
27612 LDKOpenChannel this_ptr_conv;
27613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27614 this_ptr_conv.is_owned = false;
27615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27616 LDKThirtyTwoBytes val_ref;
27617 CHECK(val->arr_len == 32);
27618 memcpy(val_ref.data, val->elems, 32); FREE(val);
27619 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27622 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
27623 LDKOpenChannel this_ptr_conv;
27624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27625 this_ptr_conv.is_owned = false;
27626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27627 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
27631 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
27632 LDKOpenChannel this_ptr_conv;
27633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27634 this_ptr_conv.is_owned = false;
27635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27636 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
27639 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
27640 LDKOpenChannel this_ptr_conv;
27641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27642 this_ptr_conv.is_owned = false;
27643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27644 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
27648 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
27649 LDKOpenChannel this_ptr_conv;
27650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27651 this_ptr_conv.is_owned = false;
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27653 OpenChannel_set_push_msat(&this_ptr_conv, val);
27656 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
27657 LDKOpenChannel this_ptr_conv;
27658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27659 this_ptr_conv.is_owned = false;
27660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27661 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
27665 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
27666 LDKOpenChannel this_ptr_conv;
27667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27668 this_ptr_conv.is_owned = false;
27669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27670 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27673 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) {
27674 LDKOpenChannel this_ptr_conv;
27675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27676 this_ptr_conv.is_owned = false;
27677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27678 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27682 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) {
27683 LDKOpenChannel this_ptr_conv;
27684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27685 this_ptr_conv.is_owned = false;
27686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27687 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27690 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
27691 LDKOpenChannel this_ptr_conv;
27692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27693 this_ptr_conv.is_owned = false;
27694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27695 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27699 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
27700 LDKOpenChannel this_ptr_conv;
27701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27702 this_ptr_conv.is_owned = false;
27703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27704 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27707 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
27708 LDKOpenChannel this_ptr_conv;
27709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27710 this_ptr_conv.is_owned = false;
27711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27712 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
27716 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
27717 LDKOpenChannel this_ptr_conv;
27718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27719 this_ptr_conv.is_owned = false;
27720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27721 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27724 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
27725 LDKOpenChannel this_ptr_conv;
27726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27727 this_ptr_conv.is_owned = false;
27728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27729 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
27733 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
27734 LDKOpenChannel this_ptr_conv;
27735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27736 this_ptr_conv.is_owned = false;
27737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27738 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
27741 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
27742 LDKOpenChannel this_ptr_conv;
27743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27744 this_ptr_conv.is_owned = false;
27745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27746 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
27750 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
27751 LDKOpenChannel this_ptr_conv;
27752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27753 this_ptr_conv.is_owned = false;
27754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27755 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
27758 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
27759 LDKOpenChannel this_ptr_conv;
27760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27761 this_ptr_conv.is_owned = false;
27762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27763 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
27767 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
27768 LDKOpenChannel this_ptr_conv;
27769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27770 this_ptr_conv.is_owned = false;
27771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27772 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27775 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
27776 LDKOpenChannel this_ptr_conv;
27777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27778 this_ptr_conv.is_owned = false;
27779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27780 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27781 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27785 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
27786 LDKOpenChannel this_ptr_conv;
27787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27788 this_ptr_conv.is_owned = false;
27789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27790 LDKPublicKey val_ref;
27791 CHECK(val->arr_len == 33);
27792 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27793 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27796 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
27797 LDKOpenChannel this_ptr_conv;
27798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27799 this_ptr_conv.is_owned = false;
27800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27801 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27802 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27806 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
27807 LDKOpenChannel this_ptr_conv;
27808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27809 this_ptr_conv.is_owned = false;
27810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27811 LDKPublicKey val_ref;
27812 CHECK(val->arr_len == 33);
27813 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27814 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27817 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
27818 LDKOpenChannel this_ptr_conv;
27819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27820 this_ptr_conv.is_owned = false;
27821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27822 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27823 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27827 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
27828 LDKOpenChannel this_ptr_conv;
27829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27830 this_ptr_conv.is_owned = false;
27831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27832 LDKPublicKey val_ref;
27833 CHECK(val->arr_len == 33);
27834 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27835 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
27838 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
27839 LDKOpenChannel this_ptr_conv;
27840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27841 this_ptr_conv.is_owned = false;
27842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27843 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27844 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27848 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
27849 LDKOpenChannel this_ptr_conv;
27850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27851 this_ptr_conv.is_owned = false;
27852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27853 LDKPublicKey val_ref;
27854 CHECK(val->arr_len == 33);
27855 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27856 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27859 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
27860 LDKOpenChannel this_ptr_conv;
27861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27862 this_ptr_conv.is_owned = false;
27863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27864 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27865 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27869 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
27870 LDKOpenChannel this_ptr_conv;
27871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27872 this_ptr_conv.is_owned = false;
27873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27874 LDKPublicKey val_ref;
27875 CHECK(val->arr_len == 33);
27876 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27877 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27880 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
27881 LDKOpenChannel this_ptr_conv;
27882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27883 this_ptr_conv.is_owned = false;
27884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27885 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27886 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27890 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) {
27891 LDKOpenChannel this_ptr_conv;
27892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27893 this_ptr_conv.is_owned = false;
27894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27895 LDKPublicKey val_ref;
27896 CHECK(val->arr_len == 33);
27897 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27898 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
27901 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
27902 LDKOpenChannel this_ptr_conv;
27903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27904 this_ptr_conv.is_owned = false;
27905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27906 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
27910 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
27911 LDKOpenChannel this_ptr_conv;
27912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27913 this_ptr_conv.is_owned = false;
27914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27915 OpenChannel_set_channel_flags(&this_ptr_conv, val);
27918 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
27919 LDKOpenChannel 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 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
27924 uint32_t ret_ref = 0;
27925 if ((uintptr_t)ret_var.inner > 4096) {
27926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27929 ret_ref = (uintptr_t)ret_var.inner;
27930 if (ret_var.is_owned) {
27937 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
27938 LDKOpenChannel this_ptr_conv;
27939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27940 this_ptr_conv.is_owned = false;
27941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27942 LDKChannelTypeFeatures val_conv;
27943 val_conv.inner = (void*)(val & (~1));
27944 val_conv.is_owned = (val & 1) || (val == 0);
27945 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27946 val_conv = ChannelTypeFeatures_clone(&val_conv);
27947 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
27950 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
27951 LDKOpenChannel ret_var = OpenChannel_clone(arg);
27952 uint32_t ret_ref = 0;
27953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27956 ret_ref = (uintptr_t)ret_var.inner;
27957 if (ret_var.is_owned) {
27962 uint32_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
27963 LDKOpenChannel arg_conv;
27964 arg_conv.inner = (void*)(arg & (~1));
27965 arg_conv.is_owned = false;
27966 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27967 uint32_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
27971 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
27972 LDKOpenChannel orig_conv;
27973 orig_conv.inner = (void*)(orig & (~1));
27974 orig_conv.is_owned = false;
27975 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27976 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
27977 uint32_t ret_ref = 0;
27978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27981 ret_ref = (uintptr_t)ret_var.inner;
27982 if (ret_var.is_owned) {
27988 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
27989 LDKAcceptChannel this_obj_conv;
27990 this_obj_conv.inner = (void*)(this_obj & (~1));
27991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27993 AcceptChannel_free(this_obj_conv);
27996 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
27997 LDKAcceptChannel this_ptr_conv;
27998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27999 this_ptr_conv.is_owned = false;
28000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28001 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28002 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28006 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28007 LDKAcceptChannel this_ptr_conv;
28008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28009 this_ptr_conv.is_owned = false;
28010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28011 LDKThirtyTwoBytes val_ref;
28012 CHECK(val->arr_len == 32);
28013 memcpy(val_ref.data, val->elems, 32); FREE(val);
28014 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28017 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
28018 LDKAcceptChannel this_ptr_conv;
28019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28020 this_ptr_conv.is_owned = false;
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
28026 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
28027 LDKAcceptChannel this_ptr_conv;
28028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28029 this_ptr_conv.is_owned = false;
28030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28031 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28034 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) {
28035 LDKAcceptChannel this_ptr_conv;
28036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28037 this_ptr_conv.is_owned = false;
28038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28039 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28043 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) {
28044 LDKAcceptChannel this_ptr_conv;
28045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28046 this_ptr_conv.is_owned = false;
28047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28048 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28051 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
28052 LDKAcceptChannel this_ptr_conv;
28053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28054 this_ptr_conv.is_owned = false;
28055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28056 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28060 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
28061 LDKAcceptChannel this_ptr_conv;
28062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28063 this_ptr_conv.is_owned = false;
28064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28065 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28068 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
28069 LDKAcceptChannel this_ptr_conv;
28070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28071 this_ptr_conv.is_owned = false;
28072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28073 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
28077 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
28078 LDKAcceptChannel this_ptr_conv;
28079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28080 this_ptr_conv.is_owned = false;
28081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28082 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28085 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
28086 LDKAcceptChannel this_ptr_conv;
28087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28088 this_ptr_conv.is_owned = false;
28089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28090 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
28094 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
28095 LDKAcceptChannel this_ptr_conv;
28096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28097 this_ptr_conv.is_owned = false;
28098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28099 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
28102 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
28103 LDKAcceptChannel this_ptr_conv;
28104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28105 this_ptr_conv.is_owned = false;
28106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28107 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
28111 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
28112 LDKAcceptChannel this_ptr_conv;
28113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28114 this_ptr_conv.is_owned = false;
28115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28116 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
28119 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
28120 LDKAcceptChannel this_ptr_conv;
28121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28122 this_ptr_conv.is_owned = false;
28123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28124 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
28128 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
28129 LDKAcceptChannel this_ptr_conv;
28130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28131 this_ptr_conv.is_owned = false;
28132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28133 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28136 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
28137 LDKAcceptChannel this_ptr_conv;
28138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28139 this_ptr_conv.is_owned = false;
28140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28141 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28142 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28146 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28147 LDKAcceptChannel this_ptr_conv;
28148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28149 this_ptr_conv.is_owned = false;
28150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28151 LDKPublicKey val_ref;
28152 CHECK(val->arr_len == 33);
28153 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28154 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28157 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
28158 LDKAcceptChannel this_ptr_conv;
28159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28160 this_ptr_conv.is_owned = false;
28161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28162 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28163 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28167 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28168 LDKAcceptChannel this_ptr_conv;
28169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28170 this_ptr_conv.is_owned = false;
28171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28172 LDKPublicKey val_ref;
28173 CHECK(val->arr_len == 33);
28174 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28175 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28178 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
28179 LDKAcceptChannel this_ptr_conv;
28180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28181 this_ptr_conv.is_owned = false;
28182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28183 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28184 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28188 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28189 LDKAcceptChannel this_ptr_conv;
28190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28191 this_ptr_conv.is_owned = false;
28192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28193 LDKPublicKey val_ref;
28194 CHECK(val->arr_len == 33);
28195 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28196 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
28199 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
28200 LDKAcceptChannel this_ptr_conv;
28201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28202 this_ptr_conv.is_owned = false;
28203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28204 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28205 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28209 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28210 LDKAcceptChannel this_ptr_conv;
28211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28212 this_ptr_conv.is_owned = false;
28213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28214 LDKPublicKey val_ref;
28215 CHECK(val->arr_len == 33);
28216 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28217 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28220 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
28221 LDKAcceptChannel this_ptr_conv;
28222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28223 this_ptr_conv.is_owned = false;
28224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28225 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28226 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28230 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28231 LDKAcceptChannel this_ptr_conv;
28232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28233 this_ptr_conv.is_owned = false;
28234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28235 LDKPublicKey val_ref;
28236 CHECK(val->arr_len == 33);
28237 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28238 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28241 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
28242 LDKAcceptChannel this_ptr_conv;
28243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28244 this_ptr_conv.is_owned = false;
28245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28246 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28247 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28251 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) {
28252 LDKAcceptChannel this_ptr_conv;
28253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28254 this_ptr_conv.is_owned = false;
28255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28256 LDKPublicKey val_ref;
28257 CHECK(val->arr_len == 33);
28258 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28259 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28262 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
28263 LDKAcceptChannel this_ptr_conv;
28264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28265 this_ptr_conv.is_owned = false;
28266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28267 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
28268 uint32_t ret_ref = 0;
28269 if ((uintptr_t)ret_var.inner > 4096) {
28270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28273 ret_ref = (uintptr_t)ret_var.inner;
28274 if (ret_var.is_owned) {
28281 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
28282 LDKAcceptChannel this_ptr_conv;
28283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28284 this_ptr_conv.is_owned = false;
28285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28286 LDKChannelTypeFeatures val_conv;
28287 val_conv.inner = (void*)(val & (~1));
28288 val_conv.is_owned = (val & 1) || (val == 0);
28289 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28290 val_conv = ChannelTypeFeatures_clone(&val_conv);
28291 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
28294 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28295 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
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) {
28306 uint32_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
28307 LDKAcceptChannel arg_conv;
28308 arg_conv.inner = (void*)(arg & (~1));
28309 arg_conv.is_owned = false;
28310 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28311 uint32_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
28315 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
28316 LDKAcceptChannel orig_conv;
28317 orig_conv.inner = (void*)(orig & (~1));
28318 orig_conv.is_owned = false;
28319 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28320 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28321 uint32_t ret_ref = 0;
28322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28325 ret_ref = (uintptr_t)ret_var.inner;
28326 if (ret_var.is_owned) {
28332 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
28333 LDKFundingCreated this_obj_conv;
28334 this_obj_conv.inner = (void*)(this_obj & (~1));
28335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28337 FundingCreated_free(this_obj_conv);
28340 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
28341 LDKFundingCreated this_ptr_conv;
28342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28343 this_ptr_conv.is_owned = false;
28344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28345 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28346 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
28350 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28351 LDKFundingCreated this_ptr_conv;
28352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28353 this_ptr_conv.is_owned = false;
28354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28355 LDKThirtyTwoBytes val_ref;
28356 CHECK(val->arr_len == 32);
28357 memcpy(val_ref.data, val->elems, 32); FREE(val);
28358 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28361 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
28362 LDKFundingCreated this_ptr_conv;
28363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28364 this_ptr_conv.is_owned = false;
28365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28366 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28367 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
28371 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
28372 LDKFundingCreated this_ptr_conv;
28373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28374 this_ptr_conv.is_owned = false;
28375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28376 LDKThirtyTwoBytes val_ref;
28377 CHECK(val->arr_len == 32);
28378 memcpy(val_ref.data, val->elems, 32); FREE(val);
28379 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28382 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
28383 LDKFundingCreated this_ptr_conv;
28384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28385 this_ptr_conv.is_owned = false;
28386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28387 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
28391 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
28392 LDKFundingCreated this_ptr_conv;
28393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28394 this_ptr_conv.is_owned = false;
28395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28396 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28399 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
28400 LDKFundingCreated this_ptr_conv;
28401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28402 this_ptr_conv.is_owned = false;
28403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28404 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28405 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
28409 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
28410 LDKFundingCreated this_ptr_conv;
28411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28412 this_ptr_conv.is_owned = false;
28413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28414 LDKSignature val_ref;
28415 CHECK(val->arr_len == 64);
28416 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28417 FundingCreated_set_signature(&this_ptr_conv, val_ref);
28420 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) {
28421 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28422 CHECK(temporary_channel_id_arg->arr_len == 32);
28423 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
28424 LDKThirtyTwoBytes funding_txid_arg_ref;
28425 CHECK(funding_txid_arg->arr_len == 32);
28426 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
28427 LDKSignature signature_arg_ref;
28428 CHECK(signature_arg->arr_len == 64);
28429 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28430 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28431 uint32_t ret_ref = 0;
28432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28435 ret_ref = (uintptr_t)ret_var.inner;
28436 if (ret_var.is_owned) {
28442 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28443 LDKFundingCreated ret_var = FundingCreated_clone(arg);
28444 uint32_t ret_ref = 0;
28445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28448 ret_ref = (uintptr_t)ret_var.inner;
28449 if (ret_var.is_owned) {
28454 uint32_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
28455 LDKFundingCreated arg_conv;
28456 arg_conv.inner = (void*)(arg & (~1));
28457 arg_conv.is_owned = false;
28458 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28459 uint32_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
28463 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
28464 LDKFundingCreated orig_conv;
28465 orig_conv.inner = (void*)(orig & (~1));
28466 orig_conv.is_owned = false;
28467 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28468 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28469 uint32_t ret_ref = 0;
28470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28473 ret_ref = (uintptr_t)ret_var.inner;
28474 if (ret_var.is_owned) {
28480 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
28481 LDKFundingSigned this_obj_conv;
28482 this_obj_conv.inner = (void*)(this_obj & (~1));
28483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28485 FundingSigned_free(this_obj_conv);
28488 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
28489 LDKFundingSigned this_ptr_conv;
28490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28491 this_ptr_conv.is_owned = false;
28492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28493 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28494 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
28498 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28499 LDKFundingSigned this_ptr_conv;
28500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28501 this_ptr_conv.is_owned = false;
28502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28503 LDKThirtyTwoBytes val_ref;
28504 CHECK(val->arr_len == 32);
28505 memcpy(val_ref.data, val->elems, 32); FREE(val);
28506 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28509 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
28510 LDKFundingSigned this_ptr_conv;
28511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28512 this_ptr_conv.is_owned = false;
28513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28514 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28515 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28519 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28520 LDKFundingSigned this_ptr_conv;
28521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28522 this_ptr_conv.is_owned = false;
28523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28524 LDKSignature val_ref;
28525 CHECK(val->arr_len == 64);
28526 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28527 FundingSigned_set_signature(&this_ptr_conv, val_ref);
28530 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
28531 LDKThirtyTwoBytes channel_id_arg_ref;
28532 CHECK(channel_id_arg->arr_len == 32);
28533 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28534 LDKSignature signature_arg_ref;
28535 CHECK(signature_arg->arr_len == 64);
28536 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28537 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28538 uint32_t ret_ref = 0;
28539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28542 ret_ref = (uintptr_t)ret_var.inner;
28543 if (ret_var.is_owned) {
28549 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28550 LDKFundingSigned ret_var = FundingSigned_clone(arg);
28551 uint32_t ret_ref = 0;
28552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28555 ret_ref = (uintptr_t)ret_var.inner;
28556 if (ret_var.is_owned) {
28561 uint32_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
28562 LDKFundingSigned arg_conv;
28563 arg_conv.inner = (void*)(arg & (~1));
28564 arg_conv.is_owned = false;
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28566 uint32_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
28570 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
28571 LDKFundingSigned orig_conv;
28572 orig_conv.inner = (void*)(orig & (~1));
28573 orig_conv.is_owned = false;
28574 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28575 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28576 uint32_t ret_ref = 0;
28577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28580 ret_ref = (uintptr_t)ret_var.inner;
28581 if (ret_var.is_owned) {
28587 void __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint32_t this_obj) {
28588 LDKChannelReady this_obj_conv;
28589 this_obj_conv.inner = (void*)(this_obj & (~1));
28590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28592 ChannelReady_free(this_obj_conv);
28595 int8_tArray __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint32_t this_ptr) {
28596 LDKChannelReady this_ptr_conv;
28597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28598 this_ptr_conv.is_owned = false;
28599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28600 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28601 memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
28605 void __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28606 LDKChannelReady this_ptr_conv;
28607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28608 this_ptr_conv.is_owned = false;
28609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610 LDKThirtyTwoBytes val_ref;
28611 CHECK(val->arr_len == 32);
28612 memcpy(val_ref.data, val->elems, 32); FREE(val);
28613 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
28616 int8_tArray __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint32_t this_ptr) {
28617 LDKChannelReady this_ptr_conv;
28618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28619 this_ptr_conv.is_owned = false;
28620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28622 memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28626 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) {
28627 LDKChannelReady this_ptr_conv;
28628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28629 this_ptr_conv.is_owned = false;
28630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28631 LDKPublicKey val_ref;
28632 CHECK(val->arr_len == 33);
28633 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28634 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28637 uint32_t __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint32_t this_ptr) {
28638 LDKChannelReady this_ptr_conv;
28639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28640 this_ptr_conv.is_owned = false;
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28642 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28643 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
28644 uint32_t ret_ref = (uintptr_t)ret_copy;
28648 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) {
28649 LDKChannelReady this_ptr_conv;
28650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28651 this_ptr_conv.is_owned = false;
28652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28653 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28654 CHECK_ACCESS(val_ptr);
28655 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28656 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28657 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
28660 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) {
28661 LDKThirtyTwoBytes channel_id_arg_ref;
28662 CHECK(channel_id_arg->arr_len == 32);
28663 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28664 LDKPublicKey next_per_commitment_point_arg_ref;
28665 CHECK(next_per_commitment_point_arg->arr_len == 33);
28666 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28667 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
28668 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
28669 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
28670 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
28671 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
28672 uint32_t ret_ref = 0;
28673 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28674 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28676 ret_ref = (uintptr_t)ret_var.inner;
28677 if (ret_var.is_owned) {
28683 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
28684 LDKChannelReady ret_var = ChannelReady_clone(arg);
28685 uint32_t ret_ref = 0;
28686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28689 ret_ref = (uintptr_t)ret_var.inner;
28690 if (ret_var.is_owned) {
28695 uint32_t __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint32_t arg) {
28696 LDKChannelReady arg_conv;
28697 arg_conv.inner = (void*)(arg & (~1));
28698 arg_conv.is_owned = false;
28699 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28700 uint32_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
28704 uint32_t __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint32_t orig) {
28705 LDKChannelReady orig_conv;
28706 orig_conv.inner = (void*)(orig & (~1));
28707 orig_conv.is_owned = false;
28708 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28709 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
28710 uint32_t ret_ref = 0;
28711 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28712 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28714 ret_ref = (uintptr_t)ret_var.inner;
28715 if (ret_var.is_owned) {
28721 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
28722 LDKShutdown this_obj_conv;
28723 this_obj_conv.inner = (void*)(this_obj & (~1));
28724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28726 Shutdown_free(this_obj_conv);
28729 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
28730 LDKShutdown this_ptr_conv;
28731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28732 this_ptr_conv.is_owned = false;
28733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28734 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28735 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
28739 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28740 LDKShutdown this_ptr_conv;
28741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28742 this_ptr_conv.is_owned = false;
28743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28744 LDKThirtyTwoBytes val_ref;
28745 CHECK(val->arr_len == 32);
28746 memcpy(val_ref.data, val->elems, 32); FREE(val);
28747 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
28750 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
28751 LDKShutdown this_ptr_conv;
28752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28753 this_ptr_conv.is_owned = false;
28754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28755 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
28756 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28757 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28761 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
28762 LDKShutdown this_ptr_conv;
28763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28764 this_ptr_conv.is_owned = false;
28765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28766 LDKCVec_u8Z val_ref;
28767 val_ref.datalen = val->arr_len;
28768 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
28769 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
28770 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
28773 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
28774 LDKThirtyTwoBytes channel_id_arg_ref;
28775 CHECK(channel_id_arg->arr_len == 32);
28776 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28777 LDKCVec_u8Z scriptpubkey_arg_ref;
28778 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
28779 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
28780 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
28781 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
28782 uint32_t ret_ref = 0;
28783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28786 ret_ref = (uintptr_t)ret_var.inner;
28787 if (ret_var.is_owned) {
28793 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
28794 LDKShutdown ret_var = Shutdown_clone(arg);
28795 uint32_t ret_ref = 0;
28796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28799 ret_ref = (uintptr_t)ret_var.inner;
28800 if (ret_var.is_owned) {
28805 uint32_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
28806 LDKShutdown arg_conv;
28807 arg_conv.inner = (void*)(arg & (~1));
28808 arg_conv.is_owned = false;
28809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28810 uint32_t ret_conv = Shutdown_clone_ptr(&arg_conv);
28814 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
28815 LDKShutdown orig_conv;
28816 orig_conv.inner = (void*)(orig & (~1));
28817 orig_conv.is_owned = false;
28818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28819 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
28820 uint32_t ret_ref = 0;
28821 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28822 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28824 ret_ref = (uintptr_t)ret_var.inner;
28825 if (ret_var.is_owned) {
28831 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
28832 LDKClosingSignedFeeRange this_obj_conv;
28833 this_obj_conv.inner = (void*)(this_obj & (~1));
28834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28836 ClosingSignedFeeRange_free(this_obj_conv);
28839 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
28840 LDKClosingSignedFeeRange this_ptr_conv;
28841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28842 this_ptr_conv.is_owned = false;
28843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28844 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
28848 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
28849 LDKClosingSignedFeeRange this_ptr_conv;
28850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28851 this_ptr_conv.is_owned = false;
28852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28853 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
28856 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
28857 LDKClosingSignedFeeRange this_ptr_conv;
28858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28859 this_ptr_conv.is_owned = false;
28860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28861 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
28865 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
28866 LDKClosingSignedFeeRange this_ptr_conv;
28867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28868 this_ptr_conv.is_owned = false;
28869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28870 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
28873 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
28874 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
28875 uint32_t ret_ref = 0;
28876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28879 ret_ref = (uintptr_t)ret_var.inner;
28880 if (ret_var.is_owned) {
28886 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
28887 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
28888 uint32_t ret_ref = 0;
28889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28892 ret_ref = (uintptr_t)ret_var.inner;
28893 if (ret_var.is_owned) {
28898 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
28899 LDKClosingSignedFeeRange arg_conv;
28900 arg_conv.inner = (void*)(arg & (~1));
28901 arg_conv.is_owned = false;
28902 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28903 uint32_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
28907 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
28908 LDKClosingSignedFeeRange orig_conv;
28909 orig_conv.inner = (void*)(orig & (~1));
28910 orig_conv.is_owned = false;
28911 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28912 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
28913 uint32_t ret_ref = 0;
28914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28917 ret_ref = (uintptr_t)ret_var.inner;
28918 if (ret_var.is_owned) {
28924 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
28925 LDKClosingSigned this_obj_conv;
28926 this_obj_conv.inner = (void*)(this_obj & (~1));
28927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28929 ClosingSigned_free(this_obj_conv);
28932 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
28933 LDKClosingSigned this_ptr_conv;
28934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28935 this_ptr_conv.is_owned = false;
28936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28937 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28938 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
28942 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28943 LDKClosingSigned this_ptr_conv;
28944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28945 this_ptr_conv.is_owned = false;
28946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28947 LDKThirtyTwoBytes val_ref;
28948 CHECK(val->arr_len == 32);
28949 memcpy(val_ref.data, val->elems, 32); FREE(val);
28950 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
28953 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
28954 LDKClosingSigned this_ptr_conv;
28955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28956 this_ptr_conv.is_owned = false;
28957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28958 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
28962 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
28963 LDKClosingSigned this_ptr_conv;
28964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28965 this_ptr_conv.is_owned = false;
28966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28967 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
28970 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
28971 LDKClosingSigned this_ptr_conv;
28972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28973 this_ptr_conv.is_owned = false;
28974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28975 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28976 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28980 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28981 LDKClosingSigned this_ptr_conv;
28982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28983 this_ptr_conv.is_owned = false;
28984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28985 LDKSignature val_ref;
28986 CHECK(val->arr_len == 64);
28987 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28988 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
28991 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
28992 LDKClosingSigned this_ptr_conv;
28993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28994 this_ptr_conv.is_owned = false;
28995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28996 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
28997 uint32_t ret_ref = 0;
28998 if ((uintptr_t)ret_var.inner > 4096) {
28999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29002 ret_ref = (uintptr_t)ret_var.inner;
29003 if (ret_var.is_owned) {
29010 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
29011 LDKClosingSigned this_ptr_conv;
29012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29013 this_ptr_conv.is_owned = false;
29014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29015 LDKClosingSignedFeeRange val_conv;
29016 val_conv.inner = (void*)(val & (~1));
29017 val_conv.is_owned = (val & 1) || (val == 0);
29018 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29019 val_conv = ClosingSignedFeeRange_clone(&val_conv);
29020 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
29023 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) {
29024 LDKThirtyTwoBytes channel_id_arg_ref;
29025 CHECK(channel_id_arg->arr_len == 32);
29026 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29027 LDKSignature signature_arg_ref;
29028 CHECK(signature_arg->arr_len == 64);
29029 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29030 LDKClosingSignedFeeRange fee_range_arg_conv;
29031 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
29032 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
29033 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
29034 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
29035 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
29036 uint32_t ret_ref = 0;
29037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29040 ret_ref = (uintptr_t)ret_var.inner;
29041 if (ret_var.is_owned) {
29047 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
29048 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
29049 uint32_t ret_ref = 0;
29050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29053 ret_ref = (uintptr_t)ret_var.inner;
29054 if (ret_var.is_owned) {
29059 uint32_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
29060 LDKClosingSigned arg_conv;
29061 arg_conv.inner = (void*)(arg & (~1));
29062 arg_conv.is_owned = false;
29063 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29064 uint32_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
29068 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
29069 LDKClosingSigned orig_conv;
29070 orig_conv.inner = (void*)(orig & (~1));
29071 orig_conv.is_owned = false;
29072 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29073 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
29074 uint32_t ret_ref = 0;
29075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29078 ret_ref = (uintptr_t)ret_var.inner;
29079 if (ret_var.is_owned) {
29085 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
29086 LDKUpdateAddHTLC this_obj_conv;
29087 this_obj_conv.inner = (void*)(this_obj & (~1));
29088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29090 UpdateAddHTLC_free(this_obj_conv);
29093 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
29094 LDKUpdateAddHTLC this_ptr_conv;
29095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29096 this_ptr_conv.is_owned = false;
29097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29098 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29099 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
29103 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29104 LDKUpdateAddHTLC this_ptr_conv;
29105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29106 this_ptr_conv.is_owned = false;
29107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29108 LDKThirtyTwoBytes val_ref;
29109 CHECK(val->arr_len == 32);
29110 memcpy(val_ref.data, val->elems, 32); FREE(val);
29111 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
29114 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
29115 LDKUpdateAddHTLC this_ptr_conv;
29116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29117 this_ptr_conv.is_owned = false;
29118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29119 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
29123 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29124 LDKUpdateAddHTLC this_ptr_conv;
29125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29126 this_ptr_conv.is_owned = false;
29127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29128 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
29131 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
29132 LDKUpdateAddHTLC this_ptr_conv;
29133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29134 this_ptr_conv.is_owned = false;
29135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29136 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
29140 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
29141 LDKUpdateAddHTLC this_ptr_conv;
29142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29143 this_ptr_conv.is_owned = false;
29144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29145 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
29148 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
29149 LDKUpdateAddHTLC this_ptr_conv;
29150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29151 this_ptr_conv.is_owned = false;
29152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29153 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29154 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
29158 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29159 LDKUpdateAddHTLC this_ptr_conv;
29160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29161 this_ptr_conv.is_owned = false;
29162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29163 LDKThirtyTwoBytes val_ref;
29164 CHECK(val->arr_len == 32);
29165 memcpy(val_ref.data, val->elems, 32); FREE(val);
29166 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
29169 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
29170 LDKUpdateAddHTLC this_ptr_conv;
29171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29172 this_ptr_conv.is_owned = false;
29173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29174 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
29178 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29179 LDKUpdateAddHTLC this_ptr_conv;
29180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29181 this_ptr_conv.is_owned = false;
29182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29183 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
29186 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
29187 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
29188 uint32_t ret_ref = 0;
29189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29192 ret_ref = (uintptr_t)ret_var.inner;
29193 if (ret_var.is_owned) {
29198 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
29199 LDKUpdateAddHTLC arg_conv;
29200 arg_conv.inner = (void*)(arg & (~1));
29201 arg_conv.is_owned = false;
29202 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29203 uint32_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
29207 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
29208 LDKUpdateAddHTLC orig_conv;
29209 orig_conv.inner = (void*)(orig & (~1));
29210 orig_conv.is_owned = false;
29211 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29212 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
29213 uint32_t ret_ref = 0;
29214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29217 ret_ref = (uintptr_t)ret_var.inner;
29218 if (ret_var.is_owned) {
29224 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
29225 LDKUpdateFulfillHTLC this_obj_conv;
29226 this_obj_conv.inner = (void*)(this_obj & (~1));
29227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29229 UpdateFulfillHTLC_free(this_obj_conv);
29232 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
29233 LDKUpdateFulfillHTLC this_ptr_conv;
29234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29235 this_ptr_conv.is_owned = false;
29236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29237 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29238 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
29242 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29243 LDKUpdateFulfillHTLC this_ptr_conv;
29244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29245 this_ptr_conv.is_owned = false;
29246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29247 LDKThirtyTwoBytes val_ref;
29248 CHECK(val->arr_len == 32);
29249 memcpy(val_ref.data, val->elems, 32); FREE(val);
29250 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
29253 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
29254 LDKUpdateFulfillHTLC this_ptr_conv;
29255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29256 this_ptr_conv.is_owned = false;
29257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29258 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
29262 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29263 LDKUpdateFulfillHTLC this_ptr_conv;
29264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29265 this_ptr_conv.is_owned = false;
29266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29267 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
29270 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
29271 LDKUpdateFulfillHTLC this_ptr_conv;
29272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29273 this_ptr_conv.is_owned = false;
29274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29275 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29276 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
29280 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
29281 LDKUpdateFulfillHTLC this_ptr_conv;
29282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29283 this_ptr_conv.is_owned = false;
29284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29285 LDKThirtyTwoBytes val_ref;
29286 CHECK(val->arr_len == 32);
29287 memcpy(val_ref.data, val->elems, 32); FREE(val);
29288 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
29291 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) {
29292 LDKThirtyTwoBytes channel_id_arg_ref;
29293 CHECK(channel_id_arg->arr_len == 32);
29294 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29295 LDKThirtyTwoBytes payment_preimage_arg_ref;
29296 CHECK(payment_preimage_arg->arr_len == 32);
29297 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
29298 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
29299 uint32_t ret_ref = 0;
29300 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29301 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29303 ret_ref = (uintptr_t)ret_var.inner;
29304 if (ret_var.is_owned) {
29310 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
29311 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
29312 uint32_t ret_ref = 0;
29313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29316 ret_ref = (uintptr_t)ret_var.inner;
29317 if (ret_var.is_owned) {
29322 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
29323 LDKUpdateFulfillHTLC arg_conv;
29324 arg_conv.inner = (void*)(arg & (~1));
29325 arg_conv.is_owned = false;
29326 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29327 uint32_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
29331 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
29332 LDKUpdateFulfillHTLC orig_conv;
29333 orig_conv.inner = (void*)(orig & (~1));
29334 orig_conv.is_owned = false;
29335 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29336 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
29337 uint32_t ret_ref = 0;
29338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29341 ret_ref = (uintptr_t)ret_var.inner;
29342 if (ret_var.is_owned) {
29348 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
29349 LDKUpdateFailHTLC this_obj_conv;
29350 this_obj_conv.inner = (void*)(this_obj & (~1));
29351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29353 UpdateFailHTLC_free(this_obj_conv);
29356 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
29357 LDKUpdateFailHTLC this_ptr_conv;
29358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29359 this_ptr_conv.is_owned = false;
29360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29361 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29362 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
29366 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29367 LDKUpdateFailHTLC this_ptr_conv;
29368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29369 this_ptr_conv.is_owned = false;
29370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29371 LDKThirtyTwoBytes val_ref;
29372 CHECK(val->arr_len == 32);
29373 memcpy(val_ref.data, val->elems, 32); FREE(val);
29374 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29377 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
29378 LDKUpdateFailHTLC this_ptr_conv;
29379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29380 this_ptr_conv.is_owned = false;
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29382 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29386 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29387 LDKUpdateFailHTLC this_ptr_conv;
29388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29389 this_ptr_conv.is_owned = false;
29390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29391 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29394 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29395 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29396 uint32_t ret_ref = 0;
29397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29400 ret_ref = (uintptr_t)ret_var.inner;
29401 if (ret_var.is_owned) {
29406 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
29407 LDKUpdateFailHTLC arg_conv;
29408 arg_conv.inner = (void*)(arg & (~1));
29409 arg_conv.is_owned = false;
29410 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29411 uint32_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
29415 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
29416 LDKUpdateFailHTLC orig_conv;
29417 orig_conv.inner = (void*)(orig & (~1));
29418 orig_conv.is_owned = false;
29419 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29420 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29421 uint32_t ret_ref = 0;
29422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29425 ret_ref = (uintptr_t)ret_var.inner;
29426 if (ret_var.is_owned) {
29432 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
29433 LDKUpdateFailMalformedHTLC this_obj_conv;
29434 this_obj_conv.inner = (void*)(this_obj & (~1));
29435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29437 UpdateFailMalformedHTLC_free(this_obj_conv);
29440 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
29441 LDKUpdateFailMalformedHTLC this_ptr_conv;
29442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29443 this_ptr_conv.is_owned = false;
29444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29445 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29446 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
29450 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29451 LDKUpdateFailMalformedHTLC this_ptr_conv;
29452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29453 this_ptr_conv.is_owned = false;
29454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29455 LDKThirtyTwoBytes val_ref;
29456 CHECK(val->arr_len == 32);
29457 memcpy(val_ref.data, val->elems, 32); FREE(val);
29458 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29461 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
29462 LDKUpdateFailMalformedHTLC this_ptr_conv;
29463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29464 this_ptr_conv.is_owned = false;
29465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29466 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29470 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29471 LDKUpdateFailMalformedHTLC this_ptr_conv;
29472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29473 this_ptr_conv.is_owned = false;
29474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29475 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29478 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
29479 LDKUpdateFailMalformedHTLC this_ptr_conv;
29480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29481 this_ptr_conv.is_owned = false;
29482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29483 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29487 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
29488 LDKUpdateFailMalformedHTLC this_ptr_conv;
29489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29490 this_ptr_conv.is_owned = false;
29491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29492 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29495 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29496 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29497 uint32_t ret_ref = 0;
29498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29501 ret_ref = (uintptr_t)ret_var.inner;
29502 if (ret_var.is_owned) {
29507 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
29508 LDKUpdateFailMalformedHTLC arg_conv;
29509 arg_conv.inner = (void*)(arg & (~1));
29510 arg_conv.is_owned = false;
29511 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29512 uint32_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29516 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
29517 LDKUpdateFailMalformedHTLC orig_conv;
29518 orig_conv.inner = (void*)(orig & (~1));
29519 orig_conv.is_owned = false;
29520 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29521 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
29522 uint32_t ret_ref = 0;
29523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29526 ret_ref = (uintptr_t)ret_var.inner;
29527 if (ret_var.is_owned) {
29533 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
29534 LDKCommitmentSigned this_obj_conv;
29535 this_obj_conv.inner = (void*)(this_obj & (~1));
29536 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29538 CommitmentSigned_free(this_obj_conv);
29541 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
29542 LDKCommitmentSigned this_ptr_conv;
29543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29544 this_ptr_conv.is_owned = false;
29545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29546 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29547 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
29551 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29552 LDKCommitmentSigned this_ptr_conv;
29553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29554 this_ptr_conv.is_owned = false;
29555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29556 LDKThirtyTwoBytes val_ref;
29557 CHECK(val->arr_len == 32);
29558 memcpy(val_ref.data, val->elems, 32); FREE(val);
29559 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29562 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
29563 LDKCommitmentSigned this_ptr_conv;
29564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29565 this_ptr_conv.is_owned = false;
29566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29567 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29568 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
29572 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29573 LDKCommitmentSigned this_ptr_conv;
29574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29575 this_ptr_conv.is_owned = false;
29576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29577 LDKSignature val_ref;
29578 CHECK(val->arr_len == 64);
29579 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29580 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29583 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
29584 LDKCommitmentSigned this_ptr_conv;
29585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29586 this_ptr_conv.is_owned = false;
29587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29588 LDKCVec_SignatureZ val_constr;
29589 val_constr.datalen = val->arr_len;
29590 if (val_constr.datalen > 0)
29591 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29593 val_constr.data = NULL;
29594 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
29595 for (size_t m = 0; m < val_constr.datalen; m++) {
29596 int8_tArray val_conv_12 = val_vals[m];
29597 LDKSignature val_conv_12_ref;
29598 CHECK(val_conv_12->arr_len == 64);
29599 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
29600 val_constr.data[m] = val_conv_12_ref;
29602 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29605 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
29606 LDKThirtyTwoBytes channel_id_arg_ref;
29607 CHECK(channel_id_arg->arr_len == 32);
29608 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29609 LDKSignature signature_arg_ref;
29610 CHECK(signature_arg->arr_len == 64);
29611 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29612 LDKCVec_SignatureZ htlc_signatures_arg_constr;
29613 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
29614 if (htlc_signatures_arg_constr.datalen > 0)
29615 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29617 htlc_signatures_arg_constr.data = NULL;
29618 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems /* XXX htlc_signatures_arg leaks */;
29619 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
29620 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
29621 LDKSignature htlc_signatures_arg_conv_12_ref;
29622 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
29623 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
29624 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
29626 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
29627 uint32_t ret_ref = 0;
29628 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29629 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29630 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29631 ret_ref = (uintptr_t)ret_var.inner;
29632 if (ret_var.is_owned) {
29638 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
29639 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
29640 uint32_t ret_ref = 0;
29641 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29642 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29644 ret_ref = (uintptr_t)ret_var.inner;
29645 if (ret_var.is_owned) {
29650 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
29651 LDKCommitmentSigned arg_conv;
29652 arg_conv.inner = (void*)(arg & (~1));
29653 arg_conv.is_owned = false;
29654 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29655 uint32_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
29659 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
29660 LDKCommitmentSigned orig_conv;
29661 orig_conv.inner = (void*)(orig & (~1));
29662 orig_conv.is_owned = false;
29663 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29664 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
29665 uint32_t ret_ref = 0;
29666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29669 ret_ref = (uintptr_t)ret_var.inner;
29670 if (ret_var.is_owned) {
29676 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
29677 LDKRevokeAndACK this_obj_conv;
29678 this_obj_conv.inner = (void*)(this_obj & (~1));
29679 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29681 RevokeAndACK_free(this_obj_conv);
29684 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
29685 LDKRevokeAndACK this_ptr_conv;
29686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29687 this_ptr_conv.is_owned = false;
29688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29689 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29690 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
29694 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29695 LDKRevokeAndACK this_ptr_conv;
29696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29697 this_ptr_conv.is_owned = false;
29698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29699 LDKThirtyTwoBytes val_ref;
29700 CHECK(val->arr_len == 32);
29701 memcpy(val_ref.data, val->elems, 32); FREE(val);
29702 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
29705 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
29706 LDKRevokeAndACK this_ptr_conv;
29707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29708 this_ptr_conv.is_owned = false;
29709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29710 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29711 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
29715 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
29716 LDKRevokeAndACK this_ptr_conv;
29717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29718 this_ptr_conv.is_owned = false;
29719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29720 LDKThirtyTwoBytes val_ref;
29721 CHECK(val->arr_len == 32);
29722 memcpy(val_ref.data, val->elems, 32); FREE(val);
29723 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
29726 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
29727 LDKRevokeAndACK this_ptr_conv;
29728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29729 this_ptr_conv.is_owned = false;
29730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29731 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29732 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29736 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) {
29737 LDKRevokeAndACK this_ptr_conv;
29738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29739 this_ptr_conv.is_owned = false;
29740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29741 LDKPublicKey val_ref;
29742 CHECK(val->arr_len == 33);
29743 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29744 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29747 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) {
29748 LDKThirtyTwoBytes channel_id_arg_ref;
29749 CHECK(channel_id_arg->arr_len == 32);
29750 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29751 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
29752 CHECK(per_commitment_secret_arg->arr_len == 32);
29753 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
29754 LDKPublicKey next_per_commitment_point_arg_ref;
29755 CHECK(next_per_commitment_point_arg->arr_len == 33);
29756 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29757 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
29758 uint32_t ret_ref = 0;
29759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29762 ret_ref = (uintptr_t)ret_var.inner;
29763 if (ret_var.is_owned) {
29769 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
29770 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
29771 uint32_t ret_ref = 0;
29772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29775 ret_ref = (uintptr_t)ret_var.inner;
29776 if (ret_var.is_owned) {
29781 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
29782 LDKRevokeAndACK arg_conv;
29783 arg_conv.inner = (void*)(arg & (~1));
29784 arg_conv.is_owned = false;
29785 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29786 uint32_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
29790 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
29791 LDKRevokeAndACK orig_conv;
29792 orig_conv.inner = (void*)(orig & (~1));
29793 orig_conv.is_owned = false;
29794 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29795 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
29796 uint32_t ret_ref = 0;
29797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29800 ret_ref = (uintptr_t)ret_var.inner;
29801 if (ret_var.is_owned) {
29807 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
29808 LDKUpdateFee this_obj_conv;
29809 this_obj_conv.inner = (void*)(this_obj & (~1));
29810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29812 UpdateFee_free(this_obj_conv);
29815 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
29816 LDKUpdateFee this_ptr_conv;
29817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29818 this_ptr_conv.is_owned = false;
29819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29820 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29821 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
29825 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29826 LDKUpdateFee this_ptr_conv;
29827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29828 this_ptr_conv.is_owned = false;
29829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29830 LDKThirtyTwoBytes val_ref;
29831 CHECK(val->arr_len == 32);
29832 memcpy(val_ref.data, val->elems, 32); FREE(val);
29833 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
29836 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
29837 LDKUpdateFee this_ptr_conv;
29838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29839 this_ptr_conv.is_owned = false;
29840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29841 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
29845 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
29846 LDKUpdateFee this_ptr_conv;
29847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29848 this_ptr_conv.is_owned = false;
29849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29850 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
29853 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
29854 LDKThirtyTwoBytes channel_id_arg_ref;
29855 CHECK(channel_id_arg->arr_len == 32);
29856 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29857 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
29858 uint32_t ret_ref = 0;
29859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29862 ret_ref = (uintptr_t)ret_var.inner;
29863 if (ret_var.is_owned) {
29869 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
29870 LDKUpdateFee ret_var = UpdateFee_clone(arg);
29871 uint32_t ret_ref = 0;
29872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29875 ret_ref = (uintptr_t)ret_var.inner;
29876 if (ret_var.is_owned) {
29881 uint32_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
29882 LDKUpdateFee arg_conv;
29883 arg_conv.inner = (void*)(arg & (~1));
29884 arg_conv.is_owned = false;
29885 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29886 uint32_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
29890 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
29891 LDKUpdateFee orig_conv;
29892 orig_conv.inner = (void*)(orig & (~1));
29893 orig_conv.is_owned = false;
29894 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29895 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
29896 uint32_t ret_ref = 0;
29897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29900 ret_ref = (uintptr_t)ret_var.inner;
29901 if (ret_var.is_owned) {
29907 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
29908 LDKDataLossProtect this_obj_conv;
29909 this_obj_conv.inner = (void*)(this_obj & (~1));
29910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29912 DataLossProtect_free(this_obj_conv);
29915 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) {
29916 LDKDataLossProtect this_ptr_conv;
29917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29918 this_ptr_conv.is_owned = false;
29919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29920 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29921 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
29925 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) {
29926 LDKDataLossProtect this_ptr_conv;
29927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29928 this_ptr_conv.is_owned = false;
29929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29930 LDKThirtyTwoBytes val_ref;
29931 CHECK(val->arr_len == 32);
29932 memcpy(val_ref.data, val->elems, 32); FREE(val);
29933 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
29936 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) {
29937 LDKDataLossProtect this_ptr_conv;
29938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29939 this_ptr_conv.is_owned = false;
29940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29941 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29942 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29946 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) {
29947 LDKDataLossProtect this_ptr_conv;
29948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29949 this_ptr_conv.is_owned = false;
29950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29951 LDKPublicKey val_ref;
29952 CHECK(val->arr_len == 33);
29953 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29954 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
29957 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) {
29958 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
29959 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
29960 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
29961 LDKPublicKey my_current_per_commitment_point_arg_ref;
29962 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
29963 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);
29964 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
29965 uint32_t ret_ref = 0;
29966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29969 ret_ref = (uintptr_t)ret_var.inner;
29970 if (ret_var.is_owned) {
29976 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
29977 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
29978 uint32_t ret_ref = 0;
29979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29982 ret_ref = (uintptr_t)ret_var.inner;
29983 if (ret_var.is_owned) {
29988 uint32_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
29989 LDKDataLossProtect arg_conv;
29990 arg_conv.inner = (void*)(arg & (~1));
29991 arg_conv.is_owned = false;
29992 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29993 uint32_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
29997 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
29998 LDKDataLossProtect orig_conv;
29999 orig_conv.inner = (void*)(orig & (~1));
30000 orig_conv.is_owned = false;
30001 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30002 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
30003 uint32_t ret_ref = 0;
30004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30007 ret_ref = (uintptr_t)ret_var.inner;
30008 if (ret_var.is_owned) {
30014 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
30015 LDKChannelReestablish this_obj_conv;
30016 this_obj_conv.inner = (void*)(this_obj & (~1));
30017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30019 ChannelReestablish_free(this_obj_conv);
30022 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
30023 LDKChannelReestablish this_ptr_conv;
30024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30025 this_ptr_conv.is_owned = false;
30026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30027 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30028 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
30032 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30033 LDKChannelReestablish this_ptr_conv;
30034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30035 this_ptr_conv.is_owned = false;
30036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30037 LDKThirtyTwoBytes val_ref;
30038 CHECK(val->arr_len == 32);
30039 memcpy(val_ref.data, val->elems, 32); FREE(val);
30040 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
30043 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
30044 LDKChannelReestablish this_ptr_conv;
30045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30046 this_ptr_conv.is_owned = false;
30047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30048 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
30052 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) {
30053 LDKChannelReestablish this_ptr_conv;
30054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30055 this_ptr_conv.is_owned = false;
30056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30057 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
30060 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
30061 LDKChannelReestablish this_ptr_conv;
30062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30063 this_ptr_conv.is_owned = false;
30064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30065 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
30069 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) {
30070 LDKChannelReestablish this_ptr_conv;
30071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30072 this_ptr_conv.is_owned = false;
30073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30074 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
30077 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
30078 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
30079 uint32_t ret_ref = 0;
30080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30083 ret_ref = (uintptr_t)ret_var.inner;
30084 if (ret_var.is_owned) {
30089 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
30090 LDKChannelReestablish arg_conv;
30091 arg_conv.inner = (void*)(arg & (~1));
30092 arg_conv.is_owned = false;
30093 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30094 uint32_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
30098 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
30099 LDKChannelReestablish orig_conv;
30100 orig_conv.inner = (void*)(orig & (~1));
30101 orig_conv.is_owned = false;
30102 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30103 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
30104 uint32_t ret_ref = 0;
30105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30108 ret_ref = (uintptr_t)ret_var.inner;
30109 if (ret_var.is_owned) {
30115 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
30116 LDKAnnouncementSignatures this_obj_conv;
30117 this_obj_conv.inner = (void*)(this_obj & (~1));
30118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30120 AnnouncementSignatures_free(this_obj_conv);
30123 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
30124 LDKAnnouncementSignatures this_ptr_conv;
30125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30126 this_ptr_conv.is_owned = false;
30127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30128 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30129 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
30133 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30134 LDKAnnouncementSignatures this_ptr_conv;
30135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30136 this_ptr_conv.is_owned = false;
30137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30138 LDKThirtyTwoBytes val_ref;
30139 CHECK(val->arr_len == 32);
30140 memcpy(val_ref.data, val->elems, 32); FREE(val);
30141 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
30144 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
30145 LDKAnnouncementSignatures this_ptr_conv;
30146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30147 this_ptr_conv.is_owned = false;
30148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30149 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
30153 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30154 LDKAnnouncementSignatures this_ptr_conv;
30155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30156 this_ptr_conv.is_owned = false;
30157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30158 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
30161 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
30162 LDKAnnouncementSignatures this_ptr_conv;
30163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30164 this_ptr_conv.is_owned = false;
30165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30166 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30167 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
30171 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
30172 LDKAnnouncementSignatures this_ptr_conv;
30173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30174 this_ptr_conv.is_owned = false;
30175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30176 LDKSignature val_ref;
30177 CHECK(val->arr_len == 64);
30178 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30179 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
30182 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
30183 LDKAnnouncementSignatures this_ptr_conv;
30184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30185 this_ptr_conv.is_owned = false;
30186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30187 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30188 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
30192 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
30193 LDKAnnouncementSignatures this_ptr_conv;
30194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30195 this_ptr_conv.is_owned = false;
30196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30197 LDKSignature val_ref;
30198 CHECK(val->arr_len == 64);
30199 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30200 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
30203 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) {
30204 LDKThirtyTwoBytes channel_id_arg_ref;
30205 CHECK(channel_id_arg->arr_len == 32);
30206 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30207 LDKSignature node_signature_arg_ref;
30208 CHECK(node_signature_arg->arr_len == 64);
30209 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
30210 LDKSignature bitcoin_signature_arg_ref;
30211 CHECK(bitcoin_signature_arg->arr_len == 64);
30212 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
30213 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
30214 uint32_t ret_ref = 0;
30215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30218 ret_ref = (uintptr_t)ret_var.inner;
30219 if (ret_var.is_owned) {
30225 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
30226 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
30227 uint32_t ret_ref = 0;
30228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30231 ret_ref = (uintptr_t)ret_var.inner;
30232 if (ret_var.is_owned) {
30237 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
30238 LDKAnnouncementSignatures arg_conv;
30239 arg_conv.inner = (void*)(arg & (~1));
30240 arg_conv.is_owned = false;
30241 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30242 uint32_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
30246 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
30247 LDKAnnouncementSignatures orig_conv;
30248 orig_conv.inner = (void*)(orig & (~1));
30249 orig_conv.is_owned = false;
30250 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30251 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
30252 uint32_t ret_ref = 0;
30253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30256 ret_ref = (uintptr_t)ret_var.inner;
30257 if (ret_var.is_owned) {
30263 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
30264 if ((this_ptr & 1) != 0) return;
30265 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30266 CHECK_ACCESS(this_ptr_ptr);
30267 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
30268 FREE((void*)this_ptr);
30269 NetAddress_free(this_ptr_conv);
30272 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
30273 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30274 *ret_copy = NetAddress_clone(arg);
30275 uint32_t ret_ref = (uintptr_t)ret_copy;
30278 uint32_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
30279 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
30280 uint32_t ret_conv = NetAddress_clone_ptr(arg_conv);
30284 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
30285 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
30286 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30287 *ret_copy = NetAddress_clone(orig_conv);
30288 uint32_t ret_ref = (uintptr_t)ret_copy;
30292 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
30293 LDKFourBytes addr_ref;
30294 CHECK(addr->arr_len == 4);
30295 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
30296 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30297 *ret_copy = NetAddress_ipv4(addr_ref, port);
30298 uint32_t ret_ref = (uintptr_t)ret_copy;
30302 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
30303 LDKSixteenBytes addr_ref;
30304 CHECK(addr->arr_len == 16);
30305 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
30306 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30307 *ret_copy = NetAddress_ipv6(addr_ref, port);
30308 uint32_t ret_ref = (uintptr_t)ret_copy;
30312 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
30313 LDKTwelveBytes a_ref;
30314 CHECK(a->arr_len == 12);
30315 memcpy(a_ref.data, a->elems, 12); FREE(a);
30316 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30317 *ret_copy = NetAddress_onion_v2(a_ref);
30318 uint32_t ret_ref = (uintptr_t)ret_copy;
30322 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) {
30323 LDKThirtyTwoBytes ed25519_pubkey_ref;
30324 CHECK(ed25519_pubkey->arr_len == 32);
30325 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
30326 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30327 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
30328 uint32_t ret_ref = (uintptr_t)ret_copy;
30332 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
30333 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
30334 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
30335 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30336 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30337 CVec_u8Z_free(ret_var);
30341 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
30342 LDKu8slice ser_ref;
30343 ser_ref.datalen = ser->arr_len;
30344 ser_ref.data = ser->elems /* XXX ser leaks */;
30345 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
30346 *ret_conv = NetAddress_read(ser_ref);
30347 return (uint32_t)ret_conv;
30350 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
30351 LDKUnsignedNodeAnnouncement this_obj_conv;
30352 this_obj_conv.inner = (void*)(this_obj & (~1));
30353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30355 UnsignedNodeAnnouncement_free(this_obj_conv);
30358 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
30359 LDKUnsignedNodeAnnouncement this_ptr_conv;
30360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30361 this_ptr_conv.is_owned = false;
30362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30363 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30364 uint32_t ret_ref = 0;
30365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30368 ret_ref = (uintptr_t)ret_var.inner;
30369 if (ret_var.is_owned) {
30375 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30376 LDKUnsignedNodeAnnouncement this_ptr_conv;
30377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30378 this_ptr_conv.is_owned = false;
30379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30380 LDKNodeFeatures val_conv;
30381 val_conv.inner = (void*)(val & (~1));
30382 val_conv.is_owned = (val & 1) || (val == 0);
30383 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30384 val_conv = NodeFeatures_clone(&val_conv);
30385 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30388 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
30389 LDKUnsignedNodeAnnouncement this_ptr_conv;
30390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30391 this_ptr_conv.is_owned = false;
30392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30393 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30397 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
30398 LDKUnsignedNodeAnnouncement this_ptr_conv;
30399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30400 this_ptr_conv.is_owned = false;
30401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30402 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30405 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
30406 LDKUnsignedNodeAnnouncement this_ptr_conv;
30407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30408 this_ptr_conv.is_owned = false;
30409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30410 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30411 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
30415 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
30416 LDKUnsignedNodeAnnouncement this_ptr_conv;
30417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30418 this_ptr_conv.is_owned = false;
30419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30420 LDKPublicKey val_ref;
30421 CHECK(val->arr_len == 33);
30422 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30423 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30426 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
30427 LDKUnsignedNodeAnnouncement this_ptr_conv;
30428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30429 this_ptr_conv.is_owned = false;
30430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30431 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
30432 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
30436 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
30437 LDKUnsignedNodeAnnouncement this_ptr_conv;
30438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30439 this_ptr_conv.is_owned = false;
30440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30441 LDKThreeBytes val_ref;
30442 CHECK(val->arr_len == 3);
30443 memcpy(val_ref.data, val->elems, 3); FREE(val);
30444 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30447 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
30448 LDKUnsignedNodeAnnouncement this_ptr_conv;
30449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30450 this_ptr_conv.is_owned = false;
30451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30452 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30453 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
30457 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
30458 LDKUnsignedNodeAnnouncement this_ptr_conv;
30459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30460 this_ptr_conv.is_owned = false;
30461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30462 LDKThirtyTwoBytes val_ref;
30463 CHECK(val->arr_len == 32);
30464 memcpy(val_ref.data, val->elems, 32); FREE(val);
30465 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30468 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
30469 LDKUnsignedNodeAnnouncement this_ptr_conv;
30470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30471 this_ptr_conv.is_owned = false;
30472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30473 LDKCVec_NetAddressZ val_constr;
30474 val_constr.datalen = val->arr_len;
30475 if (val_constr.datalen > 0)
30476 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30478 val_constr.data = NULL;
30479 uint32_t* val_vals = val->elems /* XXX val leaks */;
30480 for (size_t m = 0; m < val_constr.datalen; m++) {
30481 uint32_t val_conv_12 = val_vals[m];
30482 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
30483 CHECK_ACCESS(val_conv_12_ptr);
30484 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30485 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
30486 val_constr.data[m] = val_conv_12_conv;
30488 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30491 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30492 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30493 uint32_t ret_ref = 0;
30494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30497 ret_ref = (uintptr_t)ret_var.inner;
30498 if (ret_var.is_owned) {
30503 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
30504 LDKUnsignedNodeAnnouncement arg_conv;
30505 arg_conv.inner = (void*)(arg & (~1));
30506 arg_conv.is_owned = false;
30507 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30508 uint32_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30512 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
30513 LDKUnsignedNodeAnnouncement orig_conv;
30514 orig_conv.inner = (void*)(orig & (~1));
30515 orig_conv.is_owned = false;
30516 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30517 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30518 uint32_t ret_ref = 0;
30519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30522 ret_ref = (uintptr_t)ret_var.inner;
30523 if (ret_var.is_owned) {
30529 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
30530 LDKNodeAnnouncement this_obj_conv;
30531 this_obj_conv.inner = (void*)(this_obj & (~1));
30532 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30534 NodeAnnouncement_free(this_obj_conv);
30537 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
30538 LDKNodeAnnouncement this_ptr_conv;
30539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30540 this_ptr_conv.is_owned = false;
30541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30542 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30543 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
30547 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
30548 LDKNodeAnnouncement this_ptr_conv;
30549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30550 this_ptr_conv.is_owned = false;
30551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30552 LDKSignature val_ref;
30553 CHECK(val->arr_len == 64);
30554 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30555 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30558 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
30559 LDKNodeAnnouncement this_ptr_conv;
30560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30561 this_ptr_conv.is_owned = false;
30562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30563 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30564 uint32_t ret_ref = 0;
30565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30568 ret_ref = (uintptr_t)ret_var.inner;
30569 if (ret_var.is_owned) {
30575 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
30576 LDKNodeAnnouncement this_ptr_conv;
30577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30578 this_ptr_conv.is_owned = false;
30579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30580 LDKUnsignedNodeAnnouncement val_conv;
30581 val_conv.inner = (void*)(val & (~1));
30582 val_conv.is_owned = (val & 1) || (val == 0);
30583 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30584 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30585 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30588 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
30589 LDKSignature signature_arg_ref;
30590 CHECK(signature_arg->arr_len == 64);
30591 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30592 LDKUnsignedNodeAnnouncement contents_arg_conv;
30593 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30594 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30595 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30596 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30597 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30598 uint32_t ret_ref = 0;
30599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30602 ret_ref = (uintptr_t)ret_var.inner;
30603 if (ret_var.is_owned) {
30609 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30610 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30611 uint32_t ret_ref = 0;
30612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30615 ret_ref = (uintptr_t)ret_var.inner;
30616 if (ret_var.is_owned) {
30621 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
30622 LDKNodeAnnouncement arg_conv;
30623 arg_conv.inner = (void*)(arg & (~1));
30624 arg_conv.is_owned = false;
30625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30626 uint32_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
30630 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
30631 LDKNodeAnnouncement orig_conv;
30632 orig_conv.inner = (void*)(orig & (~1));
30633 orig_conv.is_owned = false;
30634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30635 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
30636 uint32_t ret_ref = 0;
30637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30640 ret_ref = (uintptr_t)ret_var.inner;
30641 if (ret_var.is_owned) {
30647 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
30648 LDKUnsignedChannelAnnouncement this_obj_conv;
30649 this_obj_conv.inner = (void*)(this_obj & (~1));
30650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30652 UnsignedChannelAnnouncement_free(this_obj_conv);
30655 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
30656 LDKUnsignedChannelAnnouncement this_ptr_conv;
30657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30658 this_ptr_conv.is_owned = false;
30659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30660 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
30661 uint32_t ret_ref = 0;
30662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30665 ret_ref = (uintptr_t)ret_var.inner;
30666 if (ret_var.is_owned) {
30672 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30673 LDKUnsignedChannelAnnouncement this_ptr_conv;
30674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30675 this_ptr_conv.is_owned = false;
30676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30677 LDKChannelFeatures val_conv;
30678 val_conv.inner = (void*)(val & (~1));
30679 val_conv.is_owned = (val & 1) || (val == 0);
30680 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30681 val_conv = ChannelFeatures_clone(&val_conv);
30682 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
30685 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
30686 LDKUnsignedChannelAnnouncement this_ptr_conv;
30687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30688 this_ptr_conv.is_owned = false;
30689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30690 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30691 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
30695 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30696 LDKUnsignedChannelAnnouncement 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 LDKThirtyTwoBytes val_ref;
30701 CHECK(val->arr_len == 32);
30702 memcpy(val_ref.data, val->elems, 32); FREE(val);
30703 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
30706 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
30707 LDKUnsignedChannelAnnouncement this_ptr_conv;
30708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30709 this_ptr_conv.is_owned = false;
30710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30711 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
30715 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30716 LDKUnsignedChannelAnnouncement this_ptr_conv;
30717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30718 this_ptr_conv.is_owned = false;
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30720 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
30723 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
30724 LDKUnsignedChannelAnnouncement this_ptr_conv;
30725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30726 this_ptr_conv.is_owned = false;
30727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30728 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30729 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
30733 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
30734 LDKUnsignedChannelAnnouncement this_ptr_conv;
30735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30736 this_ptr_conv.is_owned = false;
30737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30738 LDKPublicKey val_ref;
30739 CHECK(val->arr_len == 33);
30740 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30741 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
30744 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
30745 LDKUnsignedChannelAnnouncement this_ptr_conv;
30746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30747 this_ptr_conv.is_owned = false;
30748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30749 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30750 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
30754 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
30755 LDKUnsignedChannelAnnouncement this_ptr_conv;
30756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30757 this_ptr_conv.is_owned = false;
30758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30759 LDKPublicKey val_ref;
30760 CHECK(val->arr_len == 33);
30761 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30762 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
30765 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
30766 LDKUnsignedChannelAnnouncement this_ptr_conv;
30767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30768 this_ptr_conv.is_owned = false;
30769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30770 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30771 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
30775 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
30776 LDKUnsignedChannelAnnouncement this_ptr_conv;
30777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30778 this_ptr_conv.is_owned = false;
30779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30780 LDKPublicKey val_ref;
30781 CHECK(val->arr_len == 33);
30782 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30783 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
30786 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
30787 LDKUnsignedChannelAnnouncement this_ptr_conv;
30788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30789 this_ptr_conv.is_owned = false;
30790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30791 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30792 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
30796 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
30797 LDKUnsignedChannelAnnouncement this_ptr_conv;
30798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30799 this_ptr_conv.is_owned = false;
30800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30801 LDKPublicKey val_ref;
30802 CHECK(val->arr_len == 33);
30803 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30804 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
30807 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
30808 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
30809 uint32_t ret_ref = 0;
30810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30813 ret_ref = (uintptr_t)ret_var.inner;
30814 if (ret_var.is_owned) {
30819 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
30820 LDKUnsignedChannelAnnouncement arg_conv;
30821 arg_conv.inner = (void*)(arg & (~1));
30822 arg_conv.is_owned = false;
30823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30824 uint32_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
30828 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
30829 LDKUnsignedChannelAnnouncement orig_conv;
30830 orig_conv.inner = (void*)(orig & (~1));
30831 orig_conv.is_owned = false;
30832 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30833 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
30834 uint32_t ret_ref = 0;
30835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30838 ret_ref = (uintptr_t)ret_var.inner;
30839 if (ret_var.is_owned) {
30845 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
30846 LDKChannelAnnouncement this_obj_conv;
30847 this_obj_conv.inner = (void*)(this_obj & (~1));
30848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30850 ChannelAnnouncement_free(this_obj_conv);
30853 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
30854 LDKChannelAnnouncement this_ptr_conv;
30855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30856 this_ptr_conv.is_owned = false;
30857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30858 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30859 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
30863 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
30864 LDKChannelAnnouncement this_ptr_conv;
30865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30866 this_ptr_conv.is_owned = false;
30867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30868 LDKSignature val_ref;
30869 CHECK(val->arr_len == 64);
30870 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30871 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
30874 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
30875 LDKChannelAnnouncement this_ptr_conv;
30876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30877 this_ptr_conv.is_owned = false;
30878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30879 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30880 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
30884 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
30885 LDKChannelAnnouncement this_ptr_conv;
30886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30887 this_ptr_conv.is_owned = false;
30888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30889 LDKSignature val_ref;
30890 CHECK(val->arr_len == 64);
30891 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30892 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
30895 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
30896 LDKChannelAnnouncement this_ptr_conv;
30897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30898 this_ptr_conv.is_owned = false;
30899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30900 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30901 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
30905 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
30906 LDKChannelAnnouncement this_ptr_conv;
30907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30908 this_ptr_conv.is_owned = false;
30909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30910 LDKSignature val_ref;
30911 CHECK(val->arr_len == 64);
30912 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30913 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
30916 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
30917 LDKChannelAnnouncement this_ptr_conv;
30918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30919 this_ptr_conv.is_owned = false;
30920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30921 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30922 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
30926 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
30927 LDKChannelAnnouncement this_ptr_conv;
30928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30929 this_ptr_conv.is_owned = false;
30930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30931 LDKSignature val_ref;
30932 CHECK(val->arr_len == 64);
30933 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30934 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
30937 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
30938 LDKChannelAnnouncement this_ptr_conv;
30939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30940 this_ptr_conv.is_owned = false;
30941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30942 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
30943 uint32_t ret_ref = 0;
30944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30947 ret_ref = (uintptr_t)ret_var.inner;
30948 if (ret_var.is_owned) {
30954 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
30955 LDKChannelAnnouncement this_ptr_conv;
30956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30957 this_ptr_conv.is_owned = false;
30958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30959 LDKUnsignedChannelAnnouncement val_conv;
30960 val_conv.inner = (void*)(val & (~1));
30961 val_conv.is_owned = (val & 1) || (val == 0);
30962 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30963 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
30964 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
30967 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) {
30968 LDKSignature node_signature_1_arg_ref;
30969 CHECK(node_signature_1_arg->arr_len == 64);
30970 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
30971 LDKSignature node_signature_2_arg_ref;
30972 CHECK(node_signature_2_arg->arr_len == 64);
30973 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
30974 LDKSignature bitcoin_signature_1_arg_ref;
30975 CHECK(bitcoin_signature_1_arg->arr_len == 64);
30976 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
30977 LDKSignature bitcoin_signature_2_arg_ref;
30978 CHECK(bitcoin_signature_2_arg->arr_len == 64);
30979 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
30980 LDKUnsignedChannelAnnouncement contents_arg_conv;
30981 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30982 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30983 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30984 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
30985 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);
30986 uint32_t ret_ref = 0;
30987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30990 ret_ref = (uintptr_t)ret_var.inner;
30991 if (ret_var.is_owned) {
30997 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
30998 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
30999 uint32_t ret_ref = 0;
31000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31003 ret_ref = (uintptr_t)ret_var.inner;
31004 if (ret_var.is_owned) {
31009 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
31010 LDKChannelAnnouncement arg_conv;
31011 arg_conv.inner = (void*)(arg & (~1));
31012 arg_conv.is_owned = false;
31013 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31014 uint32_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
31018 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
31019 LDKChannelAnnouncement orig_conv;
31020 orig_conv.inner = (void*)(orig & (~1));
31021 orig_conv.is_owned = false;
31022 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31023 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
31024 uint32_t ret_ref = 0;
31025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31028 ret_ref = (uintptr_t)ret_var.inner;
31029 if (ret_var.is_owned) {
31035 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
31036 LDKUnsignedChannelUpdate this_obj_conv;
31037 this_obj_conv.inner = (void*)(this_obj & (~1));
31038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31040 UnsignedChannelUpdate_free(this_obj_conv);
31043 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
31044 LDKUnsignedChannelUpdate this_ptr_conv;
31045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31046 this_ptr_conv.is_owned = false;
31047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31048 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31049 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
31053 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31054 LDKUnsignedChannelUpdate this_ptr_conv;
31055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31056 this_ptr_conv.is_owned = false;
31057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31058 LDKThirtyTwoBytes val_ref;
31059 CHECK(val->arr_len == 32);
31060 memcpy(val_ref.data, val->elems, 32); FREE(val);
31061 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
31064 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
31065 LDKUnsignedChannelUpdate this_ptr_conv;
31066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31067 this_ptr_conv.is_owned = false;
31068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31069 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
31073 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
31074 LDKUnsignedChannelUpdate this_ptr_conv;
31075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31076 this_ptr_conv.is_owned = false;
31077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31078 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
31081 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
31082 LDKUnsignedChannelUpdate this_ptr_conv;
31083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31084 this_ptr_conv.is_owned = false;
31085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
31090 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
31091 LDKUnsignedChannelUpdate this_ptr_conv;
31092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31093 this_ptr_conv.is_owned = false;
31094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31095 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
31098 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
31099 LDKUnsignedChannelUpdate this_ptr_conv;
31100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31101 this_ptr_conv.is_owned = false;
31102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31103 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
31107 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
31108 LDKUnsignedChannelUpdate this_ptr_conv;
31109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31110 this_ptr_conv.is_owned = false;
31111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31112 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
31115 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
31116 LDKUnsignedChannelUpdate this_ptr_conv;
31117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31118 this_ptr_conv.is_owned = false;
31119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31120 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31124 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31125 LDKUnsignedChannelUpdate this_ptr_conv;
31126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31127 this_ptr_conv.is_owned = false;
31128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31129 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
31132 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
31133 LDKUnsignedChannelUpdate this_ptr_conv;
31134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31135 this_ptr_conv.is_owned = false;
31136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31137 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
31141 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31142 LDKUnsignedChannelUpdate this_ptr_conv;
31143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31144 this_ptr_conv.is_owned = false;
31145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31146 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
31149 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
31150 LDKUnsignedChannelUpdate this_ptr_conv;
31151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31152 this_ptr_conv.is_owned = false;
31153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31154 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
31158 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
31159 LDKUnsignedChannelUpdate this_ptr_conv;
31160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31161 this_ptr_conv.is_owned = false;
31162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31163 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
31166 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
31167 LDKUnsignedChannelUpdate 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 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
31175 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
31176 LDKUnsignedChannelUpdate this_ptr_conv;
31177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31178 this_ptr_conv.is_owned = false;
31179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31180 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
31183 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint32_t this_ptr, int8_tArray val) {
31184 LDKUnsignedChannelUpdate 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 LDKCVec_u8Z val_ref;
31189 val_ref.datalen = val->arr_len;
31190 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31191 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31192 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
31195 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
31196 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
31197 uint32_t ret_ref = 0;
31198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31201 ret_ref = (uintptr_t)ret_var.inner;
31202 if (ret_var.is_owned) {
31207 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
31208 LDKUnsignedChannelUpdate arg_conv;
31209 arg_conv.inner = (void*)(arg & (~1));
31210 arg_conv.is_owned = false;
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31212 uint32_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
31216 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
31217 LDKUnsignedChannelUpdate orig_conv;
31218 orig_conv.inner = (void*)(orig & (~1));
31219 orig_conv.is_owned = false;
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31221 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
31222 uint32_t ret_ref = 0;
31223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31226 ret_ref = (uintptr_t)ret_var.inner;
31227 if (ret_var.is_owned) {
31233 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
31234 LDKChannelUpdate this_obj_conv;
31235 this_obj_conv.inner = (void*)(this_obj & (~1));
31236 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31238 ChannelUpdate_free(this_obj_conv);
31241 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
31242 LDKChannelUpdate this_ptr_conv;
31243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31244 this_ptr_conv.is_owned = false;
31245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31246 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31247 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
31251 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
31252 LDKChannelUpdate this_ptr_conv;
31253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31254 this_ptr_conv.is_owned = false;
31255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31256 LDKSignature val_ref;
31257 CHECK(val->arr_len == 64);
31258 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31259 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
31262 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
31263 LDKChannelUpdate this_ptr_conv;
31264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31265 this_ptr_conv.is_owned = false;
31266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31267 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
31268 uint32_t ret_ref = 0;
31269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31272 ret_ref = (uintptr_t)ret_var.inner;
31273 if (ret_var.is_owned) {
31279 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
31280 LDKChannelUpdate this_ptr_conv;
31281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31282 this_ptr_conv.is_owned = false;
31283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31284 LDKUnsignedChannelUpdate val_conv;
31285 val_conv.inner = (void*)(val & (~1));
31286 val_conv.is_owned = (val & 1) || (val == 0);
31287 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31288 val_conv = UnsignedChannelUpdate_clone(&val_conv);
31289 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
31292 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
31293 LDKSignature signature_arg_ref;
31294 CHECK(signature_arg->arr_len == 64);
31295 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31296 LDKUnsignedChannelUpdate contents_arg_conv;
31297 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31298 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31299 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31300 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
31301 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
31302 uint32_t ret_ref = 0;
31303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31306 ret_ref = (uintptr_t)ret_var.inner;
31307 if (ret_var.is_owned) {
31313 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31314 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31315 uint32_t ret_ref = 0;
31316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31319 ret_ref = (uintptr_t)ret_var.inner;
31320 if (ret_var.is_owned) {
31325 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
31326 LDKChannelUpdate arg_conv;
31327 arg_conv.inner = (void*)(arg & (~1));
31328 arg_conv.is_owned = false;
31329 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31330 uint32_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
31334 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
31335 LDKChannelUpdate orig_conv;
31336 orig_conv.inner = (void*)(orig & (~1));
31337 orig_conv.is_owned = false;
31338 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31339 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31340 uint32_t ret_ref = 0;
31341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31344 ret_ref = (uintptr_t)ret_var.inner;
31345 if (ret_var.is_owned) {
31351 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
31352 LDKQueryChannelRange this_obj_conv;
31353 this_obj_conv.inner = (void*)(this_obj & (~1));
31354 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31356 QueryChannelRange_free(this_obj_conv);
31359 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
31360 LDKQueryChannelRange this_ptr_conv;
31361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31362 this_ptr_conv.is_owned = false;
31363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31364 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31365 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
31369 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31370 LDKQueryChannelRange this_ptr_conv;
31371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31372 this_ptr_conv.is_owned = false;
31373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31374 LDKThirtyTwoBytes val_ref;
31375 CHECK(val->arr_len == 32);
31376 memcpy(val_ref.data, val->elems, 32); FREE(val);
31377 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31380 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
31381 LDKQueryChannelRange this_ptr_conv;
31382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31383 this_ptr_conv.is_owned = false;
31384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31385 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31389 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31390 LDKQueryChannelRange this_ptr_conv;
31391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31392 this_ptr_conv.is_owned = false;
31393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31394 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31397 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31398 LDKQueryChannelRange this_ptr_conv;
31399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31400 this_ptr_conv.is_owned = false;
31401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31402 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31406 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31407 LDKQueryChannelRange this_ptr_conv;
31408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31409 this_ptr_conv.is_owned = false;
31410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31411 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31414 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) {
31415 LDKThirtyTwoBytes chain_hash_arg_ref;
31416 CHECK(chain_hash_arg->arr_len == 32);
31417 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31418 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31419 uint32_t ret_ref = 0;
31420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31423 ret_ref = (uintptr_t)ret_var.inner;
31424 if (ret_var.is_owned) {
31430 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31431 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31432 uint32_t ret_ref = 0;
31433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31436 ret_ref = (uintptr_t)ret_var.inner;
31437 if (ret_var.is_owned) {
31442 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
31443 LDKQueryChannelRange arg_conv;
31444 arg_conv.inner = (void*)(arg & (~1));
31445 arg_conv.is_owned = false;
31446 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31447 uint32_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
31451 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
31452 LDKQueryChannelRange orig_conv;
31453 orig_conv.inner = (void*)(orig & (~1));
31454 orig_conv.is_owned = false;
31455 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31456 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31457 uint32_t ret_ref = 0;
31458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31461 ret_ref = (uintptr_t)ret_var.inner;
31462 if (ret_var.is_owned) {
31468 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
31469 LDKReplyChannelRange this_obj_conv;
31470 this_obj_conv.inner = (void*)(this_obj & (~1));
31471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31473 ReplyChannelRange_free(this_obj_conv);
31476 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
31477 LDKReplyChannelRange this_ptr_conv;
31478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31479 this_ptr_conv.is_owned = false;
31480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31481 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31482 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
31486 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31487 LDKReplyChannelRange this_ptr_conv;
31488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31489 this_ptr_conv.is_owned = false;
31490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31491 LDKThirtyTwoBytes val_ref;
31492 CHECK(val->arr_len == 32);
31493 memcpy(val_ref.data, val->elems, 32); FREE(val);
31494 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31497 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
31498 LDKReplyChannelRange this_ptr_conv;
31499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31500 this_ptr_conv.is_owned = false;
31501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31502 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31506 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31507 LDKReplyChannelRange this_ptr_conv;
31508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31509 this_ptr_conv.is_owned = false;
31510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31511 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31514 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31515 LDKReplyChannelRange this_ptr_conv;
31516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31517 this_ptr_conv.is_owned = false;
31518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31519 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31523 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31524 LDKReplyChannelRange this_ptr_conv;
31525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31526 this_ptr_conv.is_owned = false;
31527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31528 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31531 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
31532 LDKReplyChannelRange this_ptr_conv;
31533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31534 this_ptr_conv.is_owned = false;
31535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31536 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31540 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
31541 LDKReplyChannelRange this_ptr_conv;
31542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31543 this_ptr_conv.is_owned = false;
31544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31545 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31548 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31549 LDKReplyChannelRange this_ptr_conv;
31550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31551 this_ptr_conv.is_owned = false;
31552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31553 LDKCVec_u64Z val_constr;
31554 val_constr.datalen = val->arr_len;
31555 if (val_constr.datalen > 0)
31556 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31558 val_constr.data = NULL;
31559 int64_t* val_vals = val->elems /* XXX val leaks */;
31560 for (size_t i = 0; i < val_constr.datalen; i++) {
31561 int64_t val_conv_8 = val_vals[i];
31562 val_constr.data[i] = val_conv_8;
31564 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31567 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) {
31568 LDKThirtyTwoBytes chain_hash_arg_ref;
31569 CHECK(chain_hash_arg->arr_len == 32);
31570 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31571 LDKCVec_u64Z short_channel_ids_arg_constr;
31572 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31573 if (short_channel_ids_arg_constr.datalen > 0)
31574 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31576 short_channel_ids_arg_constr.data = NULL;
31577 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
31578 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31579 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31580 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31582 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31583 uint32_t ret_ref = 0;
31584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31587 ret_ref = (uintptr_t)ret_var.inner;
31588 if (ret_var.is_owned) {
31594 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31595 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31596 uint32_t ret_ref = 0;
31597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31600 ret_ref = (uintptr_t)ret_var.inner;
31601 if (ret_var.is_owned) {
31606 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
31607 LDKReplyChannelRange arg_conv;
31608 arg_conv.inner = (void*)(arg & (~1));
31609 arg_conv.is_owned = false;
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31611 uint32_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
31615 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
31616 LDKReplyChannelRange orig_conv;
31617 orig_conv.inner = (void*)(orig & (~1));
31618 orig_conv.is_owned = false;
31619 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31620 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
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) {
31632 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
31633 LDKQueryShortChannelIds this_obj_conv;
31634 this_obj_conv.inner = (void*)(this_obj & (~1));
31635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31637 QueryShortChannelIds_free(this_obj_conv);
31640 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
31641 LDKQueryShortChannelIds this_ptr_conv;
31642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31643 this_ptr_conv.is_owned = false;
31644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31645 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31646 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
31650 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31651 LDKQueryShortChannelIds this_ptr_conv;
31652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31653 this_ptr_conv.is_owned = false;
31654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31655 LDKThirtyTwoBytes val_ref;
31656 CHECK(val->arr_len == 32);
31657 memcpy(val_ref.data, val->elems, 32); FREE(val);
31658 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
31661 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31662 LDKQueryShortChannelIds this_ptr_conv;
31663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31664 this_ptr_conv.is_owned = false;
31665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31666 LDKCVec_u64Z val_constr;
31667 val_constr.datalen = val->arr_len;
31668 if (val_constr.datalen > 0)
31669 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31671 val_constr.data = NULL;
31672 int64_t* val_vals = val->elems /* XXX val leaks */;
31673 for (size_t i = 0; i < val_constr.datalen; i++) {
31674 int64_t val_conv_8 = val_vals[i];
31675 val_constr.data[i] = val_conv_8;
31677 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
31680 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
31681 LDKThirtyTwoBytes chain_hash_arg_ref;
31682 CHECK(chain_hash_arg->arr_len == 32);
31683 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31684 LDKCVec_u64Z short_channel_ids_arg_constr;
31685 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31686 if (short_channel_ids_arg_constr.datalen > 0)
31687 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31689 short_channel_ids_arg_constr.data = NULL;
31690 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
31691 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31692 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31693 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31695 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
31696 uint32_t ret_ref = 0;
31697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31700 ret_ref = (uintptr_t)ret_var.inner;
31701 if (ret_var.is_owned) {
31707 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
31708 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
31709 uint32_t ret_ref = 0;
31710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31713 ret_ref = (uintptr_t)ret_var.inner;
31714 if (ret_var.is_owned) {
31719 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
31720 LDKQueryShortChannelIds arg_conv;
31721 arg_conv.inner = (void*)(arg & (~1));
31722 arg_conv.is_owned = false;
31723 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31724 uint32_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
31728 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
31729 LDKQueryShortChannelIds orig_conv;
31730 orig_conv.inner = (void*)(orig & (~1));
31731 orig_conv.is_owned = false;
31732 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31733 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
31734 uint32_t ret_ref = 0;
31735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31738 ret_ref = (uintptr_t)ret_var.inner;
31739 if (ret_var.is_owned) {
31745 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
31746 LDKReplyShortChannelIdsEnd this_obj_conv;
31747 this_obj_conv.inner = (void*)(this_obj & (~1));
31748 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31750 ReplyShortChannelIdsEnd_free(this_obj_conv);
31753 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
31754 LDKReplyShortChannelIdsEnd this_ptr_conv;
31755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31756 this_ptr_conv.is_owned = false;
31757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31758 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31759 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
31763 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31764 LDKReplyShortChannelIdsEnd this_ptr_conv;
31765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31766 this_ptr_conv.is_owned = false;
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31768 LDKThirtyTwoBytes val_ref;
31769 CHECK(val->arr_len == 32);
31770 memcpy(val_ref.data, val->elems, 32); FREE(val);
31771 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
31774 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
31775 LDKReplyShortChannelIdsEnd this_ptr_conv;
31776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31777 this_ptr_conv.is_owned = false;
31778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31779 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
31783 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
31784 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
31791 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
31792 LDKThirtyTwoBytes chain_hash_arg_ref;
31793 CHECK(chain_hash_arg->arr_len == 32);
31794 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31795 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
31796 uint32_t ret_ref = 0;
31797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31800 ret_ref = (uintptr_t)ret_var.inner;
31801 if (ret_var.is_owned) {
31807 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
31808 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
31809 uint32_t ret_ref = 0;
31810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31813 ret_ref = (uintptr_t)ret_var.inner;
31814 if (ret_var.is_owned) {
31819 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
31820 LDKReplyShortChannelIdsEnd arg_conv;
31821 arg_conv.inner = (void*)(arg & (~1));
31822 arg_conv.is_owned = false;
31823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31824 uint32_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
31828 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
31829 LDKReplyShortChannelIdsEnd orig_conv;
31830 orig_conv.inner = (void*)(orig & (~1));
31831 orig_conv.is_owned = false;
31832 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31833 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
31834 uint32_t ret_ref = 0;
31835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31838 ret_ref = (uintptr_t)ret_var.inner;
31839 if (ret_var.is_owned) {
31845 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
31846 LDKGossipTimestampFilter this_obj_conv;
31847 this_obj_conv.inner = (void*)(this_obj & (~1));
31848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31850 GossipTimestampFilter_free(this_obj_conv);
31853 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
31854 LDKGossipTimestampFilter this_ptr_conv;
31855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31856 this_ptr_conv.is_owned = false;
31857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31858 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31859 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
31863 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31864 LDKGossipTimestampFilter this_ptr_conv;
31865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31866 this_ptr_conv.is_owned = false;
31867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868 LDKThirtyTwoBytes val_ref;
31869 CHECK(val->arr_len == 32);
31870 memcpy(val_ref.data, val->elems, 32); FREE(val);
31871 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
31874 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
31875 LDKGossipTimestampFilter this_ptr_conv;
31876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31877 this_ptr_conv.is_owned = false;
31878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31879 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
31883 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
31884 LDKGossipTimestampFilter this_ptr_conv;
31885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31886 this_ptr_conv.is_owned = false;
31887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31888 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
31891 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
31892 LDKGossipTimestampFilter this_ptr_conv;
31893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31894 this_ptr_conv.is_owned = false;
31895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31896 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
31900 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
31901 LDKGossipTimestampFilter this_ptr_conv;
31902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31903 this_ptr_conv.is_owned = false;
31904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31905 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
31908 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) {
31909 LDKThirtyTwoBytes chain_hash_arg_ref;
31910 CHECK(chain_hash_arg->arr_len == 32);
31911 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31912 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
31913 uint32_t ret_ref = 0;
31914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31917 ret_ref = (uintptr_t)ret_var.inner;
31918 if (ret_var.is_owned) {
31924 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
31925 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
31926 uint32_t ret_ref = 0;
31927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31930 ret_ref = (uintptr_t)ret_var.inner;
31931 if (ret_var.is_owned) {
31936 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
31937 LDKGossipTimestampFilter arg_conv;
31938 arg_conv.inner = (void*)(arg & (~1));
31939 arg_conv.is_owned = false;
31940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31941 uint32_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
31945 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
31946 LDKGossipTimestampFilter orig_conv;
31947 orig_conv.inner = (void*)(orig & (~1));
31948 orig_conv.is_owned = false;
31949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31950 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
31951 uint32_t ret_ref = 0;
31952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31955 ret_ref = (uintptr_t)ret_var.inner;
31956 if (ret_var.is_owned) {
31962 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
31963 if ((this_ptr & 1) != 0) return;
31964 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31965 CHECK_ACCESS(this_ptr_ptr);
31966 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
31967 FREE((void*)this_ptr);
31968 ErrorAction_free(this_ptr_conv);
31971 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
31972 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31973 *ret_copy = ErrorAction_clone(arg);
31974 uint32_t ret_ref = (uintptr_t)ret_copy;
31977 uint32_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
31978 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
31979 uint32_t ret_conv = ErrorAction_clone_ptr(arg_conv);
31983 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
31984 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
31985 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31986 *ret_copy = ErrorAction_clone(orig_conv);
31987 uint32_t ret_ref = (uintptr_t)ret_copy;
31991 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
31992 LDKErrorMessage msg_conv;
31993 msg_conv.inner = (void*)(msg & (~1));
31994 msg_conv.is_owned = (msg & 1) || (msg == 0);
31995 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31996 msg_conv = ErrorMessage_clone(&msg_conv);
31997 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31998 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
31999 uint32_t ret_ref = (uintptr_t)ret_copy;
32003 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
32004 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32005 *ret_copy = ErrorAction_ignore_error();
32006 uint32_t ret_ref = (uintptr_t)ret_copy;
32010 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
32011 LDKLevel a_conv = LDKLevel_from_js(a);
32012 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32013 *ret_copy = ErrorAction_ignore_and_log(a_conv);
32014 uint32_t ret_ref = (uintptr_t)ret_copy;
32018 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
32019 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32020 *ret_copy = ErrorAction_ignore_duplicate_gossip();
32021 uint32_t ret_ref = (uintptr_t)ret_copy;
32025 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
32026 LDKErrorMessage msg_conv;
32027 msg_conv.inner = (void*)(msg & (~1));
32028 msg_conv.is_owned = (msg & 1) || (msg == 0);
32029 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32030 msg_conv = ErrorMessage_clone(&msg_conv);
32031 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32032 *ret_copy = ErrorAction_send_error_message(msg_conv);
32033 uint32_t ret_ref = (uintptr_t)ret_copy;
32037 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
32038 LDKWarningMessage msg_conv;
32039 msg_conv.inner = (void*)(msg & (~1));
32040 msg_conv.is_owned = (msg & 1) || (msg == 0);
32041 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32042 msg_conv = WarningMessage_clone(&msg_conv);
32043 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
32044 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32045 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
32046 uint32_t ret_ref = (uintptr_t)ret_copy;
32050 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
32051 LDKLightningError this_obj_conv;
32052 this_obj_conv.inner = (void*)(this_obj & (~1));
32053 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32055 LightningError_free(this_obj_conv);
32058 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
32059 LDKLightningError this_ptr_conv;
32060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32061 this_ptr_conv.is_owned = false;
32062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32063 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
32064 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32069 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
32070 LDKLightningError this_ptr_conv;
32071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32072 this_ptr_conv.is_owned = false;
32073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32074 LDKStr val_conv = str_ref_to_owned_c(val);
32075 LightningError_set_err(&this_ptr_conv, val_conv);
32078 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
32079 LDKLightningError this_ptr_conv;
32080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32081 this_ptr_conv.is_owned = false;
32082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32083 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32084 *ret_copy = LightningError_get_action(&this_ptr_conv);
32085 uint32_t ret_ref = (uintptr_t)ret_copy;
32089 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
32090 LDKLightningError this_ptr_conv;
32091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32092 this_ptr_conv.is_owned = false;
32093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32094 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32095 CHECK_ACCESS(val_ptr);
32096 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
32097 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
32098 LightningError_set_action(&this_ptr_conv, val_conv);
32101 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
32102 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
32103 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
32104 CHECK_ACCESS(action_arg_ptr);
32105 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
32106 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
32107 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
32108 uint32_t ret_ref = 0;
32109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32112 ret_ref = (uintptr_t)ret_var.inner;
32113 if (ret_var.is_owned) {
32119 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
32120 LDKLightningError ret_var = LightningError_clone(arg);
32121 uint32_t ret_ref = 0;
32122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32125 ret_ref = (uintptr_t)ret_var.inner;
32126 if (ret_var.is_owned) {
32131 uint32_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
32132 LDKLightningError arg_conv;
32133 arg_conv.inner = (void*)(arg & (~1));
32134 arg_conv.is_owned = false;
32135 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32136 uint32_t ret_conv = LightningError_clone_ptr(&arg_conv);
32140 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
32141 LDKLightningError orig_conv;
32142 orig_conv.inner = (void*)(orig & (~1));
32143 orig_conv.is_owned = false;
32144 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32145 LDKLightningError ret_var = LightningError_clone(&orig_conv);
32146 uint32_t ret_ref = 0;
32147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32150 ret_ref = (uintptr_t)ret_var.inner;
32151 if (ret_var.is_owned) {
32157 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
32158 LDKCommitmentUpdate this_obj_conv;
32159 this_obj_conv.inner = (void*)(this_obj & (~1));
32160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32162 CommitmentUpdate_free(this_obj_conv);
32165 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
32166 LDKCommitmentUpdate this_ptr_conv;
32167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32168 this_ptr_conv.is_owned = false;
32169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32170 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
32171 uint32_tArray ret_arr = NULL;
32172 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32173 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32174 for (size_t p = 0; p < ret_var.datalen; p++) {
32175 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
32176 uint32_t ret_conv_15_ref = 0;
32177 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32178 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
32180 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
32181 if (ret_conv_15_var.is_owned) {
32182 ret_conv_15_ref |= 1;
32184 ret_arr_ptr[p] = ret_conv_15_ref;
32187 FREE(ret_var.data);
32191 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
32192 LDKCommitmentUpdate this_ptr_conv;
32193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32194 this_ptr_conv.is_owned = false;
32195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32196 LDKCVec_UpdateAddHTLCZ val_constr;
32197 val_constr.datalen = val->arr_len;
32198 if (val_constr.datalen > 0)
32199 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32201 val_constr.data = NULL;
32202 uint32_t* val_vals = val->elems /* XXX val leaks */;
32203 for (size_t p = 0; p < val_constr.datalen; p++) {
32204 uint32_t val_conv_15 = val_vals[p];
32205 LDKUpdateAddHTLC val_conv_15_conv;
32206 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
32207 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
32208 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
32209 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
32210 val_constr.data[p] = val_conv_15_conv;
32212 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
32215 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
32216 LDKCommitmentUpdate this_ptr_conv;
32217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32218 this_ptr_conv.is_owned = false;
32219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
32221 uint32_tArray ret_arr = NULL;
32222 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32223 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32224 for (size_t t = 0; t < ret_var.datalen; t++) {
32225 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
32226 uint32_t ret_conv_19_ref = 0;
32227 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32228 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
32230 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
32231 if (ret_conv_19_var.is_owned) {
32232 ret_conv_19_ref |= 1;
32234 ret_arr_ptr[t] = ret_conv_19_ref;
32237 FREE(ret_var.data);
32241 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
32242 LDKCommitmentUpdate this_ptr_conv;
32243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32244 this_ptr_conv.is_owned = false;
32245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32246 LDKCVec_UpdateFulfillHTLCZ val_constr;
32247 val_constr.datalen = val->arr_len;
32248 if (val_constr.datalen > 0)
32249 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32251 val_constr.data = NULL;
32252 uint32_t* val_vals = val->elems /* XXX val leaks */;
32253 for (size_t t = 0; t < val_constr.datalen; t++) {
32254 uint32_t val_conv_19 = val_vals[t];
32255 LDKUpdateFulfillHTLC val_conv_19_conv;
32256 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
32257 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
32258 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
32259 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
32260 val_constr.data[t] = val_conv_19_conv;
32262 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
32265 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
32266 LDKCommitmentUpdate this_ptr_conv;
32267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32268 this_ptr_conv.is_owned = false;
32269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32270 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
32271 uint32_tArray ret_arr = NULL;
32272 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32273 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32274 for (size_t q = 0; q < ret_var.datalen; q++) {
32275 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
32276 uint32_t ret_conv_16_ref = 0;
32277 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32278 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32280 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
32281 if (ret_conv_16_var.is_owned) {
32282 ret_conv_16_ref |= 1;
32284 ret_arr_ptr[q] = ret_conv_16_ref;
32287 FREE(ret_var.data);
32291 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
32292 LDKCommitmentUpdate this_ptr_conv;
32293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32294 this_ptr_conv.is_owned = false;
32295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32296 LDKCVec_UpdateFailHTLCZ val_constr;
32297 val_constr.datalen = val->arr_len;
32298 if (val_constr.datalen > 0)
32299 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32301 val_constr.data = NULL;
32302 uint32_t* val_vals = val->elems /* XXX val leaks */;
32303 for (size_t q = 0; q < val_constr.datalen; q++) {
32304 uint32_t val_conv_16 = val_vals[q];
32305 LDKUpdateFailHTLC val_conv_16_conv;
32306 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
32307 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
32308 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32309 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
32310 val_constr.data[q] = val_conv_16_conv;
32312 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
32315 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
32316 LDKCommitmentUpdate this_ptr_conv;
32317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32318 this_ptr_conv.is_owned = false;
32319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32320 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
32321 uint32_tArray ret_arr = NULL;
32322 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32323 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32324 for (size_t z = 0; z < ret_var.datalen; z++) {
32325 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
32326 uint32_t ret_conv_25_ref = 0;
32327 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32328 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32330 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
32331 if (ret_conv_25_var.is_owned) {
32332 ret_conv_25_ref |= 1;
32334 ret_arr_ptr[z] = ret_conv_25_ref;
32337 FREE(ret_var.data);
32341 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) {
32342 LDKCommitmentUpdate this_ptr_conv;
32343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32344 this_ptr_conv.is_owned = false;
32345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32346 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32347 val_constr.datalen = val->arr_len;
32348 if (val_constr.datalen > 0)
32349 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32351 val_constr.data = NULL;
32352 uint32_t* val_vals = val->elems /* XXX val leaks */;
32353 for (size_t z = 0; z < val_constr.datalen; z++) {
32354 uint32_t val_conv_25 = val_vals[z];
32355 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32356 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
32357 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
32358 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32359 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32360 val_constr.data[z] = val_conv_25_conv;
32362 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32365 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
32366 LDKCommitmentUpdate this_ptr_conv;
32367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32368 this_ptr_conv.is_owned = false;
32369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32370 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32371 uint32_t ret_ref = 0;
32372 if ((uintptr_t)ret_var.inner > 4096) {
32373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32376 ret_ref = (uintptr_t)ret_var.inner;
32377 if (ret_var.is_owned) {
32384 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
32385 LDKCommitmentUpdate this_ptr_conv;
32386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32387 this_ptr_conv.is_owned = false;
32388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32389 LDKUpdateFee val_conv;
32390 val_conv.inner = (void*)(val & (~1));
32391 val_conv.is_owned = (val & 1) || (val == 0);
32392 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32393 val_conv = UpdateFee_clone(&val_conv);
32394 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32397 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
32398 LDKCommitmentUpdate this_ptr_conv;
32399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32400 this_ptr_conv.is_owned = false;
32401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32402 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32403 uint32_t ret_ref = 0;
32404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32407 ret_ref = (uintptr_t)ret_var.inner;
32408 if (ret_var.is_owned) {
32414 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
32415 LDKCommitmentUpdate this_ptr_conv;
32416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32417 this_ptr_conv.is_owned = false;
32418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32419 LDKCommitmentSigned val_conv;
32420 val_conv.inner = (void*)(val & (~1));
32421 val_conv.is_owned = (val & 1) || (val == 0);
32422 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32423 val_conv = CommitmentSigned_clone(&val_conv);
32424 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32427 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) {
32428 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32429 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
32430 if (update_add_htlcs_arg_constr.datalen > 0)
32431 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32433 update_add_htlcs_arg_constr.data = NULL;
32434 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems /* XXX update_add_htlcs_arg leaks */;
32435 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32436 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32437 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32438 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
32439 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
32440 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32441 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32442 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32444 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32445 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
32446 if (update_fulfill_htlcs_arg_constr.datalen > 0)
32447 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32449 update_fulfill_htlcs_arg_constr.data = NULL;
32450 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems /* XXX update_fulfill_htlcs_arg leaks */;
32451 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32452 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32453 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32454 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
32455 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
32456 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32457 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32458 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32460 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32461 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
32462 if (update_fail_htlcs_arg_constr.datalen > 0)
32463 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32465 update_fail_htlcs_arg_constr.data = NULL;
32466 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems /* XXX update_fail_htlcs_arg leaks */;
32467 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32468 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32469 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32470 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
32471 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
32472 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32473 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32474 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32476 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32477 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
32478 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32479 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32481 update_fail_malformed_htlcs_arg_constr.data = NULL;
32482 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems /* XXX update_fail_malformed_htlcs_arg leaks */;
32483 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32484 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32485 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32486 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
32487 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);
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32489 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32490 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32492 LDKUpdateFee update_fee_arg_conv;
32493 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
32494 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
32495 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32496 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32497 LDKCommitmentSigned commitment_signed_arg_conv;
32498 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
32499 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
32500 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32501 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32502 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);
32503 uint32_t ret_ref = 0;
32504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32507 ret_ref = (uintptr_t)ret_var.inner;
32508 if (ret_var.is_owned) {
32514 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32515 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32516 uint32_t ret_ref = 0;
32517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32520 ret_ref = (uintptr_t)ret_var.inner;
32521 if (ret_var.is_owned) {
32526 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
32527 LDKCommitmentUpdate arg_conv;
32528 arg_conv.inner = (void*)(arg & (~1));
32529 arg_conv.is_owned = false;
32530 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32531 uint32_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
32535 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
32536 LDKCommitmentUpdate orig_conv;
32537 orig_conv.inner = (void*)(orig & (~1));
32538 orig_conv.is_owned = false;
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32540 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32541 uint32_t ret_ref = 0;
32542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32545 ret_ref = (uintptr_t)ret_var.inner;
32546 if (ret_var.is_owned) {
32552 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
32553 if ((this_ptr & 1) != 0) return;
32554 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32555 CHECK_ACCESS(this_ptr_ptr);
32556 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32557 FREE((void*)this_ptr);
32558 ChannelMessageHandler_free(this_ptr_conv);
32561 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
32562 if ((this_ptr & 1) != 0) return;
32563 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32564 CHECK_ACCESS(this_ptr_ptr);
32565 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32566 FREE((void*)this_ptr);
32567 RoutingMessageHandler_free(this_ptr_conv);
32570 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
32571 LDKAcceptChannel obj_conv;
32572 obj_conv.inner = (void*)(obj & (~1));
32573 obj_conv.is_owned = false;
32574 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32575 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32576 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32577 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32578 CVec_u8Z_free(ret_var);
32582 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
32583 LDKu8slice ser_ref;
32584 ser_ref.datalen = ser->arr_len;
32585 ser_ref.data = ser->elems /* XXX ser leaks */;
32586 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32587 *ret_conv = AcceptChannel_read(ser_ref);
32588 return (uint32_t)ret_conv;
32591 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
32592 LDKAnnouncementSignatures obj_conv;
32593 obj_conv.inner = (void*)(obj & (~1));
32594 obj_conv.is_owned = false;
32595 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32596 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32597 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32598 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32599 CVec_u8Z_free(ret_var);
32603 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
32604 LDKu8slice ser_ref;
32605 ser_ref.datalen = ser->arr_len;
32606 ser_ref.data = ser->elems /* XXX ser leaks */;
32607 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32608 *ret_conv = AnnouncementSignatures_read(ser_ref);
32609 return (uint32_t)ret_conv;
32612 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
32613 LDKChannelReestablish obj_conv;
32614 obj_conv.inner = (void*)(obj & (~1));
32615 obj_conv.is_owned = false;
32616 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32617 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32618 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32619 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32620 CVec_u8Z_free(ret_var);
32624 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
32625 LDKu8slice ser_ref;
32626 ser_ref.datalen = ser->arr_len;
32627 ser_ref.data = ser->elems /* XXX ser leaks */;
32628 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
32629 *ret_conv = ChannelReestablish_read(ser_ref);
32630 return (uint32_t)ret_conv;
32633 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
32634 LDKClosingSigned obj_conv;
32635 obj_conv.inner = (void*)(obj & (~1));
32636 obj_conv.is_owned = false;
32637 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32638 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
32639 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32640 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32641 CVec_u8Z_free(ret_var);
32645 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
32646 LDKu8slice ser_ref;
32647 ser_ref.datalen = ser->arr_len;
32648 ser_ref.data = ser->elems /* XXX ser leaks */;
32649 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
32650 *ret_conv = ClosingSigned_read(ser_ref);
32651 return (uint32_t)ret_conv;
32654 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
32655 LDKClosingSignedFeeRange obj_conv;
32656 obj_conv.inner = (void*)(obj & (~1));
32657 obj_conv.is_owned = false;
32658 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32659 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
32660 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32661 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32662 CVec_u8Z_free(ret_var);
32666 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
32667 LDKu8slice ser_ref;
32668 ser_ref.datalen = ser->arr_len;
32669 ser_ref.data = ser->elems /* XXX ser leaks */;
32670 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
32671 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
32672 return (uint32_t)ret_conv;
32675 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
32676 LDKCommitmentSigned obj_conv;
32677 obj_conv.inner = (void*)(obj & (~1));
32678 obj_conv.is_owned = false;
32679 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32680 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
32681 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32682 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32683 CVec_u8Z_free(ret_var);
32687 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
32688 LDKu8slice ser_ref;
32689 ser_ref.datalen = ser->arr_len;
32690 ser_ref.data = ser->elems /* XXX ser leaks */;
32691 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
32692 *ret_conv = CommitmentSigned_read(ser_ref);
32693 return (uint32_t)ret_conv;
32696 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
32697 LDKFundingCreated obj_conv;
32698 obj_conv.inner = (void*)(obj & (~1));
32699 obj_conv.is_owned = false;
32700 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32701 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
32702 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32703 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32704 CVec_u8Z_free(ret_var);
32708 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
32709 LDKu8slice ser_ref;
32710 ser_ref.datalen = ser->arr_len;
32711 ser_ref.data = ser->elems /* XXX ser leaks */;
32712 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
32713 *ret_conv = FundingCreated_read(ser_ref);
32714 return (uint32_t)ret_conv;
32717 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
32718 LDKFundingSigned obj_conv;
32719 obj_conv.inner = (void*)(obj & (~1));
32720 obj_conv.is_owned = false;
32721 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32722 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
32723 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32724 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32725 CVec_u8Z_free(ret_var);
32729 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
32730 LDKu8slice ser_ref;
32731 ser_ref.datalen = ser->arr_len;
32732 ser_ref.data = ser->elems /* XXX ser leaks */;
32733 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32734 *ret_conv = FundingSigned_read(ser_ref);
32735 return (uint32_t)ret_conv;
32738 int8_tArray __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint32_t obj) {
32739 LDKChannelReady obj_conv;
32740 obj_conv.inner = (void*)(obj & (~1));
32741 obj_conv.is_owned = false;
32742 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32743 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
32744 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32745 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32746 CVec_u8Z_free(ret_var);
32750 uint32_t __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
32751 LDKu8slice ser_ref;
32752 ser_ref.datalen = ser->arr_len;
32753 ser_ref.data = ser->elems /* XXX ser leaks */;
32754 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32755 *ret_conv = ChannelReady_read(ser_ref);
32756 return (uint32_t)ret_conv;
32759 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
32761 obj_conv.inner = (void*)(obj & (~1));
32762 obj_conv.is_owned = false;
32763 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32764 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
32765 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32766 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32767 CVec_u8Z_free(ret_var);
32771 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
32772 LDKu8slice ser_ref;
32773 ser_ref.datalen = ser->arr_len;
32774 ser_ref.data = ser->elems /* XXX ser leaks */;
32775 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32776 *ret_conv = Init_read(ser_ref);
32777 return (uint32_t)ret_conv;
32780 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
32781 LDKOpenChannel obj_conv;
32782 obj_conv.inner = (void*)(obj & (~1));
32783 obj_conv.is_owned = false;
32784 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32785 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
32786 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32787 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32788 CVec_u8Z_free(ret_var);
32792 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
32793 LDKu8slice ser_ref;
32794 ser_ref.datalen = ser->arr_len;
32795 ser_ref.data = ser->elems /* XXX ser leaks */;
32796 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32797 *ret_conv = OpenChannel_read(ser_ref);
32798 return (uint32_t)ret_conv;
32801 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
32802 LDKRevokeAndACK obj_conv;
32803 obj_conv.inner = (void*)(obj & (~1));
32804 obj_conv.is_owned = false;
32805 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32806 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
32807 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32808 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32809 CVec_u8Z_free(ret_var);
32813 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
32814 LDKu8slice ser_ref;
32815 ser_ref.datalen = ser->arr_len;
32816 ser_ref.data = ser->elems /* XXX ser leaks */;
32817 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32818 *ret_conv = RevokeAndACK_read(ser_ref);
32819 return (uint32_t)ret_conv;
32822 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
32823 LDKShutdown obj_conv;
32824 obj_conv.inner = (void*)(obj & (~1));
32825 obj_conv.is_owned = false;
32826 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32827 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
32828 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32829 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32830 CVec_u8Z_free(ret_var);
32834 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
32835 LDKu8slice ser_ref;
32836 ser_ref.datalen = ser->arr_len;
32837 ser_ref.data = ser->elems /* XXX ser leaks */;
32838 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32839 *ret_conv = Shutdown_read(ser_ref);
32840 return (uint32_t)ret_conv;
32843 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
32844 LDKUpdateFailHTLC obj_conv;
32845 obj_conv.inner = (void*)(obj & (~1));
32846 obj_conv.is_owned = false;
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32848 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
32849 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32850 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32851 CVec_u8Z_free(ret_var);
32855 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
32856 LDKu8slice ser_ref;
32857 ser_ref.datalen = ser->arr_len;
32858 ser_ref.data = ser->elems /* XXX ser leaks */;
32859 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32860 *ret_conv = UpdateFailHTLC_read(ser_ref);
32861 return (uint32_t)ret_conv;
32864 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
32865 LDKUpdateFailMalformedHTLC obj_conv;
32866 obj_conv.inner = (void*)(obj & (~1));
32867 obj_conv.is_owned = false;
32868 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32869 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
32870 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32871 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32872 CVec_u8Z_free(ret_var);
32876 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
32877 LDKu8slice ser_ref;
32878 ser_ref.datalen = ser->arr_len;
32879 ser_ref.data = ser->elems /* XXX ser leaks */;
32880 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32881 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
32882 return (uint32_t)ret_conv;
32885 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
32886 LDKUpdateFee obj_conv;
32887 obj_conv.inner = (void*)(obj & (~1));
32888 obj_conv.is_owned = false;
32889 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32890 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
32891 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32892 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32893 CVec_u8Z_free(ret_var);
32897 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
32898 LDKu8slice ser_ref;
32899 ser_ref.datalen = ser->arr_len;
32900 ser_ref.data = ser->elems /* XXX ser leaks */;
32901 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32902 *ret_conv = UpdateFee_read(ser_ref);
32903 return (uint32_t)ret_conv;
32906 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
32907 LDKUpdateFulfillHTLC obj_conv;
32908 obj_conv.inner = (void*)(obj & (~1));
32909 obj_conv.is_owned = false;
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32911 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
32912 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32913 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32914 CVec_u8Z_free(ret_var);
32918 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
32919 LDKu8slice ser_ref;
32920 ser_ref.datalen = ser->arr_len;
32921 ser_ref.data = ser->elems /* XXX ser leaks */;
32922 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32923 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
32924 return (uint32_t)ret_conv;
32927 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
32928 LDKUpdateAddHTLC obj_conv;
32929 obj_conv.inner = (void*)(obj & (~1));
32930 obj_conv.is_owned = false;
32931 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32932 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
32933 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32934 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32935 CVec_u8Z_free(ret_var);
32939 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
32940 LDKu8slice ser_ref;
32941 ser_ref.datalen = ser->arr_len;
32942 ser_ref.data = ser->elems /* XXX ser leaks */;
32943 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32944 *ret_conv = UpdateAddHTLC_read(ser_ref);
32945 return (uint32_t)ret_conv;
32948 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
32950 obj_conv.inner = (void*)(obj & (~1));
32951 obj_conv.is_owned = false;
32952 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32953 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
32954 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32955 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32956 CVec_u8Z_free(ret_var);
32960 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
32961 LDKu8slice ser_ref;
32962 ser_ref.datalen = ser->arr_len;
32963 ser_ref.data = ser->elems /* XXX ser leaks */;
32964 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32965 *ret_conv = Ping_read(ser_ref);
32966 return (uint32_t)ret_conv;
32969 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
32971 obj_conv.inner = (void*)(obj & (~1));
32972 obj_conv.is_owned = false;
32973 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32974 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
32975 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32976 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32977 CVec_u8Z_free(ret_var);
32981 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
32982 LDKu8slice ser_ref;
32983 ser_ref.datalen = ser->arr_len;
32984 ser_ref.data = ser->elems /* XXX ser leaks */;
32985 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32986 *ret_conv = Pong_read(ser_ref);
32987 return (uint32_t)ret_conv;
32990 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
32991 LDKUnsignedChannelAnnouncement obj_conv;
32992 obj_conv.inner = (void*)(obj & (~1));
32993 obj_conv.is_owned = false;
32994 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32995 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
32996 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32997 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32998 CVec_u8Z_free(ret_var);
33002 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
33003 LDKu8slice ser_ref;
33004 ser_ref.datalen = ser->arr_len;
33005 ser_ref.data = ser->elems /* XXX ser leaks */;
33006 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
33007 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
33008 return (uint32_t)ret_conv;
33011 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
33012 LDKChannelAnnouncement obj_conv;
33013 obj_conv.inner = (void*)(obj & (~1));
33014 obj_conv.is_owned = false;
33015 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33016 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
33017 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33018 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33019 CVec_u8Z_free(ret_var);
33023 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
33024 LDKu8slice ser_ref;
33025 ser_ref.datalen = ser->arr_len;
33026 ser_ref.data = ser->elems /* XXX ser leaks */;
33027 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
33028 *ret_conv = ChannelAnnouncement_read(ser_ref);
33029 return (uint32_t)ret_conv;
33032 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
33033 LDKUnsignedChannelUpdate obj_conv;
33034 obj_conv.inner = (void*)(obj & (~1));
33035 obj_conv.is_owned = false;
33036 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33037 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
33038 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33039 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33040 CVec_u8Z_free(ret_var);
33044 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
33045 LDKu8slice ser_ref;
33046 ser_ref.datalen = ser->arr_len;
33047 ser_ref.data = ser->elems /* XXX ser leaks */;
33048 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33049 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
33050 return (uint32_t)ret_conv;
33053 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
33054 LDKChannelUpdate obj_conv;
33055 obj_conv.inner = (void*)(obj & (~1));
33056 obj_conv.is_owned = false;
33057 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33058 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
33059 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33060 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33061 CVec_u8Z_free(ret_var);
33065 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
33066 LDKu8slice ser_ref;
33067 ser_ref.datalen = ser->arr_len;
33068 ser_ref.data = ser->elems /* XXX ser leaks */;
33069 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33070 *ret_conv = ChannelUpdate_read(ser_ref);
33071 return (uint32_t)ret_conv;
33074 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
33075 LDKErrorMessage obj_conv;
33076 obj_conv.inner = (void*)(obj & (~1));
33077 obj_conv.is_owned = false;
33078 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33079 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
33080 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33081 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33082 CVec_u8Z_free(ret_var);
33086 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
33087 LDKu8slice ser_ref;
33088 ser_ref.datalen = ser->arr_len;
33089 ser_ref.data = ser->elems /* XXX ser leaks */;
33090 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33091 *ret_conv = ErrorMessage_read(ser_ref);
33092 return (uint32_t)ret_conv;
33095 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
33096 LDKWarningMessage obj_conv;
33097 obj_conv.inner = (void*)(obj & (~1));
33098 obj_conv.is_owned = false;
33099 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33100 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
33101 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33102 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33103 CVec_u8Z_free(ret_var);
33107 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
33108 LDKu8slice ser_ref;
33109 ser_ref.datalen = ser->arr_len;
33110 ser_ref.data = ser->elems /* XXX ser leaks */;
33111 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33112 *ret_conv = WarningMessage_read(ser_ref);
33113 return (uint32_t)ret_conv;
33116 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
33117 LDKUnsignedNodeAnnouncement obj_conv;
33118 obj_conv.inner = (void*)(obj & (~1));
33119 obj_conv.is_owned = false;
33120 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33121 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
33122 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33123 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33124 CVec_u8Z_free(ret_var);
33128 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
33129 LDKu8slice ser_ref;
33130 ser_ref.datalen = ser->arr_len;
33131 ser_ref.data = ser->elems /* XXX ser leaks */;
33132 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33133 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
33134 return (uint32_t)ret_conv;
33137 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
33138 LDKNodeAnnouncement obj_conv;
33139 obj_conv.inner = (void*)(obj & (~1));
33140 obj_conv.is_owned = false;
33141 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33142 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
33143 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33144 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33145 CVec_u8Z_free(ret_var);
33149 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
33150 LDKu8slice ser_ref;
33151 ser_ref.datalen = ser->arr_len;
33152 ser_ref.data = ser->elems /* XXX ser leaks */;
33153 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33154 *ret_conv = NodeAnnouncement_read(ser_ref);
33155 return (uint32_t)ret_conv;
33158 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
33159 LDKu8slice ser_ref;
33160 ser_ref.datalen = ser->arr_len;
33161 ser_ref.data = ser->elems /* XXX ser leaks */;
33162 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33163 *ret_conv = QueryShortChannelIds_read(ser_ref);
33164 return (uint32_t)ret_conv;
33167 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
33168 LDKQueryShortChannelIds obj_conv;
33169 obj_conv.inner = (void*)(obj & (~1));
33170 obj_conv.is_owned = false;
33171 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33172 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
33173 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33174 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33175 CVec_u8Z_free(ret_var);
33179 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
33180 LDKReplyShortChannelIdsEnd obj_conv;
33181 obj_conv.inner = (void*)(obj & (~1));
33182 obj_conv.is_owned = false;
33183 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33184 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
33185 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33186 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33187 CVec_u8Z_free(ret_var);
33191 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
33192 LDKu8slice ser_ref;
33193 ser_ref.datalen = ser->arr_len;
33194 ser_ref.data = ser->elems /* XXX ser leaks */;
33195 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33196 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
33197 return (uint32_t)ret_conv;
33200 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
33201 LDKQueryChannelRange this_arg_conv;
33202 this_arg_conv.inner = (void*)(this_arg & (~1));
33203 this_arg_conv.is_owned = false;
33204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33205 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
33209 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
33210 LDKQueryChannelRange obj_conv;
33211 obj_conv.inner = (void*)(obj & (~1));
33212 obj_conv.is_owned = false;
33213 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33214 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
33215 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33216 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33217 CVec_u8Z_free(ret_var);
33221 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
33222 LDKu8slice ser_ref;
33223 ser_ref.datalen = ser->arr_len;
33224 ser_ref.data = ser->elems /* XXX ser leaks */;
33225 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33226 *ret_conv = QueryChannelRange_read(ser_ref);
33227 return (uint32_t)ret_conv;
33230 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
33231 LDKu8slice ser_ref;
33232 ser_ref.datalen = ser->arr_len;
33233 ser_ref.data = ser->elems /* XXX ser leaks */;
33234 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33235 *ret_conv = ReplyChannelRange_read(ser_ref);
33236 return (uint32_t)ret_conv;
33239 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
33240 LDKReplyChannelRange obj_conv;
33241 obj_conv.inner = (void*)(obj & (~1));
33242 obj_conv.is_owned = false;
33243 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33244 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
33245 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33246 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33247 CVec_u8Z_free(ret_var);
33251 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
33252 LDKGossipTimestampFilter obj_conv;
33253 obj_conv.inner = (void*)(obj & (~1));
33254 obj_conv.is_owned = false;
33255 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33256 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
33257 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33258 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33259 CVec_u8Z_free(ret_var);
33263 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
33264 LDKu8slice ser_ref;
33265 ser_ref.datalen = ser->arr_len;
33266 ser_ref.data = ser->elems /* XXX ser leaks */;
33267 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33268 *ret_conv = GossipTimestampFilter_read(ser_ref);
33269 return (uint32_t)ret_conv;
33272 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
33273 if ((this_ptr & 1) != 0) return;
33274 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33275 CHECK_ACCESS(this_ptr_ptr);
33276 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
33277 FREE((void*)this_ptr);
33278 CustomMessageHandler_free(this_ptr_conv);
33281 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
33282 LDKIgnoringMessageHandler this_obj_conv;
33283 this_obj_conv.inner = (void*)(this_obj & (~1));
33284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33286 IgnoringMessageHandler_free(this_obj_conv);
33289 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
33290 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33291 uint32_t ret_ref = 0;
33292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33295 ret_ref = (uintptr_t)ret_var.inner;
33296 if (ret_var.is_owned) {
33302 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33303 LDKIgnoringMessageHandler this_arg_conv;
33304 this_arg_conv.inner = (void*)(this_arg & (~1));
33305 this_arg_conv.is_owned = false;
33306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33307 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33308 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33309 return (uint32_t)ret_ret;
33312 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
33313 LDKIgnoringMessageHandler this_arg_conv;
33314 this_arg_conv.inner = (void*)(this_arg & (~1));
33315 this_arg_conv.is_owned = false;
33316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33317 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33318 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33319 return (uint32_t)ret_ret;
33322 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
33323 LDKIgnoringMessageHandler this_arg_conv;
33324 this_arg_conv.inner = (void*)(this_arg & (~1));
33325 this_arg_conv.is_owned = false;
33326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33327 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33328 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33329 return (uint32_t)ret_ret;
33332 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
33333 LDKIgnoringMessageHandler this_arg_conv;
33334 this_arg_conv.inner = (void*)(this_arg & (~1));
33335 this_arg_conv.is_owned = false;
33336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33337 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33338 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33339 return (uint32_t)ret_ret;
33342 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
33343 LDKErroringMessageHandler this_obj_conv;
33344 this_obj_conv.inner = (void*)(this_obj & (~1));
33345 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33347 ErroringMessageHandler_free(this_obj_conv);
33350 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
33351 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33352 uint32_t ret_ref = 0;
33353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33356 ret_ref = (uintptr_t)ret_var.inner;
33357 if (ret_var.is_owned) {
33363 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33364 LDKErroringMessageHandler this_arg_conv;
33365 this_arg_conv.inner = (void*)(this_arg & (~1));
33366 this_arg_conv.is_owned = false;
33367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33368 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33369 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33370 return (uint32_t)ret_ret;
33373 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
33374 LDKErroringMessageHandler this_arg_conv;
33375 this_arg_conv.inner = (void*)(this_arg & (~1));
33376 this_arg_conv.is_owned = false;
33377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33378 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33379 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33380 return (uint32_t)ret_ret;
33383 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
33384 LDKMessageHandler this_obj_conv;
33385 this_obj_conv.inner = (void*)(this_obj & (~1));
33386 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33388 MessageHandler_free(this_obj_conv);
33391 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
33392 LDKMessageHandler this_ptr_conv;
33393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33394 this_ptr_conv.is_owned = false;
33395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33396 // WARNING: This object doesn't live past this scope, needs clone!
33397 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
33401 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
33402 LDKMessageHandler this_ptr_conv;
33403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33404 this_ptr_conv.is_owned = false;
33405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33406 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33407 CHECK_ACCESS(val_ptr);
33408 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33409 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33411 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33413 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33416 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
33417 LDKMessageHandler this_ptr_conv;
33418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33419 this_ptr_conv.is_owned = false;
33420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33421 // WARNING: This object doesn't live past this scope, needs clone!
33422 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
33426 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
33427 LDKMessageHandler this_ptr_conv;
33428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33429 this_ptr_conv.is_owned = false;
33430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33431 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33432 CHECK_ACCESS(val_ptr);
33433 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33434 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33435 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33436 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33438 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33441 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
33442 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
33443 CHECK_ACCESS(chan_handler_arg_ptr);
33444 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33445 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33446 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33447 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33449 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
33450 CHECK_ACCESS(route_handler_arg_ptr);
33451 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33452 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33454 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33456 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
33457 uint32_t ret_ref = 0;
33458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33461 ret_ref = (uintptr_t)ret_var.inner;
33462 if (ret_var.is_owned) {
33468 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33469 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33470 *ret_ret = SocketDescriptor_clone(arg);
33471 return (uint32_t)ret_ret;
33473 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
33474 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
33475 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
33476 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33477 uint32_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
33481 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
33482 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
33483 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
33484 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33485 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33486 *ret_ret = SocketDescriptor_clone(orig_conv);
33487 return (uint32_t)ret_ret;
33490 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
33491 if ((this_ptr & 1) != 0) return;
33492 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33493 CHECK_ACCESS(this_ptr_ptr);
33494 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33495 FREE((void*)this_ptr);
33496 SocketDescriptor_free(this_ptr_conv);
33499 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
33500 LDKPeerHandleError this_obj_conv;
33501 this_obj_conv.inner = (void*)(this_obj & (~1));
33502 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33504 PeerHandleError_free(this_obj_conv);
33507 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
33508 LDKPeerHandleError this_ptr_conv;
33509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33510 this_ptr_conv.is_owned = false;
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33516 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
33517 LDKPeerHandleError this_ptr_conv;
33518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33519 this_ptr_conv.is_owned = false;
33520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33521 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33524 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
33525 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33526 uint32_t ret_ref = 0;
33527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33530 ret_ref = (uintptr_t)ret_var.inner;
33531 if (ret_var.is_owned) {
33537 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33538 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33539 uint32_t ret_ref = 0;
33540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33543 ret_ref = (uintptr_t)ret_var.inner;
33544 if (ret_var.is_owned) {
33549 uint32_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
33550 LDKPeerHandleError arg_conv;
33551 arg_conv.inner = (void*)(arg & (~1));
33552 arg_conv.is_owned = false;
33553 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33554 uint32_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
33558 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
33559 LDKPeerHandleError orig_conv;
33560 orig_conv.inner = (void*)(orig & (~1));
33561 orig_conv.is_owned = false;
33562 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33563 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33564 uint32_t ret_ref = 0;
33565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33568 ret_ref = (uintptr_t)ret_var.inner;
33569 if (ret_var.is_owned) {
33575 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
33576 LDKPeerManager this_obj_conv;
33577 this_obj_conv.inner = (void*)(this_obj & (~1));
33578 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33580 PeerManager_free(this_obj_conv);
33583 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) {
33584 LDKMessageHandler message_handler_conv;
33585 message_handler_conv.inner = (void*)(message_handler & (~1));
33586 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33588 // WARNING: we need a move here but no clone is available for LDKMessageHandler
33589 LDKSecretKey our_node_secret_ref;
33590 CHECK(our_node_secret->arr_len == 32);
33591 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
33592 unsigned char ephemeral_random_data_arr[32];
33593 CHECK(ephemeral_random_data->arr_len == 32);
33594 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
33595 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33596 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
33597 CHECK_ACCESS(logger_ptr);
33598 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33599 if (logger_conv.free == LDKLogger_JCalls_free) {
33600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33601 LDKLogger_JCalls_cloned(&logger_conv);
33603 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
33604 CHECK_ACCESS(custom_message_handler_ptr);
33605 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33606 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33608 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33610 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33611 uint32_t ret_ref = 0;
33612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33615 ret_ref = (uintptr_t)ret_var.inner;
33616 if (ret_var.is_owned) {
33622 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
33623 LDKPeerManager this_arg_conv;
33624 this_arg_conv.inner = (void*)(this_arg & (~1));
33625 this_arg_conv.is_owned = false;
33626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33627 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
33628 ptrArray ret_arr = NULL;
33629 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33630 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
33631 for (size_t m = 0; m < ret_var.datalen; m++) {
33632 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
33633 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
33634 ret_arr_ptr[m] = ret_conv_12_arr;
33637 FREE(ret_var.data);
33641 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) {
33642 LDKPeerManager this_arg_conv;
33643 this_arg_conv.inner = (void*)(this_arg & (~1));
33644 this_arg_conv.is_owned = false;
33645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33646 LDKPublicKey their_node_id_ref;
33647 CHECK(their_node_id->arr_len == 33);
33648 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
33649 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33650 CHECK_ACCESS(descriptor_ptr);
33651 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33652 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33654 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33656 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33657 CHECK_ACCESS(remote_network_address_ptr);
33658 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33659 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
33660 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
33661 return (uint32_t)ret_conv;
33664 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) {
33665 LDKPeerManager this_arg_conv;
33666 this_arg_conv.inner = (void*)(this_arg & (~1));
33667 this_arg_conv.is_owned = false;
33668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33669 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33670 CHECK_ACCESS(descriptor_ptr);
33671 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33672 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33673 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33674 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33676 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33677 CHECK_ACCESS(remote_network_address_ptr);
33678 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33679 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33680 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
33681 return (uint32_t)ret_conv;
33684 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
33685 LDKPeerManager this_arg_conv;
33686 this_arg_conv.inner = (void*)(this_arg & (~1));
33687 this_arg_conv.is_owned = false;
33688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33689 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33690 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33691 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33692 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33693 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
33694 return (uint32_t)ret_conv;
33697 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
33698 LDKPeerManager this_arg_conv;
33699 this_arg_conv.inner = (void*)(this_arg & (~1));
33700 this_arg_conv.is_owned = false;
33701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33702 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
33703 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
33704 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
33705 LDKu8slice data_ref;
33706 data_ref.datalen = data->arr_len;
33707 data_ref.data = data->elems /* XXX data leaks */;
33708 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
33709 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
33710 return (uint32_t)ret_conv;
33713 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
33714 LDKPeerManager this_arg_conv;
33715 this_arg_conv.inner = (void*)(this_arg & (~1));
33716 this_arg_conv.is_owned = false;
33717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33718 PeerManager_process_events(&this_arg_conv);
33721 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
33722 LDKPeerManager this_arg_conv;
33723 this_arg_conv.inner = (void*)(this_arg & (~1));
33724 this_arg_conv.is_owned = false;
33725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33726 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33727 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33728 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33729 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
33732 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) {
33733 LDKPeerManager this_arg_conv;
33734 this_arg_conv.inner = (void*)(this_arg & (~1));
33735 this_arg_conv.is_owned = false;
33736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33737 LDKPublicKey node_id_ref;
33738 CHECK(node_id->arr_len == 33);
33739 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
33740 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
33743 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
33744 LDKPeerManager this_arg_conv;
33745 this_arg_conv.inner = (void*)(this_arg & (~1));
33746 this_arg_conv.is_owned = false;
33747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33748 PeerManager_disconnect_all_peers(&this_arg_conv);
33751 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
33752 LDKPeerManager this_arg_conv;
33753 this_arg_conv.inner = (void*)(this_arg & (~1));
33754 this_arg_conv.is_owned = false;
33755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33756 PeerManager_timer_tick_occurred(&this_arg_conv);
33759 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
33760 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
33764 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
33765 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
33769 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
33770 unsigned char commitment_seed_arr[32];
33771 CHECK(commitment_seed->arr_len == 32);
33772 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
33773 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
33774 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33775 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
33779 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) {
33780 LDKCVec_u8Z to_holder_script_ref;
33781 to_holder_script_ref.datalen = to_holder_script->arr_len;
33782 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33783 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33784 LDKCVec_u8Z to_counterparty_script_ref;
33785 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33786 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33787 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33788 LDKOutPoint funding_outpoint_conv;
33789 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
33790 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
33791 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
33792 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
33793 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);
33794 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33795 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33796 Transaction_free(ret_var);
33800 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
33801 LDKCounterpartyCommitmentSecrets this_obj_conv;
33802 this_obj_conv.inner = (void*)(this_obj & (~1));
33803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33805 CounterpartyCommitmentSecrets_free(this_obj_conv);
33808 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
33809 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
33810 uint32_t ret_ref = 0;
33811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33814 ret_ref = (uintptr_t)ret_var.inner;
33815 if (ret_var.is_owned) {
33820 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
33821 LDKCounterpartyCommitmentSecrets arg_conv;
33822 arg_conv.inner = (void*)(arg & (~1));
33823 arg_conv.is_owned = false;
33824 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33825 uint32_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
33829 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
33830 LDKCounterpartyCommitmentSecrets orig_conv;
33831 orig_conv.inner = (void*)(orig & (~1));
33832 orig_conv.is_owned = false;
33833 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33834 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
33835 uint32_t ret_ref = 0;
33836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33839 ret_ref = (uintptr_t)ret_var.inner;
33840 if (ret_var.is_owned) {
33846 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
33847 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
33848 uint32_t ret_ref = 0;
33849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33852 ret_ref = (uintptr_t)ret_var.inner;
33853 if (ret_var.is_owned) {
33859 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
33860 LDKCounterpartyCommitmentSecrets this_arg_conv;
33861 this_arg_conv.inner = (void*)(this_arg & (~1));
33862 this_arg_conv.is_owned = false;
33863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33864 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
33868 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
33869 LDKCounterpartyCommitmentSecrets this_arg_conv;
33870 this_arg_conv.inner = (void*)(this_arg & (~1));
33871 this_arg_conv.is_owned = false;
33872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33873 LDKThirtyTwoBytes secret_ref;
33874 CHECK(secret->arr_len == 32);
33875 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
33876 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
33877 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
33878 return (uint32_t)ret_conv;
33881 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
33882 LDKCounterpartyCommitmentSecrets this_arg_conv;
33883 this_arg_conv.inner = (void*)(this_arg & (~1));
33884 this_arg_conv.is_owned = false;
33885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33886 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33887 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
33891 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
33892 LDKCounterpartyCommitmentSecrets obj_conv;
33893 obj_conv.inner = (void*)(obj & (~1));
33894 obj_conv.is_owned = false;
33895 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33896 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
33897 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33898 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33899 CVec_u8Z_free(ret_var);
33903 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
33904 LDKu8slice ser_ref;
33905 ser_ref.datalen = ser->arr_len;
33906 ser_ref.data = ser->elems /* XXX ser leaks */;
33907 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33908 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
33909 return (uint32_t)ret_conv;
33912 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
33913 LDKPublicKey per_commitment_point_ref;
33914 CHECK(per_commitment_point->arr_len == 33);
33915 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33916 unsigned char base_secret_arr[32];
33917 CHECK(base_secret->arr_len == 32);
33918 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
33919 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
33920 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33921 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
33922 return (uint32_t)ret_conv;
33925 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
33926 LDKPublicKey per_commitment_point_ref;
33927 CHECK(per_commitment_point->arr_len == 33);
33928 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33929 LDKPublicKey base_point_ref;
33930 CHECK(base_point->arr_len == 33);
33931 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
33932 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33933 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
33934 return (uint32_t)ret_conv;
33937 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) {
33938 unsigned char per_commitment_secret_arr[32];
33939 CHECK(per_commitment_secret->arr_len == 32);
33940 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
33941 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
33942 unsigned char countersignatory_revocation_base_secret_arr[32];
33943 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
33944 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
33945 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
33946 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33947 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
33948 return (uint32_t)ret_conv;
33951 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) {
33952 LDKPublicKey per_commitment_point_ref;
33953 CHECK(per_commitment_point->arr_len == 33);
33954 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33955 LDKPublicKey countersignatory_revocation_base_point_ref;
33956 CHECK(countersignatory_revocation_base_point->arr_len == 33);
33957 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
33958 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33959 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
33960 return (uint32_t)ret_conv;
33963 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
33964 LDKTxCreationKeys this_obj_conv;
33965 this_obj_conv.inner = (void*)(this_obj & (~1));
33966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33968 TxCreationKeys_free(this_obj_conv);
33971 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
33972 LDKTxCreationKeys this_ptr_conv;
33973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33974 this_ptr_conv.is_owned = false;
33975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33976 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33977 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33981 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
33982 LDKTxCreationKeys this_ptr_conv;
33983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33984 this_ptr_conv.is_owned = false;
33985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33986 LDKPublicKey val_ref;
33987 CHECK(val->arr_len == 33);
33988 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33989 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
33992 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
33993 LDKTxCreationKeys this_ptr_conv;
33994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33995 this_ptr_conv.is_owned = false;
33996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33997 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33998 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
34002 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
34003 LDKTxCreationKeys this_ptr_conv;
34004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34005 this_ptr_conv.is_owned = false;
34006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34007 LDKPublicKey val_ref;
34008 CHECK(val->arr_len == 33);
34009 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34010 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
34013 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
34014 LDKTxCreationKeys this_ptr_conv;
34015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34016 this_ptr_conv.is_owned = false;
34017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34018 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34019 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
34023 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
34024 LDKTxCreationKeys this_ptr_conv;
34025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34026 this_ptr_conv.is_owned = false;
34027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34028 LDKPublicKey val_ref;
34029 CHECK(val->arr_len == 33);
34030 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34031 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
34034 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
34035 LDKTxCreationKeys this_ptr_conv;
34036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34037 this_ptr_conv.is_owned = false;
34038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34039 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34040 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
34044 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
34045 LDKTxCreationKeys this_ptr_conv;
34046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34047 this_ptr_conv.is_owned = false;
34048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34049 LDKPublicKey val_ref;
34050 CHECK(val->arr_len == 33);
34051 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34052 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
34055 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
34056 LDKTxCreationKeys this_ptr_conv;
34057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34058 this_ptr_conv.is_owned = false;
34059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34060 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34061 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
34065 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) {
34066 LDKTxCreationKeys this_ptr_conv;
34067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34068 this_ptr_conv.is_owned = false;
34069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34070 LDKPublicKey val_ref;
34071 CHECK(val->arr_len == 33);
34072 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34073 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
34076 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) {
34077 LDKPublicKey per_commitment_point_arg_ref;
34078 CHECK(per_commitment_point_arg->arr_len == 33);
34079 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
34080 LDKPublicKey revocation_key_arg_ref;
34081 CHECK(revocation_key_arg->arr_len == 33);
34082 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
34083 LDKPublicKey broadcaster_htlc_key_arg_ref;
34084 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
34085 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
34086 LDKPublicKey countersignatory_htlc_key_arg_ref;
34087 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
34088 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
34089 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
34090 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
34091 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
34092 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);
34093 uint32_t ret_ref = 0;
34094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34097 ret_ref = (uintptr_t)ret_var.inner;
34098 if (ret_var.is_owned) {
34104 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
34105 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
34106 uint32_t ret_ref = 0;
34107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34110 ret_ref = (uintptr_t)ret_var.inner;
34111 if (ret_var.is_owned) {
34116 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
34117 LDKTxCreationKeys arg_conv;
34118 arg_conv.inner = (void*)(arg & (~1));
34119 arg_conv.is_owned = false;
34120 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34121 uint32_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
34125 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
34126 LDKTxCreationKeys orig_conv;
34127 orig_conv.inner = (void*)(orig & (~1));
34128 orig_conv.is_owned = false;
34129 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34130 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
34131 uint32_t ret_ref = 0;
34132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34135 ret_ref = (uintptr_t)ret_var.inner;
34136 if (ret_var.is_owned) {
34142 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
34143 LDKTxCreationKeys obj_conv;
34144 obj_conv.inner = (void*)(obj & (~1));
34145 obj_conv.is_owned = false;
34146 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34147 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
34148 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34149 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34150 CVec_u8Z_free(ret_var);
34154 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
34155 LDKu8slice ser_ref;
34156 ser_ref.datalen = ser->arr_len;
34157 ser_ref.data = ser->elems /* XXX ser leaks */;
34158 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
34159 *ret_conv = TxCreationKeys_read(ser_ref);
34160 return (uint32_t)ret_conv;
34163 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
34164 LDKChannelPublicKeys this_obj_conv;
34165 this_obj_conv.inner = (void*)(this_obj & (~1));
34166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34168 ChannelPublicKeys_free(this_obj_conv);
34171 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
34172 LDKChannelPublicKeys this_ptr_conv;
34173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34174 this_ptr_conv.is_owned = false;
34175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34176 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34177 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
34181 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
34182 LDKChannelPublicKeys this_ptr_conv;
34183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34184 this_ptr_conv.is_owned = false;
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34186 LDKPublicKey val_ref;
34187 CHECK(val->arr_len == 33);
34188 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34189 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
34192 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
34193 LDKChannelPublicKeys this_ptr_conv;
34194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34195 this_ptr_conv.is_owned = false;
34196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34197 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34198 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
34202 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
34203 LDKChannelPublicKeys this_ptr_conv;
34204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34205 this_ptr_conv.is_owned = false;
34206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34207 LDKPublicKey val_ref;
34208 CHECK(val->arr_len == 33);
34209 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34210 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
34213 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
34214 LDKChannelPublicKeys this_ptr_conv;
34215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34216 this_ptr_conv.is_owned = false;
34217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34218 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34219 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
34223 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
34224 LDKChannelPublicKeys this_ptr_conv;
34225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34226 this_ptr_conv.is_owned = false;
34227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34228 LDKPublicKey val_ref;
34229 CHECK(val->arr_len == 33);
34230 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34231 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
34234 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
34235 LDKChannelPublicKeys this_ptr_conv;
34236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34237 this_ptr_conv.is_owned = false;
34238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34239 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34240 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
34244 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
34245 LDKChannelPublicKeys this_ptr_conv;
34246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34247 this_ptr_conv.is_owned = false;
34248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34249 LDKPublicKey val_ref;
34250 CHECK(val->arr_len == 33);
34251 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34252 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
34255 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
34256 LDKChannelPublicKeys this_ptr_conv;
34257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34258 this_ptr_conv.is_owned = false;
34259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34260 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34261 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
34265 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
34266 LDKChannelPublicKeys this_ptr_conv;
34267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34268 this_ptr_conv.is_owned = false;
34269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34270 LDKPublicKey val_ref;
34271 CHECK(val->arr_len == 33);
34272 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34273 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
34276 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) {
34277 LDKPublicKey funding_pubkey_arg_ref;
34278 CHECK(funding_pubkey_arg->arr_len == 33);
34279 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
34280 LDKPublicKey revocation_basepoint_arg_ref;
34281 CHECK(revocation_basepoint_arg->arr_len == 33);
34282 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
34283 LDKPublicKey payment_point_arg_ref;
34284 CHECK(payment_point_arg->arr_len == 33);
34285 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
34286 LDKPublicKey delayed_payment_basepoint_arg_ref;
34287 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
34288 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
34289 LDKPublicKey htlc_basepoint_arg_ref;
34290 CHECK(htlc_basepoint_arg->arr_len == 33);
34291 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
34292 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);
34293 uint32_t ret_ref = 0;
34294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34297 ret_ref = (uintptr_t)ret_var.inner;
34298 if (ret_var.is_owned) {
34304 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34305 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34306 uint32_t ret_ref = 0;
34307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34310 ret_ref = (uintptr_t)ret_var.inner;
34311 if (ret_var.is_owned) {
34316 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
34317 LDKChannelPublicKeys arg_conv;
34318 arg_conv.inner = (void*)(arg & (~1));
34319 arg_conv.is_owned = false;
34320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34321 uint32_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
34325 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
34326 LDKChannelPublicKeys orig_conv;
34327 orig_conv.inner = (void*)(orig & (~1));
34328 orig_conv.is_owned = false;
34329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34330 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34331 uint32_t ret_ref = 0;
34332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34335 ret_ref = (uintptr_t)ret_var.inner;
34336 if (ret_var.is_owned) {
34342 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
34343 LDKChannelPublicKeys obj_conv;
34344 obj_conv.inner = (void*)(obj & (~1));
34345 obj_conv.is_owned = false;
34346 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34347 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34348 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34349 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34350 CVec_u8Z_free(ret_var);
34354 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
34355 LDKu8slice ser_ref;
34356 ser_ref.datalen = ser->arr_len;
34357 ser_ref.data = ser->elems /* XXX ser leaks */;
34358 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34359 *ret_conv = ChannelPublicKeys_read(ser_ref);
34360 return (uint32_t)ret_conv;
34363 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) {
34364 LDKPublicKey per_commitment_point_ref;
34365 CHECK(per_commitment_point->arr_len == 33);
34366 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34367 LDKPublicKey broadcaster_delayed_payment_base_ref;
34368 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
34369 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
34370 LDKPublicKey broadcaster_htlc_base_ref;
34371 CHECK(broadcaster_htlc_base->arr_len == 33);
34372 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
34373 LDKPublicKey countersignatory_revocation_base_ref;
34374 CHECK(countersignatory_revocation_base->arr_len == 33);
34375 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
34376 LDKPublicKey countersignatory_htlc_base_ref;
34377 CHECK(countersignatory_htlc_base->arr_len == 33);
34378 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
34379 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34380 *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);
34381 return (uint32_t)ret_conv;
34384 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) {
34385 LDKPublicKey per_commitment_point_ref;
34386 CHECK(per_commitment_point->arr_len == 33);
34387 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34388 LDKChannelPublicKeys broadcaster_keys_conv;
34389 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34390 broadcaster_keys_conv.is_owned = false;
34391 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34392 LDKChannelPublicKeys countersignatory_keys_conv;
34393 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34394 countersignatory_keys_conv.is_owned = false;
34395 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34396 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34397 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34398 return (uint32_t)ret_conv;
34401 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) {
34402 LDKPublicKey revocation_key_ref;
34403 CHECK(revocation_key->arr_len == 33);
34404 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34405 LDKPublicKey broadcaster_delayed_payment_key_ref;
34406 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34407 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34408 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34409 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34410 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34411 CVec_u8Z_free(ret_var);
34415 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
34416 LDKHTLCOutputInCommitment this_obj_conv;
34417 this_obj_conv.inner = (void*)(this_obj & (~1));
34418 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34420 HTLCOutputInCommitment_free(this_obj_conv);
34423 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
34424 LDKHTLCOutputInCommitment this_ptr_conv;
34425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34426 this_ptr_conv.is_owned = false;
34427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34428 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34432 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
34433 LDKHTLCOutputInCommitment this_ptr_conv;
34434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34435 this_ptr_conv.is_owned = false;
34436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34437 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34440 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
34441 LDKHTLCOutputInCommitment this_ptr_conv;
34442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34443 this_ptr_conv.is_owned = false;
34444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34445 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34449 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
34450 LDKHTLCOutputInCommitment this_ptr_conv;
34451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34452 this_ptr_conv.is_owned = false;
34453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34454 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34457 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
34458 LDKHTLCOutputInCommitment this_ptr_conv;
34459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34460 this_ptr_conv.is_owned = false;
34461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34462 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34466 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
34467 LDKHTLCOutputInCommitment this_ptr_conv;
34468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34469 this_ptr_conv.is_owned = false;
34470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34471 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34474 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
34475 LDKHTLCOutputInCommitment this_ptr_conv;
34476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34477 this_ptr_conv.is_owned = false;
34478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34479 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34480 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
34484 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
34485 LDKHTLCOutputInCommitment this_ptr_conv;
34486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34487 this_ptr_conv.is_owned = false;
34488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34489 LDKThirtyTwoBytes val_ref;
34490 CHECK(val->arr_len == 32);
34491 memcpy(val_ref.data, val->elems, 32); FREE(val);
34492 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34495 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
34496 LDKHTLCOutputInCommitment this_ptr_conv;
34497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34498 this_ptr_conv.is_owned = false;
34499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34500 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34501 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34502 uint32_t ret_ref = (uintptr_t)ret_copy;
34506 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
34507 LDKHTLCOutputInCommitment this_ptr_conv;
34508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34509 this_ptr_conv.is_owned = false;
34510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34511 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34512 CHECK_ACCESS(val_ptr);
34513 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34514 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
34515 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34518 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) {
34519 LDKThirtyTwoBytes payment_hash_arg_ref;
34520 CHECK(payment_hash_arg->arr_len == 32);
34521 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
34522 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
34523 CHECK_ACCESS(transaction_output_index_arg_ptr);
34524 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34525 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
34526 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34527 uint32_t ret_ref = 0;
34528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34531 ret_ref = (uintptr_t)ret_var.inner;
34532 if (ret_var.is_owned) {
34538 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34539 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34540 uint32_t ret_ref = 0;
34541 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34542 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34544 ret_ref = (uintptr_t)ret_var.inner;
34545 if (ret_var.is_owned) {
34550 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
34551 LDKHTLCOutputInCommitment arg_conv;
34552 arg_conv.inner = (void*)(arg & (~1));
34553 arg_conv.is_owned = false;
34554 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34555 uint32_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34559 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
34560 LDKHTLCOutputInCommitment orig_conv;
34561 orig_conv.inner = (void*)(orig & (~1));
34562 orig_conv.is_owned = false;
34563 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34564 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34565 uint32_t ret_ref = 0;
34566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34569 ret_ref = (uintptr_t)ret_var.inner;
34570 if (ret_var.is_owned) {
34576 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
34577 LDKHTLCOutputInCommitment obj_conv;
34578 obj_conv.inner = (void*)(obj & (~1));
34579 obj_conv.is_owned = false;
34580 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34581 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34582 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34583 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34584 CVec_u8Z_free(ret_var);
34588 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
34589 LDKu8slice ser_ref;
34590 ser_ref.datalen = ser->arr_len;
34591 ser_ref.data = ser->elems /* XXX ser leaks */;
34592 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34593 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34594 return (uint32_t)ret_conv;
34597 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
34598 LDKHTLCOutputInCommitment htlc_conv;
34599 htlc_conv.inner = (void*)(htlc & (~1));
34600 htlc_conv.is_owned = false;
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34602 LDKTxCreationKeys keys_conv;
34603 keys_conv.inner = (void*)(keys & (~1));
34604 keys_conv.is_owned = false;
34605 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34606 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34607 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34608 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34609 CVec_u8Z_free(ret_var);
34613 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
34614 LDKPublicKey broadcaster_ref;
34615 CHECK(broadcaster->arr_len == 33);
34616 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
34617 LDKPublicKey countersignatory_ref;
34618 CHECK(countersignatory->arr_len == 33);
34619 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
34620 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34621 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34622 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34623 CVec_u8Z_free(ret_var);
34627 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) {
34628 unsigned char commitment_txid_arr[32];
34629 CHECK(commitment_txid->arr_len == 32);
34630 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
34631 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34632 LDKHTLCOutputInCommitment htlc_conv;
34633 htlc_conv.inner = (void*)(htlc & (~1));
34634 htlc_conv.is_owned = false;
34635 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34636 LDKPublicKey broadcaster_delayed_payment_key_ref;
34637 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34638 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34639 LDKPublicKey revocation_key_ref;
34640 CHECK(revocation_key->arr_len == 33);
34641 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34642 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);
34643 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34644 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34645 Transaction_free(ret_var);
34649 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
34650 LDKPublicKey funding_pubkey_ref;
34651 CHECK(funding_pubkey->arr_len == 33);
34652 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
34653 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34654 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34655 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34656 CVec_u8Z_free(ret_var);
34660 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
34661 LDKChannelTransactionParameters this_obj_conv;
34662 this_obj_conv.inner = (void*)(this_obj & (~1));
34663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34665 ChannelTransactionParameters_free(this_obj_conv);
34668 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
34669 LDKChannelTransactionParameters this_ptr_conv;
34670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34671 this_ptr_conv.is_owned = false;
34672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34673 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34674 uint32_t ret_ref = 0;
34675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34678 ret_ref = (uintptr_t)ret_var.inner;
34679 if (ret_var.is_owned) {
34685 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
34686 LDKChannelTransactionParameters this_ptr_conv;
34687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34688 this_ptr_conv.is_owned = false;
34689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34690 LDKChannelPublicKeys val_conv;
34691 val_conv.inner = (void*)(val & (~1));
34692 val_conv.is_owned = (val & 1) || (val == 0);
34693 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34694 val_conv = ChannelPublicKeys_clone(&val_conv);
34695 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34698 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
34699 LDKChannelTransactionParameters this_ptr_conv;
34700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34701 this_ptr_conv.is_owned = false;
34702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34703 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34707 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) {
34708 LDKChannelTransactionParameters this_ptr_conv;
34709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34710 this_ptr_conv.is_owned = false;
34711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34712 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34715 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
34716 LDKChannelTransactionParameters this_ptr_conv;
34717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34718 this_ptr_conv.is_owned = false;
34719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34720 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34724 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
34725 LDKChannelTransactionParameters this_ptr_conv;
34726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34727 this_ptr_conv.is_owned = false;
34728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34729 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34732 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
34733 LDKChannelTransactionParameters this_ptr_conv;
34734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34735 this_ptr_conv.is_owned = false;
34736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34737 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
34738 uint32_t ret_ref = 0;
34739 if ((uintptr_t)ret_var.inner > 4096) {
34740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34743 ret_ref = (uintptr_t)ret_var.inner;
34744 if (ret_var.is_owned) {
34751 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
34752 LDKChannelTransactionParameters this_ptr_conv;
34753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34754 this_ptr_conv.is_owned = false;
34755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34756 LDKCounterpartyChannelTransactionParameters val_conv;
34757 val_conv.inner = (void*)(val & (~1));
34758 val_conv.is_owned = (val & 1) || (val == 0);
34759 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34760 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
34761 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
34764 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
34765 LDKChannelTransactionParameters this_ptr_conv;
34766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34767 this_ptr_conv.is_owned = false;
34768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34769 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
34770 uint32_t ret_ref = 0;
34771 if ((uintptr_t)ret_var.inner > 4096) {
34772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34775 ret_ref = (uintptr_t)ret_var.inner;
34776 if (ret_var.is_owned) {
34783 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
34784 LDKChannelTransactionParameters this_ptr_conv;
34785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34786 this_ptr_conv.is_owned = false;
34787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34788 LDKOutPoint val_conv;
34789 val_conv.inner = (void*)(val & (~1));
34790 val_conv.is_owned = (val & 1) || (val == 0);
34791 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34792 val_conv = OutPoint_clone(&val_conv);
34793 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
34796 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
34797 LDKChannelTransactionParameters this_ptr_conv;
34798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34799 this_ptr_conv.is_owned = false;
34800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34801 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
34805 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
34806 LDKChannelTransactionParameters this_ptr_conv;
34807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34808 this_ptr_conv.is_owned = false;
34809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34810 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
34811 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
34814 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) {
34815 LDKChannelPublicKeys holder_pubkeys_arg_conv;
34816 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
34817 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
34818 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
34819 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
34820 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
34821 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
34822 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
34823 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
34824 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
34825 LDKOutPoint funding_outpoint_arg_conv;
34826 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
34827 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
34828 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
34829 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
34830 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
34831 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);
34832 uint32_t ret_ref = 0;
34833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34836 ret_ref = (uintptr_t)ret_var.inner;
34837 if (ret_var.is_owned) {
34843 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
34844 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
34845 uint32_t ret_ref = 0;
34846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34849 ret_ref = (uintptr_t)ret_var.inner;
34850 if (ret_var.is_owned) {
34855 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
34856 LDKChannelTransactionParameters arg_conv;
34857 arg_conv.inner = (void*)(arg & (~1));
34858 arg_conv.is_owned = false;
34859 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34860 uint32_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
34864 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
34865 LDKChannelTransactionParameters orig_conv;
34866 orig_conv.inner = (void*)(orig & (~1));
34867 orig_conv.is_owned = false;
34868 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34869 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
34870 uint32_t ret_ref = 0;
34871 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34872 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34873 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34874 ret_ref = (uintptr_t)ret_var.inner;
34875 if (ret_var.is_owned) {
34881 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
34882 LDKCounterpartyChannelTransactionParameters this_obj_conv;
34883 this_obj_conv.inner = (void*)(this_obj & (~1));
34884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34886 CounterpartyChannelTransactionParameters_free(this_obj_conv);
34889 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
34890 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34892 this_ptr_conv.is_owned = false;
34893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34894 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
34895 uint32_t ret_ref = 0;
34896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34899 ret_ref = (uintptr_t)ret_var.inner;
34900 if (ret_var.is_owned) {
34906 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
34907 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34909 this_ptr_conv.is_owned = false;
34910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34911 LDKChannelPublicKeys val_conv;
34912 val_conv.inner = (void*)(val & (~1));
34913 val_conv.is_owned = (val & 1) || (val == 0);
34914 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34915 val_conv = ChannelPublicKeys_clone(&val_conv);
34916 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
34919 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
34920 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34922 this_ptr_conv.is_owned = false;
34923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34924 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
34928 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
34929 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34931 this_ptr_conv.is_owned = false;
34932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34933 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
34936 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
34937 LDKChannelPublicKeys pubkeys_arg_conv;
34938 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
34939 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
34940 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
34941 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
34942 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
34943 uint32_t ret_ref = 0;
34944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34947 ret_ref = (uintptr_t)ret_var.inner;
34948 if (ret_var.is_owned) {
34954 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
34955 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
34956 uint32_t ret_ref = 0;
34957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34960 ret_ref = (uintptr_t)ret_var.inner;
34961 if (ret_var.is_owned) {
34966 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
34967 LDKCounterpartyChannelTransactionParameters arg_conv;
34968 arg_conv.inner = (void*)(arg & (~1));
34969 arg_conv.is_owned = false;
34970 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34971 uint32_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
34975 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
34976 LDKCounterpartyChannelTransactionParameters orig_conv;
34977 orig_conv.inner = (void*)(orig & (~1));
34978 orig_conv.is_owned = false;
34979 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34980 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
34981 uint32_t ret_ref = 0;
34982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34985 ret_ref = (uintptr_t)ret_var.inner;
34986 if (ret_var.is_owned) {
34992 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
34993 LDKChannelTransactionParameters this_arg_conv;
34994 this_arg_conv.inner = (void*)(this_arg & (~1));
34995 this_arg_conv.is_owned = false;
34996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34997 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
35001 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
35002 LDKChannelTransactionParameters this_arg_conv;
35003 this_arg_conv.inner = (void*)(this_arg & (~1));
35004 this_arg_conv.is_owned = false;
35005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35006 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
35007 uint32_t ret_ref = 0;
35008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35011 ret_ref = (uintptr_t)ret_var.inner;
35012 if (ret_var.is_owned) {
35018 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
35019 LDKChannelTransactionParameters this_arg_conv;
35020 this_arg_conv.inner = (void*)(this_arg & (~1));
35021 this_arg_conv.is_owned = false;
35022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35023 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
35024 uint32_t ret_ref = 0;
35025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35028 ret_ref = (uintptr_t)ret_var.inner;
35029 if (ret_var.is_owned) {
35035 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
35036 LDKCounterpartyChannelTransactionParameters obj_conv;
35037 obj_conv.inner = (void*)(obj & (~1));
35038 obj_conv.is_owned = false;
35039 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35040 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
35041 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35042 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35043 CVec_u8Z_free(ret_var);
35047 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
35048 LDKu8slice ser_ref;
35049 ser_ref.datalen = ser->arr_len;
35050 ser_ref.data = ser->elems /* XXX ser leaks */;
35051 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
35052 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
35053 return (uint32_t)ret_conv;
35056 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
35057 LDKChannelTransactionParameters obj_conv;
35058 obj_conv.inner = (void*)(obj & (~1));
35059 obj_conv.is_owned = false;
35060 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35061 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
35062 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35063 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35064 CVec_u8Z_free(ret_var);
35068 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
35069 LDKu8slice ser_ref;
35070 ser_ref.datalen = ser->arr_len;
35071 ser_ref.data = ser->elems /* XXX ser leaks */;
35072 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
35073 *ret_conv = ChannelTransactionParameters_read(ser_ref);
35074 return (uint32_t)ret_conv;
35077 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
35078 LDKDirectedChannelTransactionParameters this_obj_conv;
35079 this_obj_conv.inner = (void*)(this_obj & (~1));
35080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35082 DirectedChannelTransactionParameters_free(this_obj_conv);
35085 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
35086 LDKDirectedChannelTransactionParameters this_arg_conv;
35087 this_arg_conv.inner = (void*)(this_arg & (~1));
35088 this_arg_conv.is_owned = false;
35089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35090 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
35091 uint32_t ret_ref = 0;
35092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35095 ret_ref = (uintptr_t)ret_var.inner;
35096 if (ret_var.is_owned) {
35102 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
35103 LDKDirectedChannelTransactionParameters this_arg_conv;
35104 this_arg_conv.inner = (void*)(this_arg & (~1));
35105 this_arg_conv.is_owned = false;
35106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35107 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
35108 uint32_t ret_ref = 0;
35109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35112 ret_ref = (uintptr_t)ret_var.inner;
35113 if (ret_var.is_owned) {
35119 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
35120 LDKDirectedChannelTransactionParameters this_arg_conv;
35121 this_arg_conv.inner = (void*)(this_arg & (~1));
35122 this_arg_conv.is_owned = false;
35123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35124 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
35128 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
35129 LDKDirectedChannelTransactionParameters this_arg_conv;
35130 this_arg_conv.inner = (void*)(this_arg & (~1));
35131 this_arg_conv.is_owned = false;
35132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35133 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
35137 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
35138 LDKDirectedChannelTransactionParameters this_arg_conv;
35139 this_arg_conv.inner = (void*)(this_arg & (~1));
35140 this_arg_conv.is_owned = false;
35141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35142 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
35143 uint32_t ret_ref = 0;
35144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35147 ret_ref = (uintptr_t)ret_var.inner;
35148 if (ret_var.is_owned) {
35154 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
35155 LDKDirectedChannelTransactionParameters this_arg_conv;
35156 this_arg_conv.inner = (void*)(this_arg & (~1));
35157 this_arg_conv.is_owned = false;
35158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35159 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
35163 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
35164 LDKHolderCommitmentTransaction this_obj_conv;
35165 this_obj_conv.inner = (void*)(this_obj & (~1));
35166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35168 HolderCommitmentTransaction_free(this_obj_conv);
35171 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
35172 LDKHolderCommitmentTransaction this_ptr_conv;
35173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35174 this_ptr_conv.is_owned = false;
35175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35176 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35177 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
35181 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
35182 LDKHolderCommitmentTransaction this_ptr_conv;
35183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35184 this_ptr_conv.is_owned = false;
35185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35186 LDKSignature val_ref;
35187 CHECK(val->arr_len == 64);
35188 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35189 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
35192 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
35193 LDKHolderCommitmentTransaction this_ptr_conv;
35194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35195 this_ptr_conv.is_owned = false;
35196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35197 LDKCVec_SignatureZ val_constr;
35198 val_constr.datalen = val->arr_len;
35199 if (val_constr.datalen > 0)
35200 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35202 val_constr.data = NULL;
35203 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
35204 for (size_t m = 0; m < val_constr.datalen; m++) {
35205 int8_tArray val_conv_12 = val_vals[m];
35206 LDKSignature val_conv_12_ref;
35207 CHECK(val_conv_12->arr_len == 64);
35208 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
35209 val_constr.data[m] = val_conv_12_ref;
35211 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
35214 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
35215 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
35216 uint32_t ret_ref = 0;
35217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35220 ret_ref = (uintptr_t)ret_var.inner;
35221 if (ret_var.is_owned) {
35226 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
35227 LDKHolderCommitmentTransaction arg_conv;
35228 arg_conv.inner = (void*)(arg & (~1));
35229 arg_conv.is_owned = false;
35230 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35231 uint32_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
35235 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
35236 LDKHolderCommitmentTransaction orig_conv;
35237 orig_conv.inner = (void*)(orig & (~1));
35238 orig_conv.is_owned = false;
35239 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35240 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
35241 uint32_t ret_ref = 0;
35242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35245 ret_ref = (uintptr_t)ret_var.inner;
35246 if (ret_var.is_owned) {
35252 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
35253 LDKHolderCommitmentTransaction obj_conv;
35254 obj_conv.inner = (void*)(obj & (~1));
35255 obj_conv.is_owned = false;
35256 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35257 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
35258 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35259 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35260 CVec_u8Z_free(ret_var);
35264 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
35265 LDKu8slice ser_ref;
35266 ser_ref.datalen = ser->arr_len;
35267 ser_ref.data = ser->elems /* XXX ser leaks */;
35268 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
35269 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
35270 return (uint32_t)ret_conv;
35273 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) {
35274 LDKCommitmentTransaction commitment_tx_conv;
35275 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
35276 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
35277 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
35278 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
35279 LDKSignature counterparty_sig_ref;
35280 CHECK(counterparty_sig->arr_len == 64);
35281 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
35282 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
35283 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
35284 if (counterparty_htlc_sigs_constr.datalen > 0)
35285 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35287 counterparty_htlc_sigs_constr.data = NULL;
35288 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems /* XXX counterparty_htlc_sigs leaks */;
35289 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
35290 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
35291 LDKSignature counterparty_htlc_sigs_conv_12_ref;
35292 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
35293 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
35294 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
35296 LDKPublicKey holder_funding_key_ref;
35297 CHECK(holder_funding_key->arr_len == 33);
35298 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
35299 LDKPublicKey counterparty_funding_key_ref;
35300 CHECK(counterparty_funding_key->arr_len == 33);
35301 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
35302 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
35303 uint32_t ret_ref = 0;
35304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35307 ret_ref = (uintptr_t)ret_var.inner;
35308 if (ret_var.is_owned) {
35314 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
35315 LDKBuiltCommitmentTransaction this_obj_conv;
35316 this_obj_conv.inner = (void*)(this_obj & (~1));
35317 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35319 BuiltCommitmentTransaction_free(this_obj_conv);
35322 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
35323 LDKBuiltCommitmentTransaction this_ptr_conv;
35324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35325 this_ptr_conv.is_owned = false;
35326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35327 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35328 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35329 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35330 Transaction_free(ret_var);
35334 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
35335 LDKBuiltCommitmentTransaction this_ptr_conv;
35336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35337 this_ptr_conv.is_owned = false;
35338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35339 LDKTransaction val_ref;
35340 val_ref.datalen = val->arr_len;
35341 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35342 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35343 val_ref.data_is_owned = true;
35344 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35347 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
35348 LDKBuiltCommitmentTransaction this_ptr_conv;
35349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35350 this_ptr_conv.is_owned = false;
35351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35352 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35353 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
35357 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
35358 LDKBuiltCommitmentTransaction this_ptr_conv;
35359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35360 this_ptr_conv.is_owned = false;
35361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35362 LDKThirtyTwoBytes val_ref;
35363 CHECK(val->arr_len == 32);
35364 memcpy(val_ref.data, val->elems, 32); FREE(val);
35365 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35368 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
35369 LDKTransaction transaction_arg_ref;
35370 transaction_arg_ref.datalen = transaction_arg->arr_len;
35371 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35372 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
35373 transaction_arg_ref.data_is_owned = true;
35374 LDKThirtyTwoBytes txid_arg_ref;
35375 CHECK(txid_arg->arr_len == 32);
35376 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35377 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35378 uint32_t ret_ref = 0;
35379 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35380 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35382 ret_ref = (uintptr_t)ret_var.inner;
35383 if (ret_var.is_owned) {
35389 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35390 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35391 uint32_t ret_ref = 0;
35392 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35393 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35395 ret_ref = (uintptr_t)ret_var.inner;
35396 if (ret_var.is_owned) {
35401 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
35402 LDKBuiltCommitmentTransaction arg_conv;
35403 arg_conv.inner = (void*)(arg & (~1));
35404 arg_conv.is_owned = false;
35405 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35406 uint32_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35410 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
35411 LDKBuiltCommitmentTransaction orig_conv;
35412 orig_conv.inner = (void*)(orig & (~1));
35413 orig_conv.is_owned = false;
35414 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35415 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35416 uint32_t ret_ref = 0;
35417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35420 ret_ref = (uintptr_t)ret_var.inner;
35421 if (ret_var.is_owned) {
35427 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
35428 LDKBuiltCommitmentTransaction obj_conv;
35429 obj_conv.inner = (void*)(obj & (~1));
35430 obj_conv.is_owned = false;
35431 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35432 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35433 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35434 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35435 CVec_u8Z_free(ret_var);
35439 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
35440 LDKu8slice ser_ref;
35441 ser_ref.datalen = ser->arr_len;
35442 ser_ref.data = ser->elems /* XXX ser leaks */;
35443 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35444 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35445 return (uint32_t)ret_conv;
35448 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) {
35449 LDKBuiltCommitmentTransaction this_arg_conv;
35450 this_arg_conv.inner = (void*)(this_arg & (~1));
35451 this_arg_conv.is_owned = false;
35452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35453 LDKu8slice funding_redeemscript_ref;
35454 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35455 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
35456 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35457 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35461 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) {
35462 LDKBuiltCommitmentTransaction this_arg_conv;
35463 this_arg_conv.inner = (void*)(this_arg & (~1));
35464 this_arg_conv.is_owned = false;
35465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35466 unsigned char funding_key_arr[32];
35467 CHECK(funding_key->arr_len == 32);
35468 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35469 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35470 LDKu8slice funding_redeemscript_ref;
35471 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35472 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
35473 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35474 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35478 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
35479 LDKClosingTransaction this_obj_conv;
35480 this_obj_conv.inner = (void*)(this_obj & (~1));
35481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35483 ClosingTransaction_free(this_obj_conv);
35486 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35487 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35488 uint32_t ret_ref = 0;
35489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35492 ret_ref = (uintptr_t)ret_var.inner;
35493 if (ret_var.is_owned) {
35498 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
35499 LDKClosingTransaction arg_conv;
35500 arg_conv.inner = (void*)(arg & (~1));
35501 arg_conv.is_owned = false;
35502 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35503 uint32_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
35507 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
35508 LDKClosingTransaction orig_conv;
35509 orig_conv.inner = (void*)(orig & (~1));
35510 orig_conv.is_owned = false;
35511 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35512 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35513 uint32_t ret_ref = 0;
35514 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35515 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35517 ret_ref = (uintptr_t)ret_var.inner;
35518 if (ret_var.is_owned) {
35524 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
35525 LDKClosingTransaction o_conv;
35526 o_conv.inner = (void*)(o & (~1));
35527 o_conv.is_owned = false;
35528 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35529 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
35533 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) {
35534 LDKCVec_u8Z to_holder_script_ref;
35535 to_holder_script_ref.datalen = to_holder_script->arr_len;
35536 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35537 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35538 LDKCVec_u8Z to_counterparty_script_ref;
35539 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35540 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35541 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35542 LDKOutPoint funding_outpoint_conv;
35543 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35544 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35545 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35546 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35547 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35548 uint32_t ret_ref = 0;
35549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35552 ret_ref = (uintptr_t)ret_var.inner;
35553 if (ret_var.is_owned) {
35559 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
35560 LDKClosingTransaction this_arg_conv;
35561 this_arg_conv.inner = (void*)(this_arg & (~1));
35562 this_arg_conv.is_owned = false;
35563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35564 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35565 uint32_t ret_ref = 0;
35566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35569 ret_ref = (uintptr_t)ret_var.inner;
35570 if (ret_var.is_owned) {
35576 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
35577 LDKClosingTransaction this_arg_conv;
35578 this_arg_conv.inner = (void*)(this_arg & (~1));
35579 this_arg_conv.is_owned = false;
35580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35581 LDKOutPoint funding_outpoint_conv;
35582 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35583 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35584 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35585 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35586 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35587 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35588 return (uint32_t)ret_conv;
35591 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
35592 LDKClosingTransaction this_arg_conv;
35593 this_arg_conv.inner = (void*)(this_arg & (~1));
35594 this_arg_conv.is_owned = false;
35595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35596 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35600 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
35601 LDKClosingTransaction this_arg_conv;
35602 this_arg_conv.inner = (void*)(this_arg & (~1));
35603 this_arg_conv.is_owned = false;
35604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35605 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35609 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
35610 LDKClosingTransaction this_arg_conv;
35611 this_arg_conv.inner = (void*)(this_arg & (~1));
35612 this_arg_conv.is_owned = false;
35613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35614 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35615 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35616 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35620 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
35621 LDKClosingTransaction this_arg_conv;
35622 this_arg_conv.inner = (void*)(this_arg & (~1));
35623 this_arg_conv.is_owned = false;
35624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35625 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35626 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35627 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35631 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
35632 LDKTrustedClosingTransaction this_obj_conv;
35633 this_obj_conv.inner = (void*)(this_obj & (~1));
35634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35636 TrustedClosingTransaction_free(this_obj_conv);
35639 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
35640 LDKTrustedClosingTransaction this_arg_conv;
35641 this_arg_conv.inner = (void*)(this_arg & (~1));
35642 this_arg_conv.is_owned = false;
35643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35644 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35645 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35646 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35647 Transaction_free(ret_var);
35651 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) {
35652 LDKTrustedClosingTransaction this_arg_conv;
35653 this_arg_conv.inner = (void*)(this_arg & (~1));
35654 this_arg_conv.is_owned = false;
35655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35656 LDKu8slice funding_redeemscript_ref;
35657 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35658 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
35659 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35660 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35664 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) {
35665 LDKTrustedClosingTransaction this_arg_conv;
35666 this_arg_conv.inner = (void*)(this_arg & (~1));
35667 this_arg_conv.is_owned = false;
35668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35669 unsigned char funding_key_arr[32];
35670 CHECK(funding_key->arr_len == 32);
35671 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35672 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35673 LDKu8slice funding_redeemscript_ref;
35674 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35675 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
35676 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35677 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35681 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
35682 LDKCommitmentTransaction this_obj_conv;
35683 this_obj_conv.inner = (void*)(this_obj & (~1));
35684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35686 CommitmentTransaction_free(this_obj_conv);
35689 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35690 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35691 uint32_t ret_ref = 0;
35692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35695 ret_ref = (uintptr_t)ret_var.inner;
35696 if (ret_var.is_owned) {
35701 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
35702 LDKCommitmentTransaction arg_conv;
35703 arg_conv.inner = (void*)(arg & (~1));
35704 arg_conv.is_owned = false;
35705 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35706 uint32_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
35710 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
35711 LDKCommitmentTransaction orig_conv;
35712 orig_conv.inner = (void*)(orig & (~1));
35713 orig_conv.is_owned = false;
35714 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35715 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35716 uint32_t ret_ref = 0;
35717 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35718 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35720 ret_ref = (uintptr_t)ret_var.inner;
35721 if (ret_var.is_owned) {
35727 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
35728 LDKCommitmentTransaction obj_conv;
35729 obj_conv.inner = (void*)(obj & (~1));
35730 obj_conv.is_owned = false;
35731 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35732 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
35733 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35734 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35735 CVec_u8Z_free(ret_var);
35739 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
35740 LDKu8slice ser_ref;
35741 ser_ref.datalen = ser->arr_len;
35742 ser_ref.data = ser->elems /* XXX ser leaks */;
35743 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
35744 *ret_conv = CommitmentTransaction_read(ser_ref);
35745 return (uint32_t)ret_conv;
35748 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
35749 LDKCommitmentTransaction this_arg_conv;
35750 this_arg_conv.inner = (void*)(this_arg & (~1));
35751 this_arg_conv.is_owned = false;
35752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35753 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
35757 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
35758 LDKCommitmentTransaction this_arg_conv;
35759 this_arg_conv.inner = (void*)(this_arg & (~1));
35760 this_arg_conv.is_owned = false;
35761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35762 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
35766 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
35767 LDKCommitmentTransaction this_arg_conv;
35768 this_arg_conv.inner = (void*)(this_arg & (~1));
35769 this_arg_conv.is_owned = false;
35770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35771 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
35775 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
35776 LDKCommitmentTransaction this_arg_conv;
35777 this_arg_conv.inner = (void*)(this_arg & (~1));
35778 this_arg_conv.is_owned = false;
35779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35780 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
35784 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
35785 LDKCommitmentTransaction this_arg_conv;
35786 this_arg_conv.inner = (void*)(this_arg & (~1));
35787 this_arg_conv.is_owned = false;
35788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35789 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
35790 uint32_t ret_ref = 0;
35791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35794 ret_ref = (uintptr_t)ret_var.inner;
35795 if (ret_var.is_owned) {
35801 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) {
35802 LDKCommitmentTransaction this_arg_conv;
35803 this_arg_conv.inner = (void*)(this_arg & (~1));
35804 this_arg_conv.is_owned = false;
35805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35806 LDKDirectedChannelTransactionParameters channel_parameters_conv;
35807 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
35808 channel_parameters_conv.is_owned = false;
35809 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35810 LDKChannelPublicKeys broadcaster_keys_conv;
35811 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
35812 broadcaster_keys_conv.is_owned = false;
35813 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35814 LDKChannelPublicKeys countersignatory_keys_conv;
35815 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
35816 countersignatory_keys_conv.is_owned = false;
35817 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35818 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
35819 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
35820 return (uint32_t)ret_conv;
35823 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
35824 LDKTrustedCommitmentTransaction this_obj_conv;
35825 this_obj_conv.inner = (void*)(this_obj & (~1));
35826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35828 TrustedCommitmentTransaction_free(this_obj_conv);
35831 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
35832 LDKTrustedCommitmentTransaction this_arg_conv;
35833 this_arg_conv.inner = (void*)(this_arg & (~1));
35834 this_arg_conv.is_owned = false;
35835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35836 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35837 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
35841 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
35842 LDKTrustedCommitmentTransaction this_arg_conv;
35843 this_arg_conv.inner = (void*)(this_arg & (~1));
35844 this_arg_conv.is_owned = false;
35845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35846 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
35847 uint32_t ret_ref = 0;
35848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35851 ret_ref = (uintptr_t)ret_var.inner;
35852 if (ret_var.is_owned) {
35858 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
35859 LDKTrustedCommitmentTransaction this_arg_conv;
35860 this_arg_conv.inner = (void*)(this_arg & (~1));
35861 this_arg_conv.is_owned = false;
35862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35863 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
35864 uint32_t ret_ref = 0;
35865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35868 ret_ref = (uintptr_t)ret_var.inner;
35869 if (ret_var.is_owned) {
35875 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
35876 LDKTrustedCommitmentTransaction this_arg_conv;
35877 this_arg_conv.inner = (void*)(this_arg & (~1));
35878 this_arg_conv.is_owned = false;
35879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35880 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
35884 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) {
35885 LDKTrustedCommitmentTransaction this_arg_conv;
35886 this_arg_conv.inner = (void*)(this_arg & (~1));
35887 this_arg_conv.is_owned = false;
35888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35889 unsigned char htlc_base_key_arr[32];
35890 CHECK(htlc_base_key->arr_len == 32);
35891 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
35892 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
35893 LDKDirectedChannelTransactionParameters channel_parameters_conv;
35894 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
35895 channel_parameters_conv.is_owned = false;
35896 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35897 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
35898 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
35899 return (uint32_t)ret_conv;
35902 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) {
35903 LDKPublicKey broadcaster_payment_basepoint_ref;
35904 CHECK(broadcaster_payment_basepoint->arr_len == 33);
35905 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
35906 LDKPublicKey countersignatory_payment_basepoint_ref;
35907 CHECK(countersignatory_payment_basepoint->arr_len == 33);
35908 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
35909 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
35913 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
35914 LDKInitFeatures a_conv;
35915 a_conv.inner = (void*)(a & (~1));
35916 a_conv.is_owned = false;
35917 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35918 LDKInitFeatures b_conv;
35919 b_conv.inner = (void*)(b & (~1));
35920 b_conv.is_owned = false;
35921 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35922 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
35926 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
35927 LDKNodeFeatures a_conv;
35928 a_conv.inner = (void*)(a & (~1));
35929 a_conv.is_owned = false;
35930 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35931 LDKNodeFeatures b_conv;
35932 b_conv.inner = (void*)(b & (~1));
35933 b_conv.is_owned = false;
35934 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35935 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
35939 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
35940 LDKChannelFeatures a_conv;
35941 a_conv.inner = (void*)(a & (~1));
35942 a_conv.is_owned = false;
35943 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35944 LDKChannelFeatures b_conv;
35945 b_conv.inner = (void*)(b & (~1));
35946 b_conv.is_owned = false;
35947 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35948 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
35952 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
35953 LDKInvoiceFeatures a_conv;
35954 a_conv.inner = (void*)(a & (~1));
35955 a_conv.is_owned = false;
35956 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35957 LDKInvoiceFeatures b_conv;
35958 b_conv.inner = (void*)(b & (~1));
35959 b_conv.is_owned = false;
35960 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35961 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
35965 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
35966 LDKChannelTypeFeatures a_conv;
35967 a_conv.inner = (void*)(a & (~1));
35968 a_conv.is_owned = false;
35969 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35970 LDKChannelTypeFeatures b_conv;
35971 b_conv.inner = (void*)(b & (~1));
35972 b_conv.is_owned = false;
35973 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35974 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
35978 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
35979 LDKInitFeatures ret_var = InitFeatures_clone(arg);
35980 uint32_t ret_ref = 0;
35981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35984 ret_ref = (uintptr_t)ret_var.inner;
35985 if (ret_var.is_owned) {
35990 uint32_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
35991 LDKInitFeatures arg_conv;
35992 arg_conv.inner = (void*)(arg & (~1));
35993 arg_conv.is_owned = false;
35994 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35995 uint32_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
35999 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
36000 LDKInitFeatures orig_conv;
36001 orig_conv.inner = (void*)(orig & (~1));
36002 orig_conv.is_owned = false;
36003 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36004 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
36005 uint32_t ret_ref = 0;
36006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36009 ret_ref = (uintptr_t)ret_var.inner;
36010 if (ret_var.is_owned) {
36016 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
36017 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
36018 uint32_t ret_ref = 0;
36019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36022 ret_ref = (uintptr_t)ret_var.inner;
36023 if (ret_var.is_owned) {
36028 uint32_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
36029 LDKNodeFeatures arg_conv;
36030 arg_conv.inner = (void*)(arg & (~1));
36031 arg_conv.is_owned = false;
36032 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36033 uint32_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
36037 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
36038 LDKNodeFeatures orig_conv;
36039 orig_conv.inner = (void*)(orig & (~1));
36040 orig_conv.is_owned = false;
36041 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36042 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
36043 uint32_t ret_ref = 0;
36044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36047 ret_ref = (uintptr_t)ret_var.inner;
36048 if (ret_var.is_owned) {
36054 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
36055 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
36056 uint32_t ret_ref = 0;
36057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36060 ret_ref = (uintptr_t)ret_var.inner;
36061 if (ret_var.is_owned) {
36066 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
36067 LDKChannelFeatures arg_conv;
36068 arg_conv.inner = (void*)(arg & (~1));
36069 arg_conv.is_owned = false;
36070 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36071 uint32_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
36075 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
36076 LDKChannelFeatures orig_conv;
36077 orig_conv.inner = (void*)(orig & (~1));
36078 orig_conv.is_owned = false;
36079 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36080 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
36081 uint32_t ret_ref = 0;
36082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36085 ret_ref = (uintptr_t)ret_var.inner;
36086 if (ret_var.is_owned) {
36092 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
36093 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
36094 uint32_t ret_ref = 0;
36095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36098 ret_ref = (uintptr_t)ret_var.inner;
36099 if (ret_var.is_owned) {
36104 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
36105 LDKInvoiceFeatures arg_conv;
36106 arg_conv.inner = (void*)(arg & (~1));
36107 arg_conv.is_owned = false;
36108 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36109 uint32_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
36113 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
36114 LDKInvoiceFeatures orig_conv;
36115 orig_conv.inner = (void*)(orig & (~1));
36116 orig_conv.is_owned = false;
36117 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36118 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
36119 uint32_t ret_ref = 0;
36120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36123 ret_ref = (uintptr_t)ret_var.inner;
36124 if (ret_var.is_owned) {
36130 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
36131 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
36132 uint32_t ret_ref = 0;
36133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36136 ret_ref = (uintptr_t)ret_var.inner;
36137 if (ret_var.is_owned) {
36142 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
36143 LDKChannelTypeFeatures arg_conv;
36144 arg_conv.inner = (void*)(arg & (~1));
36145 arg_conv.is_owned = false;
36146 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36147 uint32_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
36151 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
36152 LDKChannelTypeFeatures orig_conv;
36153 orig_conv.inner = (void*)(orig & (~1));
36154 orig_conv.is_owned = false;
36155 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36156 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
36157 uint32_t ret_ref = 0;
36158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36161 ret_ref = (uintptr_t)ret_var.inner;
36162 if (ret_var.is_owned) {
36168 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
36169 LDKInitFeatures this_obj_conv;
36170 this_obj_conv.inner = (void*)(this_obj & (~1));
36171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36173 InitFeatures_free(this_obj_conv);
36176 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
36177 LDKNodeFeatures this_obj_conv;
36178 this_obj_conv.inner = (void*)(this_obj & (~1));
36179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36181 NodeFeatures_free(this_obj_conv);
36184 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
36185 LDKChannelFeatures this_obj_conv;
36186 this_obj_conv.inner = (void*)(this_obj & (~1));
36187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36189 ChannelFeatures_free(this_obj_conv);
36192 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
36193 LDKInvoiceFeatures this_obj_conv;
36194 this_obj_conv.inner = (void*)(this_obj & (~1));
36195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36197 InvoiceFeatures_free(this_obj_conv);
36200 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
36201 LDKChannelTypeFeatures this_obj_conv;
36202 this_obj_conv.inner = (void*)(this_obj & (~1));
36203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36205 ChannelTypeFeatures_free(this_obj_conv);
36208 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
36209 LDKInitFeatures ret_var = InitFeatures_empty();
36210 uint32_t ret_ref = 0;
36211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36214 ret_ref = (uintptr_t)ret_var.inner;
36215 if (ret_var.is_owned) {
36221 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
36222 LDKInitFeatures ret_var = InitFeatures_known();
36223 uint32_t ret_ref = 0;
36224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36227 ret_ref = (uintptr_t)ret_var.inner;
36228 if (ret_var.is_owned) {
36234 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
36235 LDKInitFeatures this_arg_conv;
36236 this_arg_conv.inner = (void*)(this_arg & (~1));
36237 this_arg_conv.is_owned = false;
36238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36239 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
36243 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
36244 LDKNodeFeatures ret_var = NodeFeatures_empty();
36245 uint32_t ret_ref = 0;
36246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36249 ret_ref = (uintptr_t)ret_var.inner;
36250 if (ret_var.is_owned) {
36256 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
36257 LDKNodeFeatures ret_var = NodeFeatures_known();
36258 uint32_t ret_ref = 0;
36259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36262 ret_ref = (uintptr_t)ret_var.inner;
36263 if (ret_var.is_owned) {
36269 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
36270 LDKNodeFeatures this_arg_conv;
36271 this_arg_conv.inner = (void*)(this_arg & (~1));
36272 this_arg_conv.is_owned = false;
36273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36274 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
36278 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
36279 LDKChannelFeatures ret_var = ChannelFeatures_empty();
36280 uint32_t ret_ref = 0;
36281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36284 ret_ref = (uintptr_t)ret_var.inner;
36285 if (ret_var.is_owned) {
36291 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
36292 LDKChannelFeatures ret_var = ChannelFeatures_known();
36293 uint32_t ret_ref = 0;
36294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36297 ret_ref = (uintptr_t)ret_var.inner;
36298 if (ret_var.is_owned) {
36304 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
36305 LDKChannelFeatures this_arg_conv;
36306 this_arg_conv.inner = (void*)(this_arg & (~1));
36307 this_arg_conv.is_owned = false;
36308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36309 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
36313 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
36314 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
36315 uint32_t ret_ref = 0;
36316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36319 ret_ref = (uintptr_t)ret_var.inner;
36320 if (ret_var.is_owned) {
36326 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
36327 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
36328 uint32_t ret_ref = 0;
36329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36332 ret_ref = (uintptr_t)ret_var.inner;
36333 if (ret_var.is_owned) {
36339 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
36340 LDKInvoiceFeatures this_arg_conv;
36341 this_arg_conv.inner = (void*)(this_arg & (~1));
36342 this_arg_conv.is_owned = false;
36343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36344 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
36348 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
36349 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
36350 uint32_t ret_ref = 0;
36351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36354 ret_ref = (uintptr_t)ret_var.inner;
36355 if (ret_var.is_owned) {
36361 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
36362 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
36363 uint32_t ret_ref = 0;
36364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36367 ret_ref = (uintptr_t)ret_var.inner;
36368 if (ret_var.is_owned) {
36374 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
36375 LDKChannelTypeFeatures this_arg_conv;
36376 this_arg_conv.inner = (void*)(this_arg & (~1));
36377 this_arg_conv.is_owned = false;
36378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36379 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
36383 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
36384 LDKInitFeatures obj_conv;
36385 obj_conv.inner = (void*)(obj & (~1));
36386 obj_conv.is_owned = false;
36387 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36388 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
36389 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36390 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36391 CVec_u8Z_free(ret_var);
36395 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
36396 LDKu8slice ser_ref;
36397 ser_ref.datalen = ser->arr_len;
36398 ser_ref.data = ser->elems /* XXX ser leaks */;
36399 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
36400 *ret_conv = InitFeatures_read(ser_ref);
36401 return (uint32_t)ret_conv;
36404 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
36405 LDKChannelFeatures obj_conv;
36406 obj_conv.inner = (void*)(obj & (~1));
36407 obj_conv.is_owned = false;
36408 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36409 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
36410 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36411 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36412 CVec_u8Z_free(ret_var);
36416 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
36417 LDKu8slice ser_ref;
36418 ser_ref.datalen = ser->arr_len;
36419 ser_ref.data = ser->elems /* XXX ser leaks */;
36420 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36421 *ret_conv = ChannelFeatures_read(ser_ref);
36422 return (uint32_t)ret_conv;
36425 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
36426 LDKNodeFeatures obj_conv;
36427 obj_conv.inner = (void*)(obj & (~1));
36428 obj_conv.is_owned = false;
36429 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36430 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36431 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36432 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36433 CVec_u8Z_free(ret_var);
36437 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
36438 LDKu8slice ser_ref;
36439 ser_ref.datalen = ser->arr_len;
36440 ser_ref.data = ser->elems /* XXX ser leaks */;
36441 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36442 *ret_conv = NodeFeatures_read(ser_ref);
36443 return (uint32_t)ret_conv;
36446 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
36447 LDKInvoiceFeatures obj_conv;
36448 obj_conv.inner = (void*)(obj & (~1));
36449 obj_conv.is_owned = false;
36450 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36451 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36452 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36453 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36454 CVec_u8Z_free(ret_var);
36458 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
36459 LDKu8slice ser_ref;
36460 ser_ref.datalen = ser->arr_len;
36461 ser_ref.data = ser->elems /* XXX ser leaks */;
36462 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36463 *ret_conv = InvoiceFeatures_read(ser_ref);
36464 return (uint32_t)ret_conv;
36467 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
36468 LDKChannelTypeFeatures obj_conv;
36469 obj_conv.inner = (void*)(obj & (~1));
36470 obj_conv.is_owned = false;
36471 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36472 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36473 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36474 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36475 CVec_u8Z_free(ret_var);
36479 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
36480 LDKu8slice ser_ref;
36481 ser_ref.datalen = ser->arr_len;
36482 ser_ref.data = ser->elems /* XXX ser leaks */;
36483 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36484 *ret_conv = ChannelTypeFeatures_read(ser_ref);
36485 return (uint32_t)ret_conv;
36488 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36489 LDKInitFeatures this_arg_conv;
36490 this_arg_conv.inner = (void*)(this_arg & (~1));
36491 this_arg_conv.is_owned = false;
36492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36493 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
36496 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36497 LDKInitFeatures this_arg_conv;
36498 this_arg_conv.inner = (void*)(this_arg & (~1));
36499 this_arg_conv.is_owned = false;
36500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36501 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
36504 jboolean __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint32_t this_arg) {
36505 LDKInitFeatures this_arg_conv;
36506 this_arg_conv.inner = (void*)(this_arg & (~1));
36507 this_arg_conv.is_owned = false;
36508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36509 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
36513 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36514 LDKNodeFeatures this_arg_conv;
36515 this_arg_conv.inner = (void*)(this_arg & (~1));
36516 this_arg_conv.is_owned = false;
36517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36518 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
36521 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36522 LDKNodeFeatures this_arg_conv;
36523 this_arg_conv.inner = (void*)(this_arg & (~1));
36524 this_arg_conv.is_owned = false;
36525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36526 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
36529 jboolean __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint32_t this_arg) {
36530 LDKNodeFeatures this_arg_conv;
36531 this_arg_conv.inner = (void*)(this_arg & (~1));
36532 this_arg_conv.is_owned = false;
36533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36534 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
36538 jboolean __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint32_t this_arg) {
36539 LDKInitFeatures this_arg_conv;
36540 this_arg_conv.inner = (void*)(this_arg & (~1));
36541 this_arg_conv.is_owned = false;
36542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36543 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
36547 jboolean __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint32_t this_arg) {
36548 LDKNodeFeatures this_arg_conv;
36549 this_arg_conv.inner = (void*)(this_arg & (~1));
36550 this_arg_conv.is_owned = false;
36551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36552 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
36556 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint32_t this_arg) {
36557 LDKInitFeatures this_arg_conv;
36558 this_arg_conv.inner = (void*)(this_arg & (~1));
36559 this_arg_conv.is_owned = false;
36560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36561 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
36564 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint32_t this_arg) {
36565 LDKInitFeatures this_arg_conv;
36566 this_arg_conv.inner = (void*)(this_arg & (~1));
36567 this_arg_conv.is_owned = false;
36568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36569 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
36572 jboolean __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint32_t this_arg) {
36573 LDKInitFeatures this_arg_conv;
36574 this_arg_conv.inner = (void*)(this_arg & (~1));
36575 this_arg_conv.is_owned = false;
36576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36577 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
36581 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36582 LDKInitFeatures this_arg_conv;
36583 this_arg_conv.inner = (void*)(this_arg & (~1));
36584 this_arg_conv.is_owned = false;
36585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36586 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36589 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36590 LDKInitFeatures this_arg_conv;
36591 this_arg_conv.inner = (void*)(this_arg & (~1));
36592 this_arg_conv.is_owned = false;
36593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36594 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36597 jboolean __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36598 LDKInitFeatures this_arg_conv;
36599 this_arg_conv.inner = (void*)(this_arg & (~1));
36600 this_arg_conv.is_owned = false;
36601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36602 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36606 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36607 LDKNodeFeatures this_arg_conv;
36608 this_arg_conv.inner = (void*)(this_arg & (~1));
36609 this_arg_conv.is_owned = false;
36610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36611 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36614 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36615 LDKNodeFeatures this_arg_conv;
36616 this_arg_conv.inner = (void*)(this_arg & (~1));
36617 this_arg_conv.is_owned = false;
36618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36619 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36622 jboolean __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36623 LDKNodeFeatures this_arg_conv;
36624 this_arg_conv.inner = (void*)(this_arg & (~1));
36625 this_arg_conv.is_owned = false;
36626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36627 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36631 jboolean __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36632 LDKInitFeatures this_arg_conv;
36633 this_arg_conv.inner = (void*)(this_arg & (~1));
36634 this_arg_conv.is_owned = false;
36635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36636 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36640 jboolean __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36641 LDKNodeFeatures this_arg_conv;
36642 this_arg_conv.inner = (void*)(this_arg & (~1));
36643 this_arg_conv.is_owned = false;
36644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36645 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36649 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36650 LDKInitFeatures this_arg_conv;
36651 this_arg_conv.inner = (void*)(this_arg & (~1));
36652 this_arg_conv.is_owned = false;
36653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36654 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
36657 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint32_t this_arg) {
36658 LDKInitFeatures this_arg_conv;
36659 this_arg_conv.inner = (void*)(this_arg & (~1));
36660 this_arg_conv.is_owned = false;
36661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36662 InitFeatures_set_gossip_queries_required(&this_arg_conv);
36665 jboolean __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint32_t this_arg) {
36666 LDKInitFeatures this_arg_conv;
36667 this_arg_conv.inner = (void*)(this_arg & (~1));
36668 this_arg_conv.is_owned = false;
36669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36670 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
36674 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36675 LDKNodeFeatures this_arg_conv;
36676 this_arg_conv.inner = (void*)(this_arg & (~1));
36677 this_arg_conv.is_owned = false;
36678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36679 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
36682 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint32_t this_arg) {
36683 LDKNodeFeatures this_arg_conv;
36684 this_arg_conv.inner = (void*)(this_arg & (~1));
36685 this_arg_conv.is_owned = false;
36686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36687 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
36690 jboolean __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint32_t this_arg) {
36691 LDKNodeFeatures this_arg_conv;
36692 this_arg_conv.inner = (void*)(this_arg & (~1));
36693 this_arg_conv.is_owned = false;
36694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36695 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
36699 jboolean __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint32_t this_arg) {
36700 LDKInitFeatures this_arg_conv;
36701 this_arg_conv.inner = (void*)(this_arg & (~1));
36702 this_arg_conv.is_owned = false;
36703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36704 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
36708 jboolean __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint32_t this_arg) {
36709 LDKNodeFeatures this_arg_conv;
36710 this_arg_conv.inner = (void*)(this_arg & (~1));
36711 this_arg_conv.is_owned = false;
36712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36713 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
36717 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36718 LDKInitFeatures this_arg_conv;
36719 this_arg_conv.inner = (void*)(this_arg & (~1));
36720 this_arg_conv.is_owned = false;
36721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36722 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
36725 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36726 LDKInitFeatures this_arg_conv;
36727 this_arg_conv.inner = (void*)(this_arg & (~1));
36728 this_arg_conv.is_owned = false;
36729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36730 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
36733 jboolean __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint32_t this_arg) {
36734 LDKInitFeatures this_arg_conv;
36735 this_arg_conv.inner = (void*)(this_arg & (~1));
36736 this_arg_conv.is_owned = false;
36737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36738 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
36742 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36743 LDKNodeFeatures this_arg_conv;
36744 this_arg_conv.inner = (void*)(this_arg & (~1));
36745 this_arg_conv.is_owned = false;
36746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36747 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
36750 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36751 LDKNodeFeatures this_arg_conv;
36752 this_arg_conv.inner = (void*)(this_arg & (~1));
36753 this_arg_conv.is_owned = false;
36754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36755 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
36758 jboolean __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint32_t this_arg) {
36759 LDKNodeFeatures this_arg_conv;
36760 this_arg_conv.inner = (void*)(this_arg & (~1));
36761 this_arg_conv.is_owned = false;
36762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36763 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
36767 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36768 LDKInvoiceFeatures this_arg_conv;
36769 this_arg_conv.inner = (void*)(this_arg & (~1));
36770 this_arg_conv.is_owned = false;
36771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36772 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
36775 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36776 LDKInvoiceFeatures this_arg_conv;
36777 this_arg_conv.inner = (void*)(this_arg & (~1));
36778 this_arg_conv.is_owned = false;
36779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36780 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
36783 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint32_t this_arg) {
36784 LDKInvoiceFeatures this_arg_conv;
36785 this_arg_conv.inner = (void*)(this_arg & (~1));
36786 this_arg_conv.is_owned = false;
36787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36788 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
36792 jboolean __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint32_t this_arg) {
36793 LDKInitFeatures this_arg_conv;
36794 this_arg_conv.inner = (void*)(this_arg & (~1));
36795 this_arg_conv.is_owned = false;
36796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36797 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
36801 jboolean __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint32_t this_arg) {
36802 LDKNodeFeatures this_arg_conv;
36803 this_arg_conv.inner = (void*)(this_arg & (~1));
36804 this_arg_conv.is_owned = false;
36805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36806 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
36810 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint32_t this_arg) {
36811 LDKInvoiceFeatures this_arg_conv;
36812 this_arg_conv.inner = (void*)(this_arg & (~1));
36813 this_arg_conv.is_owned = false;
36814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36815 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
36819 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint32_t this_arg) {
36820 LDKInitFeatures this_arg_conv;
36821 this_arg_conv.inner = (void*)(this_arg & (~1));
36822 this_arg_conv.is_owned = false;
36823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36824 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
36827 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint32_t this_arg) {
36828 LDKInitFeatures this_arg_conv;
36829 this_arg_conv.inner = (void*)(this_arg & (~1));
36830 this_arg_conv.is_owned = false;
36831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36832 InitFeatures_set_static_remote_key_required(&this_arg_conv);
36835 jboolean __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint32_t this_arg) {
36836 LDKInitFeatures this_arg_conv;
36837 this_arg_conv.inner = (void*)(this_arg & (~1));
36838 this_arg_conv.is_owned = false;
36839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36840 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
36844 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
36845 LDKNodeFeatures this_arg_conv;
36846 this_arg_conv.inner = (void*)(this_arg & (~1));
36847 this_arg_conv.is_owned = false;
36848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36849 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
36852 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint32_t this_arg) {
36853 LDKNodeFeatures this_arg_conv;
36854 this_arg_conv.inner = (void*)(this_arg & (~1));
36855 this_arg_conv.is_owned = false;
36856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36857 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
36860 jboolean __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint32_t this_arg) {
36861 LDKNodeFeatures this_arg_conv;
36862 this_arg_conv.inner = (void*)(this_arg & (~1));
36863 this_arg_conv.is_owned = false;
36864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36865 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
36869 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
36870 LDKChannelTypeFeatures this_arg_conv;
36871 this_arg_conv.inner = (void*)(this_arg & (~1));
36872 this_arg_conv.is_owned = false;
36873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36874 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
36877 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint32_t this_arg) {
36878 LDKChannelTypeFeatures this_arg_conv;
36879 this_arg_conv.inner = (void*)(this_arg & (~1));
36880 this_arg_conv.is_owned = false;
36881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36882 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
36885 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint32_t this_arg) {
36886 LDKChannelTypeFeatures this_arg_conv;
36887 this_arg_conv.inner = (void*)(this_arg & (~1));
36888 this_arg_conv.is_owned = false;
36889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36890 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
36894 jboolean __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint32_t this_arg) {
36895 LDKInitFeatures this_arg_conv;
36896 this_arg_conv.inner = (void*)(this_arg & (~1));
36897 this_arg_conv.is_owned = false;
36898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36899 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
36903 jboolean __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint32_t this_arg) {
36904 LDKNodeFeatures this_arg_conv;
36905 this_arg_conv.inner = (void*)(this_arg & (~1));
36906 this_arg_conv.is_owned = false;
36907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36908 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
36912 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint32_t this_arg) {
36913 LDKChannelTypeFeatures this_arg_conv;
36914 this_arg_conv.inner = (void*)(this_arg & (~1));
36915 this_arg_conv.is_owned = false;
36916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36917 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
36921 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint32_t this_arg) {
36922 LDKInitFeatures this_arg_conv;
36923 this_arg_conv.inner = (void*)(this_arg & (~1));
36924 this_arg_conv.is_owned = false;
36925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36926 InitFeatures_set_payment_secret_optional(&this_arg_conv);
36929 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint32_t this_arg) {
36930 LDKInitFeatures this_arg_conv;
36931 this_arg_conv.inner = (void*)(this_arg & (~1));
36932 this_arg_conv.is_owned = false;
36933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36934 InitFeatures_set_payment_secret_required(&this_arg_conv);
36937 jboolean __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
36938 LDKInitFeatures this_arg_conv;
36939 this_arg_conv.inner = (void*)(this_arg & (~1));
36940 this_arg_conv.is_owned = false;
36941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36942 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
36946 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint32_t this_arg) {
36947 LDKNodeFeatures this_arg_conv;
36948 this_arg_conv.inner = (void*)(this_arg & (~1));
36949 this_arg_conv.is_owned = false;
36950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36951 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
36954 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint32_t this_arg) {
36955 LDKNodeFeatures this_arg_conv;
36956 this_arg_conv.inner = (void*)(this_arg & (~1));
36957 this_arg_conv.is_owned = false;
36958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36959 NodeFeatures_set_payment_secret_required(&this_arg_conv);
36962 jboolean __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
36963 LDKNodeFeatures this_arg_conv;
36964 this_arg_conv.inner = (void*)(this_arg & (~1));
36965 this_arg_conv.is_owned = false;
36966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36967 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
36971 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint32_t this_arg) {
36972 LDKInvoiceFeatures this_arg_conv;
36973 this_arg_conv.inner = (void*)(this_arg & (~1));
36974 this_arg_conv.is_owned = false;
36975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36976 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
36979 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint32_t this_arg) {
36980 LDKInvoiceFeatures this_arg_conv;
36981 this_arg_conv.inner = (void*)(this_arg & (~1));
36982 this_arg_conv.is_owned = false;
36983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36984 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
36987 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
36988 LDKInvoiceFeatures this_arg_conv;
36989 this_arg_conv.inner = (void*)(this_arg & (~1));
36990 this_arg_conv.is_owned = false;
36991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36992 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
36996 jboolean __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint32_t this_arg) {
36997 LDKInitFeatures this_arg_conv;
36998 this_arg_conv.inner = (void*)(this_arg & (~1));
36999 this_arg_conv.is_owned = false;
37000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37001 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
37005 jboolean __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint32_t this_arg) {
37006 LDKNodeFeatures this_arg_conv;
37007 this_arg_conv.inner = (void*)(this_arg & (~1));
37008 this_arg_conv.is_owned = false;
37009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37010 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
37014 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint32_t this_arg) {
37015 LDKInvoiceFeatures this_arg_conv;
37016 this_arg_conv.inner = (void*)(this_arg & (~1));
37017 this_arg_conv.is_owned = false;
37018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37019 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
37023 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37024 LDKInitFeatures this_arg_conv;
37025 this_arg_conv.inner = (void*)(this_arg & (~1));
37026 this_arg_conv.is_owned = false;
37027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37028 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
37031 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint32_t this_arg) {
37032 LDKInitFeatures this_arg_conv;
37033 this_arg_conv.inner = (void*)(this_arg & (~1));
37034 this_arg_conv.is_owned = false;
37035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37036 InitFeatures_set_basic_mpp_required(&this_arg_conv);
37039 jboolean __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint32_t this_arg) {
37040 LDKInitFeatures this_arg_conv;
37041 this_arg_conv.inner = (void*)(this_arg & (~1));
37042 this_arg_conv.is_owned = false;
37043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37044 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
37048 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37049 LDKNodeFeatures this_arg_conv;
37050 this_arg_conv.inner = (void*)(this_arg & (~1));
37051 this_arg_conv.is_owned = false;
37052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37053 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
37056 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint32_t this_arg) {
37057 LDKNodeFeatures this_arg_conv;
37058 this_arg_conv.inner = (void*)(this_arg & (~1));
37059 this_arg_conv.is_owned = false;
37060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37061 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
37064 jboolean __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint32_t this_arg) {
37065 LDKNodeFeatures this_arg_conv;
37066 this_arg_conv.inner = (void*)(this_arg & (~1));
37067 this_arg_conv.is_owned = false;
37068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37069 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
37073 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37074 LDKInvoiceFeatures this_arg_conv;
37075 this_arg_conv.inner = (void*)(this_arg & (~1));
37076 this_arg_conv.is_owned = false;
37077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37078 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
37081 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint32_t this_arg) {
37082 LDKInvoiceFeatures this_arg_conv;
37083 this_arg_conv.inner = (void*)(this_arg & (~1));
37084 this_arg_conv.is_owned = false;
37085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37086 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
37089 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint32_t this_arg) {
37090 LDKInvoiceFeatures this_arg_conv;
37091 this_arg_conv.inner = (void*)(this_arg & (~1));
37092 this_arg_conv.is_owned = false;
37093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37094 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
37098 jboolean __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint32_t this_arg) {
37099 LDKInitFeatures this_arg_conv;
37100 this_arg_conv.inner = (void*)(this_arg & (~1));
37101 this_arg_conv.is_owned = false;
37102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37103 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
37107 jboolean __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint32_t this_arg) {
37108 LDKNodeFeatures this_arg_conv;
37109 this_arg_conv.inner = (void*)(this_arg & (~1));
37110 this_arg_conv.is_owned = false;
37111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37112 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
37116 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint32_t this_arg) {
37117 LDKInvoiceFeatures this_arg_conv;
37118 this_arg_conv.inner = (void*)(this_arg & (~1));
37119 this_arg_conv.is_owned = false;
37120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37121 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
37125 void __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint32_t this_arg) {
37126 LDKInitFeatures this_arg_conv;
37127 this_arg_conv.inner = (void*)(this_arg & (~1));
37128 this_arg_conv.is_owned = false;
37129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37130 InitFeatures_set_wumbo_optional(&this_arg_conv);
37133 void __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint32_t this_arg) {
37134 LDKInitFeatures this_arg_conv;
37135 this_arg_conv.inner = (void*)(this_arg & (~1));
37136 this_arg_conv.is_owned = false;
37137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37138 InitFeatures_set_wumbo_required(&this_arg_conv);
37141 jboolean __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint32_t this_arg) {
37142 LDKInitFeatures this_arg_conv;
37143 this_arg_conv.inner = (void*)(this_arg & (~1));
37144 this_arg_conv.is_owned = false;
37145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37146 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
37150 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint32_t this_arg) {
37151 LDKNodeFeatures this_arg_conv;
37152 this_arg_conv.inner = (void*)(this_arg & (~1));
37153 this_arg_conv.is_owned = false;
37154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37155 NodeFeatures_set_wumbo_optional(&this_arg_conv);
37158 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint32_t this_arg) {
37159 LDKNodeFeatures this_arg_conv;
37160 this_arg_conv.inner = (void*)(this_arg & (~1));
37161 this_arg_conv.is_owned = false;
37162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37163 NodeFeatures_set_wumbo_required(&this_arg_conv);
37166 jboolean __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint32_t this_arg) {
37167 LDKNodeFeatures this_arg_conv;
37168 this_arg_conv.inner = (void*)(this_arg & (~1));
37169 this_arg_conv.is_owned = false;
37170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37171 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
37175 jboolean __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint32_t this_arg) {
37176 LDKInitFeatures this_arg_conv;
37177 this_arg_conv.inner = (void*)(this_arg & (~1));
37178 this_arg_conv.is_owned = false;
37179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37180 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
37184 jboolean __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint32_t this_arg) {
37185 LDKNodeFeatures this_arg_conv;
37186 this_arg_conv.inner = (void*)(this_arg & (~1));
37187 this_arg_conv.is_owned = false;
37188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37189 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
37193 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37194 LDKInitFeatures this_arg_conv;
37195 this_arg_conv.inner = (void*)(this_arg & (~1));
37196 this_arg_conv.is_owned = false;
37197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37198 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37201 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37202 LDKInitFeatures this_arg_conv;
37203 this_arg_conv.inner = (void*)(this_arg & (~1));
37204 this_arg_conv.is_owned = false;
37205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37206 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37209 jboolean __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37210 LDKInitFeatures this_arg_conv;
37211 this_arg_conv.inner = (void*)(this_arg & (~1));
37212 this_arg_conv.is_owned = false;
37213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37214 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37218 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37219 LDKNodeFeatures this_arg_conv;
37220 this_arg_conv.inner = (void*)(this_arg & (~1));
37221 this_arg_conv.is_owned = false;
37222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37223 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37226 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37227 LDKNodeFeatures this_arg_conv;
37228 this_arg_conv.inner = (void*)(this_arg & (~1));
37229 this_arg_conv.is_owned = false;
37230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37231 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37234 jboolean __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37235 LDKNodeFeatures this_arg_conv;
37236 this_arg_conv.inner = (void*)(this_arg & (~1));
37237 this_arg_conv.is_owned = false;
37238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37239 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37243 jboolean __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37244 LDKInitFeatures this_arg_conv;
37245 this_arg_conv.inner = (void*)(this_arg & (~1));
37246 this_arg_conv.is_owned = false;
37247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37248 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37252 jboolean __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37253 LDKNodeFeatures this_arg_conv;
37254 this_arg_conv.inner = (void*)(this_arg & (~1));
37255 this_arg_conv.is_owned = false;
37256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37257 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37261 void __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint32_t this_arg) {
37262 LDKInitFeatures this_arg_conv;
37263 this_arg_conv.inner = (void*)(this_arg & (~1));
37264 this_arg_conv.is_owned = false;
37265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37266 InitFeatures_set_channel_type_optional(&this_arg_conv);
37269 void __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint32_t this_arg) {
37270 LDKInitFeatures this_arg_conv;
37271 this_arg_conv.inner = (void*)(this_arg & (~1));
37272 this_arg_conv.is_owned = false;
37273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37274 InitFeatures_set_channel_type_required(&this_arg_conv);
37277 jboolean __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint32_t this_arg) {
37278 LDKInitFeatures this_arg_conv;
37279 this_arg_conv.inner = (void*)(this_arg & (~1));
37280 this_arg_conv.is_owned = false;
37281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37282 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
37286 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint32_t this_arg) {
37287 LDKNodeFeatures this_arg_conv;
37288 this_arg_conv.inner = (void*)(this_arg & (~1));
37289 this_arg_conv.is_owned = false;
37290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37291 NodeFeatures_set_channel_type_optional(&this_arg_conv);
37294 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint32_t this_arg) {
37295 LDKNodeFeatures this_arg_conv;
37296 this_arg_conv.inner = (void*)(this_arg & (~1));
37297 this_arg_conv.is_owned = false;
37298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37299 NodeFeatures_set_channel_type_required(&this_arg_conv);
37302 jboolean __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint32_t this_arg) {
37303 LDKNodeFeatures this_arg_conv;
37304 this_arg_conv.inner = (void*)(this_arg & (~1));
37305 this_arg_conv.is_owned = false;
37306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37307 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
37311 jboolean __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint32_t this_arg) {
37312 LDKInitFeatures this_arg_conv;
37313 this_arg_conv.inner = (void*)(this_arg & (~1));
37314 this_arg_conv.is_owned = false;
37315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37316 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
37320 jboolean __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint32_t this_arg) {
37321 LDKNodeFeatures this_arg_conv;
37322 this_arg_conv.inner = (void*)(this_arg & (~1));
37323 this_arg_conv.is_owned = false;
37324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37325 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
37329 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37330 LDKInitFeatures this_arg_conv;
37331 this_arg_conv.inner = (void*)(this_arg & (~1));
37332 this_arg_conv.is_owned = false;
37333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37334 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
37337 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint32_t this_arg) {
37338 LDKInitFeatures this_arg_conv;
37339 this_arg_conv.inner = (void*)(this_arg & (~1));
37340 this_arg_conv.is_owned = false;
37341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37342 InitFeatures_set_scid_privacy_required(&this_arg_conv);
37345 jboolean __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint32_t this_arg) {
37346 LDKInitFeatures this_arg_conv;
37347 this_arg_conv.inner = (void*)(this_arg & (~1));
37348 this_arg_conv.is_owned = false;
37349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37350 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
37354 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37355 LDKNodeFeatures this_arg_conv;
37356 this_arg_conv.inner = (void*)(this_arg & (~1));
37357 this_arg_conv.is_owned = false;
37358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37359 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
37362 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37363 LDKNodeFeatures this_arg_conv;
37364 this_arg_conv.inner = (void*)(this_arg & (~1));
37365 this_arg_conv.is_owned = false;
37366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37367 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
37370 jboolean __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint32_t this_arg) {
37371 LDKNodeFeatures this_arg_conv;
37372 this_arg_conv.inner = (void*)(this_arg & (~1));
37373 this_arg_conv.is_owned = false;
37374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37375 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
37379 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37380 LDKChannelTypeFeatures this_arg_conv;
37381 this_arg_conv.inner = (void*)(this_arg & (~1));
37382 this_arg_conv.is_owned = false;
37383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37384 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
37387 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37388 LDKChannelTypeFeatures this_arg_conv;
37389 this_arg_conv.inner = (void*)(this_arg & (~1));
37390 this_arg_conv.is_owned = false;
37391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37392 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
37395 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint32_t this_arg) {
37396 LDKChannelTypeFeatures this_arg_conv;
37397 this_arg_conv.inner = (void*)(this_arg & (~1));
37398 this_arg_conv.is_owned = false;
37399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37400 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
37404 jboolean __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint32_t this_arg) {
37405 LDKInitFeatures this_arg_conv;
37406 this_arg_conv.inner = (void*)(this_arg & (~1));
37407 this_arg_conv.is_owned = false;
37408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37409 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
37413 jboolean __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint32_t this_arg) {
37414 LDKNodeFeatures this_arg_conv;
37415 this_arg_conv.inner = (void*)(this_arg & (~1));
37416 this_arg_conv.is_owned = false;
37417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37418 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
37422 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint32_t this_arg) {
37423 LDKChannelTypeFeatures this_arg_conv;
37424 this_arg_conv.inner = (void*)(this_arg & (~1));
37425 this_arg_conv.is_owned = false;
37426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37427 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
37431 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint32_t this_arg) {
37432 LDKInitFeatures this_arg_conv;
37433 this_arg_conv.inner = (void*)(this_arg & (~1));
37434 this_arg_conv.is_owned = false;
37435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37436 InitFeatures_set_zero_conf_optional(&this_arg_conv);
37439 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint32_t this_arg) {
37440 LDKInitFeatures this_arg_conv;
37441 this_arg_conv.inner = (void*)(this_arg & (~1));
37442 this_arg_conv.is_owned = false;
37443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37444 InitFeatures_set_zero_conf_required(&this_arg_conv);
37447 jboolean __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint32_t this_arg) {
37448 LDKInitFeatures this_arg_conv;
37449 this_arg_conv.inner = (void*)(this_arg & (~1));
37450 this_arg_conv.is_owned = false;
37451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37452 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
37456 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37457 LDKNodeFeatures this_arg_conv;
37458 this_arg_conv.inner = (void*)(this_arg & (~1));
37459 this_arg_conv.is_owned = false;
37460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37461 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
37464 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint32_t this_arg) {
37465 LDKNodeFeatures this_arg_conv;
37466 this_arg_conv.inner = (void*)(this_arg & (~1));
37467 this_arg_conv.is_owned = false;
37468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37469 NodeFeatures_set_zero_conf_required(&this_arg_conv);
37472 jboolean __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint32_t this_arg) {
37473 LDKNodeFeatures this_arg_conv;
37474 this_arg_conv.inner = (void*)(this_arg & (~1));
37475 this_arg_conv.is_owned = false;
37476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37477 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
37481 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37482 LDKChannelTypeFeatures this_arg_conv;
37483 this_arg_conv.inner = (void*)(this_arg & (~1));
37484 this_arg_conv.is_owned = false;
37485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37486 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
37489 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint32_t this_arg) {
37490 LDKChannelTypeFeatures this_arg_conv;
37491 this_arg_conv.inner = (void*)(this_arg & (~1));
37492 this_arg_conv.is_owned = false;
37493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37494 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
37497 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint32_t this_arg) {
37498 LDKChannelTypeFeatures this_arg_conv;
37499 this_arg_conv.inner = (void*)(this_arg & (~1));
37500 this_arg_conv.is_owned = false;
37501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37502 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
37506 jboolean __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint32_t this_arg) {
37507 LDKInitFeatures this_arg_conv;
37508 this_arg_conv.inner = (void*)(this_arg & (~1));
37509 this_arg_conv.is_owned = false;
37510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37511 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
37515 jboolean __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint32_t this_arg) {
37516 LDKNodeFeatures this_arg_conv;
37517 this_arg_conv.inner = (void*)(this_arg & (~1));
37518 this_arg_conv.is_owned = false;
37519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37520 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
37524 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint32_t this_arg) {
37525 LDKChannelTypeFeatures this_arg_conv;
37526 this_arg_conv.inner = (void*)(this_arg & (~1));
37527 this_arg_conv.is_owned = false;
37528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37529 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
37533 void __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint32_t this_arg) {
37534 LDKNodeFeatures this_arg_conv;
37535 this_arg_conv.inner = (void*)(this_arg & (~1));
37536 this_arg_conv.is_owned = false;
37537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37538 NodeFeatures_set_keysend_optional(&this_arg_conv);
37541 void __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint32_t this_arg) {
37542 LDKNodeFeatures this_arg_conv;
37543 this_arg_conv.inner = (void*)(this_arg & (~1));
37544 this_arg_conv.is_owned = false;
37545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37546 NodeFeatures_set_keysend_required(&this_arg_conv);
37549 jboolean __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint32_t this_arg) {
37550 LDKNodeFeatures this_arg_conv;
37551 this_arg_conv.inner = (void*)(this_arg & (~1));
37552 this_arg_conv.is_owned = false;
37553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37554 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
37558 jboolean __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint32_t this_arg) {
37559 LDKNodeFeatures this_arg_conv;
37560 this_arg_conv.inner = (void*)(this_arg & (~1));
37561 this_arg_conv.is_owned = false;
37562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37563 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
37567 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
37568 LDKShutdownScript this_obj_conv;
37569 this_obj_conv.inner = (void*)(this_obj & (~1));
37570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37572 ShutdownScript_free(this_obj_conv);
37575 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
37576 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
37577 uint32_t ret_ref = 0;
37578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37581 ret_ref = (uintptr_t)ret_var.inner;
37582 if (ret_var.is_owned) {
37587 uint32_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
37588 LDKShutdownScript arg_conv;
37589 arg_conv.inner = (void*)(arg & (~1));
37590 arg_conv.is_owned = false;
37591 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37592 uint32_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
37596 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
37597 LDKShutdownScript orig_conv;
37598 orig_conv.inner = (void*)(orig & (~1));
37599 orig_conv.is_owned = false;
37600 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37601 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
37602 uint32_t ret_ref = 0;
37603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37606 ret_ref = (uintptr_t)ret_var.inner;
37607 if (ret_var.is_owned) {
37613 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
37614 LDKInvalidShutdownScript this_obj_conv;
37615 this_obj_conv.inner = (void*)(this_obj & (~1));
37616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37618 InvalidShutdownScript_free(this_obj_conv);
37621 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
37622 LDKInvalidShutdownScript this_ptr_conv;
37623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37624 this_ptr_conv.is_owned = false;
37625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37626 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
37627 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37628 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37632 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
37633 LDKInvalidShutdownScript this_ptr_conv;
37634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37635 this_ptr_conv.is_owned = false;
37636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37637 LDKCVec_u8Z val_ref;
37638 val_ref.datalen = val->arr_len;
37639 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37640 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37641 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
37644 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
37645 LDKCVec_u8Z script_arg_ref;
37646 script_arg_ref.datalen = script_arg->arr_len;
37647 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37648 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37649 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
37650 uint32_t ret_ref = 0;
37651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37654 ret_ref = (uintptr_t)ret_var.inner;
37655 if (ret_var.is_owned) {
37661 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
37662 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
37663 uint32_t ret_ref = 0;
37664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37667 ret_ref = (uintptr_t)ret_var.inner;
37668 if (ret_var.is_owned) {
37673 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
37674 LDKInvalidShutdownScript arg_conv;
37675 arg_conv.inner = (void*)(arg & (~1));
37676 arg_conv.is_owned = false;
37677 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37678 uint32_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
37682 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
37683 LDKInvalidShutdownScript orig_conv;
37684 orig_conv.inner = (void*)(orig & (~1));
37685 orig_conv.is_owned = false;
37686 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37687 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
37688 uint32_t ret_ref = 0;
37689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37692 ret_ref = (uintptr_t)ret_var.inner;
37693 if (ret_var.is_owned) {
37699 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
37700 LDKShutdownScript obj_conv;
37701 obj_conv.inner = (void*)(obj & (~1));
37702 obj_conv.is_owned = false;
37703 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37704 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
37705 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37706 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37707 CVec_u8Z_free(ret_var);
37711 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
37712 LDKu8slice ser_ref;
37713 ser_ref.datalen = ser->arr_len;
37714 ser_ref.data = ser->elems /* XXX ser leaks */;
37715 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37716 *ret_conv = ShutdownScript_read(ser_ref);
37717 return (uint32_t)ret_conv;
37720 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
37721 unsigned char pubkey_hash_arr[20];
37722 CHECK(pubkey_hash->arr_len == 20);
37723 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
37724 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
37725 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
37726 uint32_t ret_ref = 0;
37727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37730 ret_ref = (uintptr_t)ret_var.inner;
37731 if (ret_var.is_owned) {
37737 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
37738 unsigned char script_hash_arr[32];
37739 CHECK(script_hash->arr_len == 32);
37740 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
37741 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
37742 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
37743 uint32_t ret_ref = 0;
37744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37747 ret_ref = (uintptr_t)ret_var.inner;
37748 if (ret_var.is_owned) {
37754 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
37756 LDKu8slice program_ref;
37757 program_ref.datalen = program->arr_len;
37758 program_ref.data = program->elems /* XXX program leaks */;
37759 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37760 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
37761 return (uint32_t)ret_conv;
37764 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
37765 LDKShutdownScript this_arg_conv;
37766 this_arg_conv.inner = (void*)(this_arg & (~1));
37767 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
37768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37769 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
37770 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
37771 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37772 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37773 CVec_u8Z_free(ret_var);
37777 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
37778 LDKShutdownScript this_arg_conv;
37779 this_arg_conv.inner = (void*)(this_arg & (~1));
37780 this_arg_conv.is_owned = false;
37781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37782 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37783 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
37787 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
37788 LDKShutdownScript 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 LDKInitFeatures features_conv;
37793 features_conv.inner = (void*)(features & (~1));
37794 features_conv.is_owned = false;
37795 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
37796 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37800 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
37801 if ((this_ptr & 1) != 0) return;
37802 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37803 CHECK_ACCESS(this_ptr_ptr);
37804 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37805 FREE((void*)this_ptr);
37806 CustomMessageReader_free(this_ptr_conv);
37809 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37810 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37811 *ret_ret = Type_clone(arg);
37812 return (uint32_t)ret_ret;
37814 uint32_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
37815 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37816 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37817 LDKType* arg_conv = (LDKType*)arg_ptr;
37818 uint32_t ret_conv = Type_clone_ptr(arg_conv);
37822 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
37823 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
37824 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
37825 LDKType* orig_conv = (LDKType*)orig_ptr;
37826 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37827 *ret_ret = Type_clone(orig_conv);
37828 return (uint32_t)ret_ret;
37831 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
37832 if ((this_ptr & 1) != 0) return;
37833 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37834 CHECK_ACCESS(this_ptr_ptr);
37835 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
37836 FREE((void*)this_ptr);
37837 Type_free(this_ptr_conv);
37840 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
37841 LDKNodeId this_obj_conv;
37842 this_obj_conv.inner = (void*)(this_obj & (~1));
37843 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37845 NodeId_free(this_obj_conv);
37848 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
37849 LDKNodeId ret_var = NodeId_clone(arg);
37850 uint32_t ret_ref = 0;
37851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37854 ret_ref = (uintptr_t)ret_var.inner;
37855 if (ret_var.is_owned) {
37860 uint32_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
37861 LDKNodeId arg_conv;
37862 arg_conv.inner = (void*)(arg & (~1));
37863 arg_conv.is_owned = false;
37864 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37865 uint32_t ret_conv = NodeId_clone_ptr(&arg_conv);
37869 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
37870 LDKNodeId orig_conv;
37871 orig_conv.inner = (void*)(orig & (~1));
37872 orig_conv.is_owned = false;
37873 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37874 LDKNodeId ret_var = NodeId_clone(&orig_conv);
37875 uint32_t ret_ref = 0;
37876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37879 ret_ref = (uintptr_t)ret_var.inner;
37880 if (ret_var.is_owned) {
37886 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
37887 LDKPublicKey pubkey_ref;
37888 CHECK(pubkey->arr_len == 33);
37889 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
37890 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
37891 uint32_t ret_ref = 0;
37892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37895 ret_ref = (uintptr_t)ret_var.inner;
37896 if (ret_var.is_owned) {
37902 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
37903 LDKNodeId this_arg_conv;
37904 this_arg_conv.inner = (void*)(this_arg & (~1));
37905 this_arg_conv.is_owned = false;
37906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37907 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
37908 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37909 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37913 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
37915 o_conv.inner = (void*)(o & (~1));
37916 o_conv.is_owned = false;
37917 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37918 int64_t ret_conv = NodeId_hash(&o_conv);
37922 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
37923 LDKNodeId obj_conv;
37924 obj_conv.inner = (void*)(obj & (~1));
37925 obj_conv.is_owned = false;
37926 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37927 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
37928 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37929 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37930 CVec_u8Z_free(ret_var);
37934 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
37935 LDKu8slice ser_ref;
37936 ser_ref.datalen = ser->arr_len;
37937 ser_ref.data = ser->elems /* XXX ser leaks */;
37938 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
37939 *ret_conv = NodeId_read(ser_ref);
37940 return (uint32_t)ret_conv;
37943 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
37944 LDKNetworkGraph this_obj_conv;
37945 this_obj_conv.inner = (void*)(this_obj & (~1));
37946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37948 NetworkGraph_free(this_obj_conv);
37951 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
37952 LDKReadOnlyNetworkGraph this_obj_conv;
37953 this_obj_conv.inner = (void*)(this_obj & (~1));
37954 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37956 ReadOnlyNetworkGraph_free(this_obj_conv);
37959 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
37960 if ((this_ptr & 1) != 0) return;
37961 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37962 CHECK_ACCESS(this_ptr_ptr);
37963 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
37964 FREE((void*)this_ptr);
37965 NetworkUpdate_free(this_ptr_conv);
37968 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
37969 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37970 *ret_copy = NetworkUpdate_clone(arg);
37971 uint32_t ret_ref = (uintptr_t)ret_copy;
37974 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
37975 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
37976 uint32_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
37980 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
37981 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
37982 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37983 *ret_copy = NetworkUpdate_clone(orig_conv);
37984 uint32_t ret_ref = (uintptr_t)ret_copy;
37988 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
37989 LDKChannelUpdate msg_conv;
37990 msg_conv.inner = (void*)(msg & (~1));
37991 msg_conv.is_owned = (msg & 1) || (msg == 0);
37992 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37993 msg_conv = ChannelUpdate_clone(&msg_conv);
37994 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37995 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
37996 uint32_t ret_ref = (uintptr_t)ret_copy;
38000 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
38001 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38002 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
38003 uint32_t ret_ref = (uintptr_t)ret_copy;
38007 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
38008 LDKPublicKey node_id_ref;
38009 CHECK(node_id->arr_len == 33);
38010 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38011 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38012 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
38013 uint32_t ret_ref = (uintptr_t)ret_copy;
38017 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
38018 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
38019 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
38020 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38021 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38022 CVec_u8Z_free(ret_var);
38026 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
38027 LDKu8slice ser_ref;
38028 ser_ref.datalen = ser->arr_len;
38029 ser_ref.data = ser->elems /* XXX ser leaks */;
38030 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
38031 *ret_conv = NetworkUpdate_read(ser_ref);
38032 return (uint32_t)ret_conv;
38035 void __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint32_t this_obj) {
38036 LDKP2PGossipSync this_obj_conv;
38037 this_obj_conv.inner = (void*)(this_obj & (~1));
38038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38040 P2PGossipSync_free(this_obj_conv);
38043 uint32_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
38044 LDKNetworkGraph network_graph_conv;
38045 network_graph_conv.inner = (void*)(network_graph & (~1));
38046 network_graph_conv.is_owned = false;
38047 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
38048 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38049 CHECK_ACCESS(chain_access_ptr);
38050 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38051 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38052 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38053 // Manually implement clone for Java trait instances
38054 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38055 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38056 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38059 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38060 CHECK_ACCESS(logger_ptr);
38061 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38062 if (logger_conv.free == LDKLogger_JCalls_free) {
38063 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38064 LDKLogger_JCalls_cloned(&logger_conv);
38066 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
38067 uint32_t ret_ref = 0;
38068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38071 ret_ref = (uintptr_t)ret_var.inner;
38072 if (ret_var.is_owned) {
38078 void __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
38079 LDKP2PGossipSync this_arg_conv;
38080 this_arg_conv.inner = (void*)(this_arg & (~1));
38081 this_arg_conv.is_owned = false;
38082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38083 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38084 CHECK_ACCESS(chain_access_ptr);
38085 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38086 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38087 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38088 // Manually implement clone for Java trait instances
38089 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38090 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38091 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38094 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
38097 uint32_t __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint32_t this_arg) {
38098 LDKNetworkGraph this_arg_conv;
38099 this_arg_conv.inner = (void*)(this_arg & (~1));
38100 this_arg_conv.is_owned = false;
38101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38102 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
38103 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
38104 return (uint32_t)ret_ret;
38107 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint32_t this_arg) {
38108 LDKP2PGossipSync this_arg_conv;
38109 this_arg_conv.inner = (void*)(this_arg & (~1));
38110 this_arg_conv.is_owned = false;
38111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38112 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38113 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
38114 return (uint32_t)ret_ret;
38117 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint32_t this_arg) {
38118 LDKP2PGossipSync this_arg_conv;
38119 this_arg_conv.inner = (void*)(this_arg & (~1));
38120 this_arg_conv.is_owned = false;
38121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38122 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38123 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
38124 return (uint32_t)ret_ret;
38127 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
38128 LDKChannelUpdateInfo this_obj_conv;
38129 this_obj_conv.inner = (void*)(this_obj & (~1));
38130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38132 ChannelUpdateInfo_free(this_obj_conv);
38135 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
38136 LDKChannelUpdateInfo this_ptr_conv;
38137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38138 this_ptr_conv.is_owned = false;
38139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38140 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
38144 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
38145 LDKChannelUpdateInfo this_ptr_conv;
38146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38147 this_ptr_conv.is_owned = false;
38148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38149 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
38152 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
38153 LDKChannelUpdateInfo this_ptr_conv;
38154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38155 this_ptr_conv.is_owned = false;
38156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38157 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
38161 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
38162 LDKChannelUpdateInfo this_ptr_conv;
38163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38164 this_ptr_conv.is_owned = false;
38165 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38166 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
38169 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
38170 LDKChannelUpdateInfo this_ptr_conv;
38171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38172 this_ptr_conv.is_owned = false;
38173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38174 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
38178 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
38179 LDKChannelUpdateInfo this_ptr_conv;
38180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38181 this_ptr_conv.is_owned = false;
38182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38183 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38186 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
38187 LDKChannelUpdateInfo this_ptr_conv;
38188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38189 this_ptr_conv.is_owned = false;
38190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38191 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
38195 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
38196 LDKChannelUpdateInfo this_ptr_conv;
38197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38198 this_ptr_conv.is_owned = false;
38199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38200 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
38203 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
38204 LDKChannelUpdateInfo this_ptr_conv;
38205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38206 this_ptr_conv.is_owned = false;
38207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38208 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38209 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
38210 uint32_t ret_ref = (uintptr_t)ret_copy;
38214 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
38215 LDKChannelUpdateInfo this_ptr_conv;
38216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38217 this_ptr_conv.is_owned = false;
38218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38219 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38220 CHECK_ACCESS(val_ptr);
38221 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38222 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38223 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38226 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
38227 LDKChannelUpdateInfo this_ptr_conv;
38228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38229 this_ptr_conv.is_owned = false;
38230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38231 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
38232 uint32_t ret_ref = 0;
38233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38236 ret_ref = (uintptr_t)ret_var.inner;
38237 if (ret_var.is_owned) {
38243 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
38244 LDKChannelUpdateInfo this_ptr_conv;
38245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38246 this_ptr_conv.is_owned = false;
38247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38248 LDKRoutingFees val_conv;
38249 val_conv.inner = (void*)(val & (~1));
38250 val_conv.is_owned = (val & 1) || (val == 0);
38251 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38252 val_conv = RoutingFees_clone(&val_conv);
38253 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
38256 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
38257 LDKChannelUpdateInfo this_ptr_conv;
38258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38259 this_ptr_conv.is_owned = false;
38260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38261 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
38262 uint32_t ret_ref = 0;
38263 if ((uintptr_t)ret_var.inner > 4096) {
38264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38267 ret_ref = (uintptr_t)ret_var.inner;
38268 if (ret_var.is_owned) {
38275 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
38276 LDKChannelUpdateInfo this_ptr_conv;
38277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38278 this_ptr_conv.is_owned = false;
38279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38280 LDKChannelUpdate val_conv;
38281 val_conv.inner = (void*)(val & (~1));
38282 val_conv.is_owned = (val & 1) || (val == 0);
38283 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38284 val_conv = ChannelUpdate_clone(&val_conv);
38285 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
38288 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_new"))) TS_ChannelUpdateInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
38289 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
38290 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38291 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38292 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
38293 LDKRoutingFees fees_arg_conv;
38294 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38295 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38296 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38297 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38298 LDKChannelUpdate last_update_message_arg_conv;
38299 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
38300 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
38301 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
38302 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
38303 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
38304 uint32_t ret_ref = 0;
38305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38308 ret_ref = (uintptr_t)ret_var.inner;
38309 if (ret_var.is_owned) {
38315 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
38316 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
38317 uint32_t ret_ref = 0;
38318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38321 ret_ref = (uintptr_t)ret_var.inner;
38322 if (ret_var.is_owned) {
38327 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
38328 LDKChannelUpdateInfo arg_conv;
38329 arg_conv.inner = (void*)(arg & (~1));
38330 arg_conv.is_owned = false;
38331 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38332 uint32_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
38336 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
38337 LDKChannelUpdateInfo orig_conv;
38338 orig_conv.inner = (void*)(orig & (~1));
38339 orig_conv.is_owned = false;
38340 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38341 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
38342 uint32_t ret_ref = 0;
38343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38346 ret_ref = (uintptr_t)ret_var.inner;
38347 if (ret_var.is_owned) {
38353 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
38354 LDKChannelUpdateInfo obj_conv;
38355 obj_conv.inner = (void*)(obj & (~1));
38356 obj_conv.is_owned = false;
38357 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38358 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
38359 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38360 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38361 CVec_u8Z_free(ret_var);
38365 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
38366 LDKu8slice ser_ref;
38367 ser_ref.datalen = ser->arr_len;
38368 ser_ref.data = ser->elems /* XXX ser leaks */;
38369 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
38370 *ret_conv = ChannelUpdateInfo_read(ser_ref);
38371 return (uint32_t)ret_conv;
38374 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
38375 LDKChannelInfo this_obj_conv;
38376 this_obj_conv.inner = (void*)(this_obj & (~1));
38377 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38379 ChannelInfo_free(this_obj_conv);
38382 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
38383 LDKChannelInfo this_ptr_conv;
38384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38385 this_ptr_conv.is_owned = false;
38386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38387 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
38388 uint32_t ret_ref = 0;
38389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38392 ret_ref = (uintptr_t)ret_var.inner;
38393 if (ret_var.is_owned) {
38399 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
38400 LDKChannelInfo this_ptr_conv;
38401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38402 this_ptr_conv.is_owned = false;
38403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404 LDKChannelFeatures val_conv;
38405 val_conv.inner = (void*)(val & (~1));
38406 val_conv.is_owned = (val & 1) || (val == 0);
38407 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38408 val_conv = ChannelFeatures_clone(&val_conv);
38409 ChannelInfo_set_features(&this_ptr_conv, val_conv);
38412 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
38413 LDKChannelInfo this_ptr_conv;
38414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38415 this_ptr_conv.is_owned = false;
38416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38417 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
38418 uint32_t ret_ref = 0;
38419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38422 ret_ref = (uintptr_t)ret_var.inner;
38423 if (ret_var.is_owned) {
38429 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
38430 LDKChannelInfo this_ptr_conv;
38431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38432 this_ptr_conv.is_owned = false;
38433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38434 LDKNodeId val_conv;
38435 val_conv.inner = (void*)(val & (~1));
38436 val_conv.is_owned = (val & 1) || (val == 0);
38437 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38438 val_conv = NodeId_clone(&val_conv);
38439 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
38442 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
38443 LDKChannelInfo this_ptr_conv;
38444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38445 this_ptr_conv.is_owned = false;
38446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38447 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
38448 uint32_t ret_ref = 0;
38449 if ((uintptr_t)ret_var.inner > 4096) {
38450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38453 ret_ref = (uintptr_t)ret_var.inner;
38454 if (ret_var.is_owned) {
38461 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
38462 LDKChannelInfo this_ptr_conv;
38463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38464 this_ptr_conv.is_owned = false;
38465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38466 LDKChannelUpdateInfo val_conv;
38467 val_conv.inner = (void*)(val & (~1));
38468 val_conv.is_owned = (val & 1) || (val == 0);
38469 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38470 val_conv = ChannelUpdateInfo_clone(&val_conv);
38471 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
38474 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
38475 LDKChannelInfo this_ptr_conv;
38476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38477 this_ptr_conv.is_owned = false;
38478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38479 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
38480 uint32_t ret_ref = 0;
38481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38484 ret_ref = (uintptr_t)ret_var.inner;
38485 if (ret_var.is_owned) {
38491 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
38492 LDKChannelInfo this_ptr_conv;
38493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38494 this_ptr_conv.is_owned = false;
38495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38496 LDKNodeId val_conv;
38497 val_conv.inner = (void*)(val & (~1));
38498 val_conv.is_owned = (val & 1) || (val == 0);
38499 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38500 val_conv = NodeId_clone(&val_conv);
38501 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
38504 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
38505 LDKChannelInfo this_ptr_conv;
38506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38507 this_ptr_conv.is_owned = false;
38508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38509 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
38510 uint32_t ret_ref = 0;
38511 if ((uintptr_t)ret_var.inner > 4096) {
38512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38515 ret_ref = (uintptr_t)ret_var.inner;
38516 if (ret_var.is_owned) {
38523 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
38524 LDKChannelInfo this_ptr_conv;
38525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38526 this_ptr_conv.is_owned = false;
38527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38528 LDKChannelUpdateInfo val_conv;
38529 val_conv.inner = (void*)(val & (~1));
38530 val_conv.is_owned = (val & 1) || (val == 0);
38531 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38532 val_conv = ChannelUpdateInfo_clone(&val_conv);
38533 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
38536 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
38537 LDKChannelInfo this_ptr_conv;
38538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38539 this_ptr_conv.is_owned = false;
38540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38541 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38542 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
38543 uint32_t ret_ref = (uintptr_t)ret_copy;
38547 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
38548 LDKChannelInfo this_ptr_conv;
38549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38550 this_ptr_conv.is_owned = false;
38551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38552 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38553 CHECK_ACCESS(val_ptr);
38554 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38555 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38556 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
38559 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
38560 LDKChannelInfo this_ptr_conv;
38561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38562 this_ptr_conv.is_owned = false;
38563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38564 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
38565 uint32_t ret_ref = 0;
38566 if ((uintptr_t)ret_var.inner > 4096) {
38567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38570 ret_ref = (uintptr_t)ret_var.inner;
38571 if (ret_var.is_owned) {
38578 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
38579 LDKChannelInfo this_ptr_conv;
38580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38581 this_ptr_conv.is_owned = false;
38582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38583 LDKChannelAnnouncement val_conv;
38584 val_conv.inner = (void*)(val & (~1));
38585 val_conv.is_owned = (val & 1) || (val == 0);
38586 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38587 val_conv = ChannelAnnouncement_clone(&val_conv);
38588 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
38591 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
38592 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
38593 uint32_t ret_ref = 0;
38594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38597 ret_ref = (uintptr_t)ret_var.inner;
38598 if (ret_var.is_owned) {
38603 uint32_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
38604 LDKChannelInfo arg_conv;
38605 arg_conv.inner = (void*)(arg & (~1));
38606 arg_conv.is_owned = false;
38607 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38608 uint32_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
38612 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
38613 LDKChannelInfo orig_conv;
38614 orig_conv.inner = (void*)(orig & (~1));
38615 orig_conv.is_owned = false;
38616 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38617 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
38618 uint32_t ret_ref = 0;
38619 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38620 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38622 ret_ref = (uintptr_t)ret_var.inner;
38623 if (ret_var.is_owned) {
38629 uint32_t __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint32_t this_arg, int8_t channel_flags) {
38630 LDKChannelInfo this_arg_conv;
38631 this_arg_conv.inner = (void*)(this_arg & (~1));
38632 this_arg_conv.is_owned = false;
38633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38634 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
38635 uint32_t ret_ref = 0;
38636 if ((uintptr_t)ret_var.inner > 4096) {
38637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38640 ret_ref = (uintptr_t)ret_var.inner;
38641 if (ret_var.is_owned) {
38648 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
38649 LDKChannelInfo obj_conv;
38650 obj_conv.inner = (void*)(obj & (~1));
38651 obj_conv.is_owned = false;
38652 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38653 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
38654 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38655 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38656 CVec_u8Z_free(ret_var);
38660 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
38661 LDKu8slice ser_ref;
38662 ser_ref.datalen = ser->arr_len;
38663 ser_ref.data = ser->elems /* XXX ser leaks */;
38664 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
38665 *ret_conv = ChannelInfo_read(ser_ref);
38666 return (uint32_t)ret_conv;
38669 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
38670 LDKDirectedChannelInfo this_obj_conv;
38671 this_obj_conv.inner = (void*)(this_obj & (~1));
38672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38674 DirectedChannelInfo_free(this_obj_conv);
38677 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
38678 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
38679 uint32_t ret_ref = 0;
38680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38683 ret_ref = (uintptr_t)ret_var.inner;
38684 if (ret_var.is_owned) {
38689 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
38690 LDKDirectedChannelInfo arg_conv;
38691 arg_conv.inner = (void*)(arg & (~1));
38692 arg_conv.is_owned = false;
38693 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38694 uint32_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
38698 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
38699 LDKDirectedChannelInfo orig_conv;
38700 orig_conv.inner = (void*)(orig & (~1));
38701 orig_conv.is_owned = false;
38702 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38703 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
38704 uint32_t ret_ref = 0;
38705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38708 ret_ref = (uintptr_t)ret_var.inner;
38709 if (ret_var.is_owned) {
38715 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
38716 LDKDirectedChannelInfo this_arg_conv;
38717 this_arg_conv.inner = (void*)(this_arg & (~1));
38718 this_arg_conv.is_owned = false;
38719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38720 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
38721 uint32_t ret_ref = 0;
38722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38725 ret_ref = (uintptr_t)ret_var.inner;
38726 if (ret_var.is_owned) {
38732 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
38733 LDKDirectedChannelInfo this_arg_conv;
38734 this_arg_conv.inner = (void*)(this_arg & (~1));
38735 this_arg_conv.is_owned = false;
38736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38737 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
38738 uint32_t ret_ref = 0;
38739 if ((uintptr_t)ret_var.inner > 4096) {
38740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38743 ret_ref = (uintptr_t)ret_var.inner;
38744 if (ret_var.is_owned) {
38751 int64_t __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint32_t this_arg) {
38752 LDKDirectedChannelInfo this_arg_conv;
38753 this_arg_conv.inner = (void*)(this_arg & (~1));
38754 this_arg_conv.is_owned = false;
38755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38756 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
38760 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
38761 LDKDirectedChannelInfo this_arg_conv;
38762 this_arg_conv.inner = (void*)(this_arg & (~1));
38763 this_arg_conv.is_owned = false;
38764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38765 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38766 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
38767 uint32_t ret_ref = (uintptr_t)ret_copy;
38771 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
38772 if ((this_ptr & 1) != 0) return;
38773 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38774 CHECK_ACCESS(this_ptr_ptr);
38775 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
38776 FREE((void*)this_ptr);
38777 EffectiveCapacity_free(this_ptr_conv);
38780 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
38781 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38782 *ret_copy = EffectiveCapacity_clone(arg);
38783 uint32_t ret_ref = (uintptr_t)ret_copy;
38786 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
38787 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
38788 uint32_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
38792 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
38793 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
38794 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38795 *ret_copy = EffectiveCapacity_clone(orig_conv);
38796 uint32_t ret_ref = (uintptr_t)ret_copy;
38800 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
38801 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38802 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
38803 uint32_t ret_ref = (uintptr_t)ret_copy;
38807 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
38808 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38809 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
38810 uint32_t ret_ref = (uintptr_t)ret_copy;
38814 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat) {
38815 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38816 *ret_copy = EffectiveCapacity_total(capacity_msat);
38817 uint32_t ret_ref = (uintptr_t)ret_copy;
38821 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
38822 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38823 *ret_copy = EffectiveCapacity_infinite();
38824 uint32_t ret_ref = (uintptr_t)ret_copy;
38828 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
38829 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38830 *ret_copy = EffectiveCapacity_unknown();
38831 uint32_t ret_ref = (uintptr_t)ret_copy;
38835 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
38836 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
38837 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
38841 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
38842 LDKRoutingFees this_obj_conv;
38843 this_obj_conv.inner = (void*)(this_obj & (~1));
38844 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38846 RoutingFees_free(this_obj_conv);
38849 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
38850 LDKRoutingFees this_ptr_conv;
38851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38852 this_ptr_conv.is_owned = false;
38853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38854 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
38858 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
38859 LDKRoutingFees this_ptr_conv;
38860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38861 this_ptr_conv.is_owned = false;
38862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38863 RoutingFees_set_base_msat(&this_ptr_conv, val);
38866 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
38867 LDKRoutingFees this_ptr_conv;
38868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38869 this_ptr_conv.is_owned = false;
38870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38871 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
38875 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
38876 LDKRoutingFees this_ptr_conv;
38877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38878 this_ptr_conv.is_owned = false;
38879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38880 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
38883 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
38884 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
38885 uint32_t ret_ref = 0;
38886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38889 ret_ref = (uintptr_t)ret_var.inner;
38890 if (ret_var.is_owned) {
38896 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
38897 LDKRoutingFees a_conv;
38898 a_conv.inner = (void*)(a & (~1));
38899 a_conv.is_owned = false;
38900 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38901 LDKRoutingFees b_conv;
38902 b_conv.inner = (void*)(b & (~1));
38903 b_conv.is_owned = false;
38904 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38905 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
38909 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
38910 LDKRoutingFees ret_var = RoutingFees_clone(arg);
38911 uint32_t ret_ref = 0;
38912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38915 ret_ref = (uintptr_t)ret_var.inner;
38916 if (ret_var.is_owned) {
38921 uint32_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
38922 LDKRoutingFees arg_conv;
38923 arg_conv.inner = (void*)(arg & (~1));
38924 arg_conv.is_owned = false;
38925 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38926 uint32_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
38930 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
38931 LDKRoutingFees orig_conv;
38932 orig_conv.inner = (void*)(orig & (~1));
38933 orig_conv.is_owned = false;
38934 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38935 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
38936 uint32_t ret_ref = 0;
38937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38940 ret_ref = (uintptr_t)ret_var.inner;
38941 if (ret_var.is_owned) {
38947 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
38948 LDKRoutingFees o_conv;
38949 o_conv.inner = (void*)(o & (~1));
38950 o_conv.is_owned = false;
38951 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38952 int64_t ret_conv = RoutingFees_hash(&o_conv);
38956 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
38957 LDKRoutingFees obj_conv;
38958 obj_conv.inner = (void*)(obj & (~1));
38959 obj_conv.is_owned = false;
38960 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38961 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
38962 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38963 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38964 CVec_u8Z_free(ret_var);
38968 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
38969 LDKu8slice ser_ref;
38970 ser_ref.datalen = ser->arr_len;
38971 ser_ref.data = ser->elems /* XXX ser leaks */;
38972 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
38973 *ret_conv = RoutingFees_read(ser_ref);
38974 return (uint32_t)ret_conv;
38977 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
38978 LDKNodeAnnouncementInfo this_obj_conv;
38979 this_obj_conv.inner = (void*)(this_obj & (~1));
38980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38982 NodeAnnouncementInfo_free(this_obj_conv);
38985 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
38986 LDKNodeAnnouncementInfo this_ptr_conv;
38987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38988 this_ptr_conv.is_owned = false;
38989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38990 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
38991 uint32_t ret_ref = 0;
38992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38995 ret_ref = (uintptr_t)ret_var.inner;
38996 if (ret_var.is_owned) {
39002 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
39003 LDKNodeAnnouncementInfo this_ptr_conv;
39004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39005 this_ptr_conv.is_owned = false;
39006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39007 LDKNodeFeatures val_conv;
39008 val_conv.inner = (void*)(val & (~1));
39009 val_conv.is_owned = (val & 1) || (val == 0);
39010 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39011 val_conv = NodeFeatures_clone(&val_conv);
39012 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
39015 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
39016 LDKNodeAnnouncementInfo this_ptr_conv;
39017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39018 this_ptr_conv.is_owned = false;
39019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39020 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
39024 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
39025 LDKNodeAnnouncementInfo this_ptr_conv;
39026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39027 this_ptr_conv.is_owned = false;
39028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39029 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
39032 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
39033 LDKNodeAnnouncementInfo this_ptr_conv;
39034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39035 this_ptr_conv.is_owned = false;
39036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39037 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
39038 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
39042 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
39043 LDKNodeAnnouncementInfo this_ptr_conv;
39044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39045 this_ptr_conv.is_owned = false;
39046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39047 LDKThreeBytes val_ref;
39048 CHECK(val->arr_len == 3);
39049 memcpy(val_ref.data, val->elems, 3); FREE(val);
39050 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
39053 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
39054 LDKNodeAnnouncementInfo this_ptr_conv;
39055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39056 this_ptr_conv.is_owned = false;
39057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39058 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39059 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
39063 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
39064 LDKNodeAnnouncementInfo this_ptr_conv;
39065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39066 this_ptr_conv.is_owned = false;
39067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39068 LDKThirtyTwoBytes val_ref;
39069 CHECK(val->arr_len == 32);
39070 memcpy(val_ref.data, val->elems, 32); FREE(val);
39071 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
39074 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
39075 LDKNodeAnnouncementInfo this_ptr_conv;
39076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39077 this_ptr_conv.is_owned = false;
39078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39079 LDKCVec_NetAddressZ val_constr;
39080 val_constr.datalen = val->arr_len;
39081 if (val_constr.datalen > 0)
39082 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39084 val_constr.data = NULL;
39085 uint32_t* val_vals = val->elems /* XXX val leaks */;
39086 for (size_t m = 0; m < val_constr.datalen; m++) {
39087 uint32_t val_conv_12 = val_vals[m];
39088 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
39089 CHECK_ACCESS(val_conv_12_ptr);
39090 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
39091 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
39092 val_constr.data[m] = val_conv_12_conv;
39094 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
39097 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
39098 LDKNodeAnnouncementInfo this_ptr_conv;
39099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39100 this_ptr_conv.is_owned = false;
39101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39102 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
39103 uint32_t ret_ref = 0;
39104 if ((uintptr_t)ret_var.inner > 4096) {
39105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39108 ret_ref = (uintptr_t)ret_var.inner;
39109 if (ret_var.is_owned) {
39116 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
39117 LDKNodeAnnouncementInfo this_ptr_conv;
39118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39119 this_ptr_conv.is_owned = false;
39120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39121 LDKNodeAnnouncement val_conv;
39122 val_conv.inner = (void*)(val & (~1));
39123 val_conv.is_owned = (val & 1) || (val == 0);
39124 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39125 val_conv = NodeAnnouncement_clone(&val_conv);
39126 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
39129 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
39130 LDKNodeFeatures features_arg_conv;
39131 features_arg_conv.inner = (void*)(features_arg & (~1));
39132 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
39133 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39134 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
39135 LDKThreeBytes rgb_arg_ref;
39136 CHECK(rgb_arg->arr_len == 3);
39137 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
39138 LDKThirtyTwoBytes alias_arg_ref;
39139 CHECK(alias_arg->arr_len == 32);
39140 memcpy(alias_arg_ref.data, alias_arg->elems, 32); FREE(alias_arg);
39141 LDKCVec_NetAddressZ addresses_arg_constr;
39142 addresses_arg_constr.datalen = addresses_arg->arr_len;
39143 if (addresses_arg_constr.datalen > 0)
39144 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39146 addresses_arg_constr.data = NULL;
39147 uint32_t* addresses_arg_vals = addresses_arg->elems /* XXX addresses_arg leaks */;
39148 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
39149 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
39150 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
39151 CHECK_ACCESS(addresses_arg_conv_12_ptr);
39152 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
39153 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
39155 LDKNodeAnnouncement announcement_message_arg_conv;
39156 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
39157 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
39158 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
39159 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
39160 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
39161 uint32_t ret_ref = 0;
39162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39165 ret_ref = (uintptr_t)ret_var.inner;
39166 if (ret_var.is_owned) {
39172 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
39173 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
39174 uint32_t ret_ref = 0;
39175 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39176 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39177 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39178 ret_ref = (uintptr_t)ret_var.inner;
39179 if (ret_var.is_owned) {
39184 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
39185 LDKNodeAnnouncementInfo arg_conv;
39186 arg_conv.inner = (void*)(arg & (~1));
39187 arg_conv.is_owned = false;
39188 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39189 uint32_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
39193 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
39194 LDKNodeAnnouncementInfo orig_conv;
39195 orig_conv.inner = (void*)(orig & (~1));
39196 orig_conv.is_owned = false;
39197 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39198 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
39199 uint32_t ret_ref = 0;
39200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39203 ret_ref = (uintptr_t)ret_var.inner;
39204 if (ret_var.is_owned) {
39210 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
39211 LDKNodeAnnouncementInfo obj_conv;
39212 obj_conv.inner = (void*)(obj & (~1));
39213 obj_conv.is_owned = false;
39214 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39215 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
39216 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39217 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39218 CVec_u8Z_free(ret_var);
39222 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
39223 LDKu8slice ser_ref;
39224 ser_ref.datalen = ser->arr_len;
39225 ser_ref.data = ser->elems /* XXX ser leaks */;
39226 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
39227 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
39228 return (uint32_t)ret_conv;
39231 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
39232 LDKNodeInfo this_obj_conv;
39233 this_obj_conv.inner = (void*)(this_obj & (~1));
39234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39236 NodeInfo_free(this_obj_conv);
39239 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
39240 LDKNodeInfo this_ptr_conv;
39241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39242 this_ptr_conv.is_owned = false;
39243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39244 LDKCVec_u64Z val_constr;
39245 val_constr.datalen = val->arr_len;
39246 if (val_constr.datalen > 0)
39247 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39249 val_constr.data = NULL;
39250 int64_t* val_vals = val->elems /* XXX val leaks */;
39251 for (size_t i = 0; i < val_constr.datalen; i++) {
39252 int64_t val_conv_8 = val_vals[i];
39253 val_constr.data[i] = val_conv_8;
39255 NodeInfo_set_channels(&this_ptr_conv, val_constr);
39258 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
39259 LDKNodeInfo this_ptr_conv;
39260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39261 this_ptr_conv.is_owned = false;
39262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39263 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
39264 uint32_t ret_ref = 0;
39265 if ((uintptr_t)ret_var.inner > 4096) {
39266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39269 ret_ref = (uintptr_t)ret_var.inner;
39270 if (ret_var.is_owned) {
39277 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) {
39278 LDKNodeInfo this_ptr_conv;
39279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39280 this_ptr_conv.is_owned = false;
39281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39282 LDKRoutingFees val_conv;
39283 val_conv.inner = (void*)(val & (~1));
39284 val_conv.is_owned = (val & 1) || (val == 0);
39285 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39286 val_conv = RoutingFees_clone(&val_conv);
39287 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
39290 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
39291 LDKNodeInfo this_ptr_conv;
39292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39293 this_ptr_conv.is_owned = false;
39294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39295 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
39296 uint32_t ret_ref = 0;
39297 if ((uintptr_t)ret_var.inner > 4096) {
39298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39301 ret_ref = (uintptr_t)ret_var.inner;
39302 if (ret_var.is_owned) {
39309 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
39310 LDKNodeInfo this_ptr_conv;
39311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39312 this_ptr_conv.is_owned = false;
39313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39314 LDKNodeAnnouncementInfo val_conv;
39315 val_conv.inner = (void*)(val & (~1));
39316 val_conv.is_owned = (val & 1) || (val == 0);
39317 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39318 val_conv = NodeAnnouncementInfo_clone(&val_conv);
39319 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
39322 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) {
39323 LDKCVec_u64Z channels_arg_constr;
39324 channels_arg_constr.datalen = channels_arg->arr_len;
39325 if (channels_arg_constr.datalen > 0)
39326 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39328 channels_arg_constr.data = NULL;
39329 int64_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
39330 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
39331 int64_t channels_arg_conv_8 = channels_arg_vals[i];
39332 channels_arg_constr.data[i] = channels_arg_conv_8;
39334 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
39335 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
39336 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
39337 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
39338 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
39339 LDKNodeAnnouncementInfo announcement_info_arg_conv;
39340 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
39341 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
39342 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
39343 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
39344 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
39345 uint32_t ret_ref = 0;
39346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39349 ret_ref = (uintptr_t)ret_var.inner;
39350 if (ret_var.is_owned) {
39356 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
39357 LDKNodeInfo ret_var = NodeInfo_clone(arg);
39358 uint32_t ret_ref = 0;
39359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39362 ret_ref = (uintptr_t)ret_var.inner;
39363 if (ret_var.is_owned) {
39368 uint32_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
39369 LDKNodeInfo arg_conv;
39370 arg_conv.inner = (void*)(arg & (~1));
39371 arg_conv.is_owned = false;
39372 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39373 uint32_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
39377 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
39378 LDKNodeInfo orig_conv;
39379 orig_conv.inner = (void*)(orig & (~1));
39380 orig_conv.is_owned = false;
39381 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39382 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
39383 uint32_t ret_ref = 0;
39384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39387 ret_ref = (uintptr_t)ret_var.inner;
39388 if (ret_var.is_owned) {
39394 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
39395 LDKNodeInfo obj_conv;
39396 obj_conv.inner = (void*)(obj & (~1));
39397 obj_conv.is_owned = false;
39398 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39399 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
39400 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39401 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39402 CVec_u8Z_free(ret_var);
39406 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
39407 LDKu8slice ser_ref;
39408 ser_ref.datalen = ser->arr_len;
39409 ser_ref.data = ser->elems /* XXX ser leaks */;
39410 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
39411 *ret_conv = NodeInfo_read(ser_ref);
39412 return (uint32_t)ret_conv;
39415 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
39416 LDKNetworkGraph obj_conv;
39417 obj_conv.inner = (void*)(obj & (~1));
39418 obj_conv.is_owned = false;
39419 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39420 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
39421 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39422 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39423 CVec_u8Z_free(ret_var);
39427 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint32_t arg) {
39428 LDKu8slice ser_ref;
39429 ser_ref.datalen = ser->arr_len;
39430 ser_ref.data = ser->elems /* XXX ser leaks */;
39431 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39432 CHECK_ACCESS(arg_ptr);
39433 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
39434 if (arg_conv.free == LDKLogger_JCalls_free) {
39435 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39436 LDKLogger_JCalls_cloned(&arg_conv);
39438 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
39439 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
39440 return (uint32_t)ret_conv;
39443 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint32_t logger) {
39444 LDKThirtyTwoBytes genesis_hash_ref;
39445 CHECK(genesis_hash->arr_len == 32);
39446 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
39447 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39448 CHECK_ACCESS(logger_ptr);
39449 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39450 if (logger_conv.free == LDKLogger_JCalls_free) {
39451 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39452 LDKLogger_JCalls_cloned(&logger_conv);
39454 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
39455 uint32_t ret_ref = 0;
39456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39459 ret_ref = (uintptr_t)ret_var.inner;
39460 if (ret_var.is_owned) {
39466 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
39467 LDKNetworkGraph this_arg_conv;
39468 this_arg_conv.inner = (void*)(this_arg & (~1));
39469 this_arg_conv.is_owned = false;
39470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39471 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
39472 uint32_t ret_ref = 0;
39473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39476 ret_ref = (uintptr_t)ret_var.inner;
39477 if (ret_var.is_owned) {
39483 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) {
39484 LDKNetworkGraph this_arg_conv;
39485 this_arg_conv.inner = (void*)(this_arg & (~1));
39486 this_arg_conv.is_owned = false;
39487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39488 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39489 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
39490 uint32_t ret_ref = (uintptr_t)ret_copy;
39494 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) {
39495 LDKNetworkGraph this_arg_conv;
39496 this_arg_conv.inner = (void*)(this_arg & (~1));
39497 this_arg_conv.is_owned = false;
39498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39499 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
39502 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
39503 LDKNetworkGraph this_arg_conv;
39504 this_arg_conv.inner = (void*)(this_arg & (~1));
39505 this_arg_conv.is_owned = false;
39506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39507 LDKNodeAnnouncement msg_conv;
39508 msg_conv.inner = (void*)(msg & (~1));
39509 msg_conv.is_owned = false;
39510 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39511 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39512 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
39513 return (uint32_t)ret_conv;
39516 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) {
39517 LDKNetworkGraph this_arg_conv;
39518 this_arg_conv.inner = (void*)(this_arg & (~1));
39519 this_arg_conv.is_owned = false;
39520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39521 LDKUnsignedNodeAnnouncement msg_conv;
39522 msg_conv.inner = (void*)(msg & (~1));
39523 msg_conv.is_owned = false;
39524 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39525 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39526 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
39527 return (uint32_t)ret_conv;
39530 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) {
39531 LDKNetworkGraph this_arg_conv;
39532 this_arg_conv.inner = (void*)(this_arg & (~1));
39533 this_arg_conv.is_owned = false;
39534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39535 LDKChannelAnnouncement msg_conv;
39536 msg_conv.inner = (void*)(msg & (~1));
39537 msg_conv.is_owned = false;
39538 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39539 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39540 CHECK_ACCESS(chain_access_ptr);
39541 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39542 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39543 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39544 // Manually implement clone for Java trait instances
39545 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39546 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39547 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39550 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39551 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39552 return (uint32_t)ret_conv;
39555 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) {
39556 LDKNetworkGraph this_arg_conv;
39557 this_arg_conv.inner = (void*)(this_arg & (~1));
39558 this_arg_conv.is_owned = false;
39559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39560 LDKUnsignedChannelAnnouncement msg_conv;
39561 msg_conv.inner = (void*)(msg & (~1));
39562 msg_conv.is_owned = false;
39563 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39564 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39565 CHECK_ACCESS(chain_access_ptr);
39566 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39567 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39568 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39569 // Manually implement clone for Java trait instances
39570 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39571 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39572 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39575 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39576 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39577 return (uint32_t)ret_conv;
39580 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) {
39581 LDKNetworkGraph this_arg_conv;
39582 this_arg_conv.inner = (void*)(this_arg & (~1));
39583 this_arg_conv.is_owned = false;
39584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39585 LDKChannelFeatures features_conv;
39586 features_conv.inner = (void*)(features & (~1));
39587 features_conv.is_owned = (features & 1) || (features == 0);
39588 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39589 features_conv = ChannelFeatures_clone(&features_conv);
39590 LDKPublicKey node_id_1_ref;
39591 CHECK(node_id_1->arr_len == 33);
39592 memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
39593 LDKPublicKey node_id_2_ref;
39594 CHECK(node_id_2->arr_len == 33);
39595 memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
39596 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39597 *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);
39598 return (uint32_t)ret_conv;
39601 void __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
39602 LDKNetworkGraph this_arg_conv;
39603 this_arg_conv.inner = (void*)(this_arg & (~1));
39604 this_arg_conv.is_owned = false;
39605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39606 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
39609 void __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
39610 LDKNetworkGraph this_arg_conv;
39611 this_arg_conv.inner = (void*)(this_arg & (~1));
39612 this_arg_conv.is_owned = false;
39613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39614 LDKPublicKey _node_id_ref;
39615 CHECK(_node_id->arr_len == 33);
39616 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
39617 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
39620 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) {
39621 LDKNetworkGraph this_arg_conv;
39622 this_arg_conv.inner = (void*)(this_arg & (~1));
39623 this_arg_conv.is_owned = false;
39624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39625 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
39628 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
39629 LDKNetworkGraph this_arg_conv;
39630 this_arg_conv.inner = (void*)(this_arg & (~1));
39631 this_arg_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39633 LDKChannelUpdate msg_conv;
39634 msg_conv.inner = (void*)(msg & (~1));
39635 msg_conv.is_owned = false;
39636 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39637 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39638 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
39639 return (uint32_t)ret_conv;
39642 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
39643 LDKNetworkGraph this_arg_conv;
39644 this_arg_conv.inner = (void*)(this_arg & (~1));
39645 this_arg_conv.is_owned = false;
39646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39647 LDKUnsignedChannelUpdate msg_conv;
39648 msg_conv.inner = (void*)(msg & (~1));
39649 msg_conv.is_owned = false;
39650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39651 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39652 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
39653 return (uint32_t)ret_conv;
39656 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
39657 LDKReadOnlyNetworkGraph this_arg_conv;
39658 this_arg_conv.inner = (void*)(this_arg & (~1));
39659 this_arg_conv.is_owned = false;
39660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39661 LDKPublicKey pubkey_ref;
39662 CHECK(pubkey->arr_len == 33);
39663 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39664 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
39665 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
39666 uint32_t ret_ref = (uintptr_t)ret_copy;
39670 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
39671 LDKRouteHop this_obj_conv;
39672 this_obj_conv.inner = (void*)(this_obj & (~1));
39673 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39675 RouteHop_free(this_obj_conv);
39678 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
39679 LDKRouteHop this_ptr_conv;
39680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39681 this_ptr_conv.is_owned = false;
39682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39683 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39684 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
39688 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
39689 LDKRouteHop this_ptr_conv;
39690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39691 this_ptr_conv.is_owned = false;
39692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39693 LDKPublicKey val_ref;
39694 CHECK(val->arr_len == 33);
39695 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39696 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
39699 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
39700 LDKRouteHop this_ptr_conv;
39701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39702 this_ptr_conv.is_owned = false;
39703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39704 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
39705 uint32_t ret_ref = 0;
39706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39709 ret_ref = (uintptr_t)ret_var.inner;
39710 if (ret_var.is_owned) {
39716 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
39717 LDKRouteHop this_ptr_conv;
39718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39719 this_ptr_conv.is_owned = false;
39720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39721 LDKNodeFeatures val_conv;
39722 val_conv.inner = (void*)(val & (~1));
39723 val_conv.is_owned = (val & 1) || (val == 0);
39724 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39725 val_conv = NodeFeatures_clone(&val_conv);
39726 RouteHop_set_node_features(&this_ptr_conv, val_conv);
39729 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
39730 LDKRouteHop this_ptr_conv;
39731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39732 this_ptr_conv.is_owned = false;
39733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39734 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
39738 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
39739 LDKRouteHop this_ptr_conv;
39740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39741 this_ptr_conv.is_owned = false;
39742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39743 RouteHop_set_short_channel_id(&this_ptr_conv, val);
39746 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
39747 LDKRouteHop this_ptr_conv;
39748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39749 this_ptr_conv.is_owned = false;
39750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39751 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
39752 uint32_t ret_ref = 0;
39753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39756 ret_ref = (uintptr_t)ret_var.inner;
39757 if (ret_var.is_owned) {
39763 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
39764 LDKRouteHop this_ptr_conv;
39765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39766 this_ptr_conv.is_owned = false;
39767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39768 LDKChannelFeatures val_conv;
39769 val_conv.inner = (void*)(val & (~1));
39770 val_conv.is_owned = (val & 1) || (val == 0);
39771 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39772 val_conv = ChannelFeatures_clone(&val_conv);
39773 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
39776 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
39777 LDKRouteHop this_ptr_conv;
39778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39779 this_ptr_conv.is_owned = false;
39780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39781 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
39785 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
39786 LDKRouteHop 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 RouteHop_set_fee_msat(&this_ptr_conv, val);
39793 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
39794 LDKRouteHop this_ptr_conv;
39795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39796 this_ptr_conv.is_owned = false;
39797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39798 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
39802 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
39803 LDKRouteHop this_ptr_conv;
39804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39805 this_ptr_conv.is_owned = false;
39806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39807 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
39810 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) {
39811 LDKPublicKey pubkey_arg_ref;
39812 CHECK(pubkey_arg->arr_len == 33);
39813 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
39814 LDKNodeFeatures node_features_arg_conv;
39815 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
39816 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
39817 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
39818 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
39819 LDKChannelFeatures channel_features_arg_conv;
39820 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
39821 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
39822 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
39823 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
39824 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);
39825 uint32_t ret_ref = 0;
39826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39829 ret_ref = (uintptr_t)ret_var.inner;
39830 if (ret_var.is_owned) {
39836 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
39837 LDKRouteHop ret_var = RouteHop_clone(arg);
39838 uint32_t ret_ref = 0;
39839 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39840 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39842 ret_ref = (uintptr_t)ret_var.inner;
39843 if (ret_var.is_owned) {
39848 uint32_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
39849 LDKRouteHop arg_conv;
39850 arg_conv.inner = (void*)(arg & (~1));
39851 arg_conv.is_owned = false;
39852 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39853 uint32_t ret_conv = RouteHop_clone_ptr(&arg_conv);
39857 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
39858 LDKRouteHop orig_conv;
39859 orig_conv.inner = (void*)(orig & (~1));
39860 orig_conv.is_owned = false;
39861 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39862 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
39863 uint32_t ret_ref = 0;
39864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39867 ret_ref = (uintptr_t)ret_var.inner;
39868 if (ret_var.is_owned) {
39874 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
39875 LDKRouteHop o_conv;
39876 o_conv.inner = (void*)(o & (~1));
39877 o_conv.is_owned = false;
39878 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39879 int64_t ret_conv = RouteHop_hash(&o_conv);
39883 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
39884 LDKRouteHop a_conv;
39885 a_conv.inner = (void*)(a & (~1));
39886 a_conv.is_owned = false;
39887 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39888 LDKRouteHop b_conv;
39889 b_conv.inner = (void*)(b & (~1));
39890 b_conv.is_owned = false;
39891 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39892 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
39896 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
39897 LDKRouteHop obj_conv;
39898 obj_conv.inner = (void*)(obj & (~1));
39899 obj_conv.is_owned = false;
39900 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39901 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
39902 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39903 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39904 CVec_u8Z_free(ret_var);
39908 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
39909 LDKu8slice ser_ref;
39910 ser_ref.datalen = ser->arr_len;
39911 ser_ref.data = ser->elems /* XXX ser leaks */;
39912 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
39913 *ret_conv = RouteHop_read(ser_ref);
39914 return (uint32_t)ret_conv;
39917 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
39918 LDKRoute this_obj_conv;
39919 this_obj_conv.inner = (void*)(this_obj & (~1));
39920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39922 Route_free(this_obj_conv);
39925 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
39926 LDKRoute this_ptr_conv;
39927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39928 this_ptr_conv.is_owned = false;
39929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39930 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
39931 ptrArray ret_arr = NULL;
39932 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39933 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
39934 for (size_t m = 0; m < ret_var.datalen; m++) {
39935 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
39936 uint32_tArray ret_conv_12_arr = NULL;
39937 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
39938 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
39939 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
39940 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
39941 uint32_t ret_conv_12_conv_10_ref = 0;
39942 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39943 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
39945 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
39946 if (ret_conv_12_conv_10_var.is_owned) {
39947 ret_conv_12_conv_10_ref |= 1;
39949 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
39952 FREE(ret_conv_12_var.data);
39953 ret_arr_ptr[m] = ret_conv_12_arr;
39956 FREE(ret_var.data);
39960 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
39961 LDKRoute this_ptr_conv;
39962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39963 this_ptr_conv.is_owned = false;
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39965 LDKCVec_CVec_RouteHopZZ val_constr;
39966 val_constr.datalen = val->arr_len;
39967 if (val_constr.datalen > 0)
39968 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
39970 val_constr.data = NULL;
39971 uint32_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
39972 for (size_t m = 0; m < val_constr.datalen; m++) {
39973 uint32_tArray val_conv_12 = val_vals[m];
39974 LDKCVec_RouteHopZ val_conv_12_constr;
39975 val_conv_12_constr.datalen = val_conv_12->arr_len;
39976 if (val_conv_12_constr.datalen > 0)
39977 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
39979 val_conv_12_constr.data = NULL;
39980 uint32_t* val_conv_12_vals = val_conv_12->elems /* XXX val_conv_12 leaks */;
39981 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
39982 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
39983 LDKRouteHop val_conv_12_conv_10_conv;
39984 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
39985 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
39986 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
39987 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
39988 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
39990 val_constr.data[m] = val_conv_12_constr;
39992 Route_set_paths(&this_ptr_conv, val_constr);
39995 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
39996 LDKRoute this_ptr_conv;
39997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39998 this_ptr_conv.is_owned = false;
39999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40000 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
40001 uint32_t ret_ref = 0;
40002 if ((uintptr_t)ret_var.inner > 4096) {
40003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40006 ret_ref = (uintptr_t)ret_var.inner;
40007 if (ret_var.is_owned) {
40014 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
40015 LDKRoute this_ptr_conv;
40016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40017 this_ptr_conv.is_owned = false;
40018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40019 LDKPaymentParameters val_conv;
40020 val_conv.inner = (void*)(val & (~1));
40021 val_conv.is_owned = (val & 1) || (val == 0);
40022 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40023 val_conv = PaymentParameters_clone(&val_conv);
40024 Route_set_payment_params(&this_ptr_conv, val_conv);
40027 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
40028 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
40029 paths_arg_constr.datalen = paths_arg->arr_len;
40030 if (paths_arg_constr.datalen > 0)
40031 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40033 paths_arg_constr.data = NULL;
40034 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems /* XXX paths_arg leaks */;
40035 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
40036 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
40037 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
40038 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
40039 if (paths_arg_conv_12_constr.datalen > 0)
40040 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40042 paths_arg_conv_12_constr.data = NULL;
40043 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems /* XXX paths_arg_conv_12 leaks */;
40044 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
40045 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
40046 LDKRouteHop paths_arg_conv_12_conv_10_conv;
40047 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
40048 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
40049 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
40050 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
40051 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
40053 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
40055 LDKPaymentParameters payment_params_arg_conv;
40056 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40057 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40058 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40059 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40060 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
40061 uint32_t ret_ref = 0;
40062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40065 ret_ref = (uintptr_t)ret_var.inner;
40066 if (ret_var.is_owned) {
40072 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
40073 LDKRoute ret_var = Route_clone(arg);
40074 uint32_t ret_ref = 0;
40075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40078 ret_ref = (uintptr_t)ret_var.inner;
40079 if (ret_var.is_owned) {
40084 uint32_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
40086 arg_conv.inner = (void*)(arg & (~1));
40087 arg_conv.is_owned = false;
40088 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40089 uint32_t ret_conv = Route_clone_ptr(&arg_conv);
40093 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
40094 LDKRoute orig_conv;
40095 orig_conv.inner = (void*)(orig & (~1));
40096 orig_conv.is_owned = false;
40097 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40098 LDKRoute ret_var = Route_clone(&orig_conv);
40099 uint32_t ret_ref = 0;
40100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40103 ret_ref = (uintptr_t)ret_var.inner;
40104 if (ret_var.is_owned) {
40110 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
40112 o_conv.inner = (void*)(o & (~1));
40113 o_conv.is_owned = false;
40114 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40115 int64_t ret_conv = Route_hash(&o_conv);
40119 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
40121 a_conv.inner = (void*)(a & (~1));
40122 a_conv.is_owned = false;
40123 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40125 b_conv.inner = (void*)(b & (~1));
40126 b_conv.is_owned = false;
40127 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40128 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
40132 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
40133 LDKRoute this_arg_conv;
40134 this_arg_conv.inner = (void*)(this_arg & (~1));
40135 this_arg_conv.is_owned = false;
40136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40137 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
40141 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
40142 LDKRoute this_arg_conv;
40143 this_arg_conv.inner = (void*)(this_arg & (~1));
40144 this_arg_conv.is_owned = false;
40145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40146 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
40150 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
40152 obj_conv.inner = (void*)(obj & (~1));
40153 obj_conv.is_owned = false;
40154 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40155 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
40156 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40157 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40158 CVec_u8Z_free(ret_var);
40162 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
40163 LDKu8slice ser_ref;
40164 ser_ref.datalen = ser->arr_len;
40165 ser_ref.data = ser->elems /* XXX ser leaks */;
40166 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
40167 *ret_conv = Route_read(ser_ref);
40168 return (uint32_t)ret_conv;
40171 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
40172 LDKRouteParameters this_obj_conv;
40173 this_obj_conv.inner = (void*)(this_obj & (~1));
40174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40176 RouteParameters_free(this_obj_conv);
40179 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
40180 LDKRouteParameters this_ptr_conv;
40181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40182 this_ptr_conv.is_owned = false;
40183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40184 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
40185 uint32_t ret_ref = 0;
40186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40189 ret_ref = (uintptr_t)ret_var.inner;
40190 if (ret_var.is_owned) {
40196 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
40197 LDKRouteParameters this_ptr_conv;
40198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40199 this_ptr_conv.is_owned = false;
40200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40201 LDKPaymentParameters val_conv;
40202 val_conv.inner = (void*)(val & (~1));
40203 val_conv.is_owned = (val & 1) || (val == 0);
40204 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40205 val_conv = PaymentParameters_clone(&val_conv);
40206 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
40209 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
40210 LDKRouteParameters this_ptr_conv;
40211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40212 this_ptr_conv.is_owned = false;
40213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40214 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
40218 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
40219 LDKRouteParameters this_ptr_conv;
40220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40221 this_ptr_conv.is_owned = false;
40222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40223 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
40226 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
40227 LDKRouteParameters this_ptr_conv;
40228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40229 this_ptr_conv.is_owned = false;
40230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40231 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
40235 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) {
40236 LDKRouteParameters this_ptr_conv;
40237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40238 this_ptr_conv.is_owned = false;
40239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40240 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
40243 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) {
40244 LDKPaymentParameters payment_params_arg_conv;
40245 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40246 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40247 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40248 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40249 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
40250 uint32_t ret_ref = 0;
40251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40254 ret_ref = (uintptr_t)ret_var.inner;
40255 if (ret_var.is_owned) {
40261 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
40262 LDKRouteParameters ret_var = RouteParameters_clone(arg);
40263 uint32_t ret_ref = 0;
40264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40267 ret_ref = (uintptr_t)ret_var.inner;
40268 if (ret_var.is_owned) {
40273 uint32_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
40274 LDKRouteParameters arg_conv;
40275 arg_conv.inner = (void*)(arg & (~1));
40276 arg_conv.is_owned = false;
40277 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40278 uint32_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
40282 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
40283 LDKRouteParameters orig_conv;
40284 orig_conv.inner = (void*)(orig & (~1));
40285 orig_conv.is_owned = false;
40286 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40287 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
40288 uint32_t ret_ref = 0;
40289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40292 ret_ref = (uintptr_t)ret_var.inner;
40293 if (ret_var.is_owned) {
40299 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
40300 LDKRouteParameters obj_conv;
40301 obj_conv.inner = (void*)(obj & (~1));
40302 obj_conv.is_owned = false;
40303 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40304 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
40305 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40306 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40307 CVec_u8Z_free(ret_var);
40311 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
40312 LDKu8slice ser_ref;
40313 ser_ref.datalen = ser->arr_len;
40314 ser_ref.data = ser->elems /* XXX ser leaks */;
40315 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
40316 *ret_conv = RouteParameters_read(ser_ref);
40317 return (uint32_t)ret_conv;
40320 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
40321 LDKPaymentParameters this_obj_conv;
40322 this_obj_conv.inner = (void*)(this_obj & (~1));
40323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40325 PaymentParameters_free(this_obj_conv);
40328 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
40329 LDKPaymentParameters this_ptr_conv;
40330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40331 this_ptr_conv.is_owned = false;
40332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40333 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40334 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
40338 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
40339 LDKPaymentParameters this_ptr_conv;
40340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40341 this_ptr_conv.is_owned = false;
40342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40343 LDKPublicKey val_ref;
40344 CHECK(val->arr_len == 33);
40345 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40346 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
40349 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
40350 LDKPaymentParameters this_ptr_conv;
40351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40352 this_ptr_conv.is_owned = false;
40353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40354 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
40355 uint32_t ret_ref = 0;
40356 if ((uintptr_t)ret_var.inner > 4096) {
40357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40360 ret_ref = (uintptr_t)ret_var.inner;
40361 if (ret_var.is_owned) {
40368 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
40369 LDKPaymentParameters this_ptr_conv;
40370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40371 this_ptr_conv.is_owned = false;
40372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40373 LDKInvoiceFeatures val_conv;
40374 val_conv.inner = (void*)(val & (~1));
40375 val_conv.is_owned = (val & 1) || (val == 0);
40376 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40377 val_conv = InvoiceFeatures_clone(&val_conv);
40378 PaymentParameters_set_features(&this_ptr_conv, val_conv);
40381 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
40382 LDKPaymentParameters this_ptr_conv;
40383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40384 this_ptr_conv.is_owned = false;
40385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40386 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
40387 uint32_tArray ret_arr = NULL;
40388 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40389 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40390 for (size_t l = 0; l < ret_var.datalen; l++) {
40391 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40392 uint32_t ret_conv_11_ref = 0;
40393 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40394 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40396 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
40397 if (ret_conv_11_var.is_owned) {
40398 ret_conv_11_ref |= 1;
40400 ret_arr_ptr[l] = ret_conv_11_ref;
40403 FREE(ret_var.data);
40407 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
40408 LDKPaymentParameters this_ptr_conv;
40409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40410 this_ptr_conv.is_owned = false;
40411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40412 LDKCVec_RouteHintZ val_constr;
40413 val_constr.datalen = val->arr_len;
40414 if (val_constr.datalen > 0)
40415 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40417 val_constr.data = NULL;
40418 uint32_t* val_vals = val->elems /* XXX val leaks */;
40419 for (size_t l = 0; l < val_constr.datalen; l++) {
40420 uint32_t val_conv_11 = val_vals[l];
40421 LDKRouteHint val_conv_11_conv;
40422 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
40423 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
40424 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
40425 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
40426 val_constr.data[l] = val_conv_11_conv;
40428 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
40431 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
40432 LDKPaymentParameters this_ptr_conv;
40433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40434 this_ptr_conv.is_owned = false;
40435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40436 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40437 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
40438 uint32_t ret_ref = (uintptr_t)ret_copy;
40442 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
40443 LDKPaymentParameters this_ptr_conv;
40444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40445 this_ptr_conv.is_owned = false;
40446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40447 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40448 CHECK_ACCESS(val_ptr);
40449 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40450 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40451 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
40454 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) {
40455 LDKPaymentParameters this_ptr_conv;
40456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40457 this_ptr_conv.is_owned = false;
40458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40459 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
40463 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) {
40464 LDKPaymentParameters this_ptr_conv;
40465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40466 this_ptr_conv.is_owned = false;
40467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40468 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
40471 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) {
40472 LDKPublicKey payee_pubkey_arg_ref;
40473 CHECK(payee_pubkey_arg->arr_len == 33);
40474 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
40475 LDKInvoiceFeatures features_arg_conv;
40476 features_arg_conv.inner = (void*)(features_arg & (~1));
40477 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40478 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40479 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
40480 LDKCVec_RouteHintZ route_hints_arg_constr;
40481 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
40482 if (route_hints_arg_constr.datalen > 0)
40483 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40485 route_hints_arg_constr.data = NULL;
40486 uint32_t* route_hints_arg_vals = route_hints_arg->elems /* XXX route_hints_arg leaks */;
40487 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
40488 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
40489 LDKRouteHint route_hints_arg_conv_11_conv;
40490 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
40491 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
40492 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
40493 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
40494 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
40496 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
40497 CHECK_ACCESS(expiry_time_arg_ptr);
40498 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
40499 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
40500 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);
40501 uint32_t ret_ref = 0;
40502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40505 ret_ref = (uintptr_t)ret_var.inner;
40506 if (ret_var.is_owned) {
40512 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
40513 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
40514 uint32_t ret_ref = 0;
40515 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40516 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40517 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40518 ret_ref = (uintptr_t)ret_var.inner;
40519 if (ret_var.is_owned) {
40524 uint32_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
40525 LDKPaymentParameters arg_conv;
40526 arg_conv.inner = (void*)(arg & (~1));
40527 arg_conv.is_owned = false;
40528 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40529 uint32_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
40533 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
40534 LDKPaymentParameters orig_conv;
40535 orig_conv.inner = (void*)(orig & (~1));
40536 orig_conv.is_owned = false;
40537 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40538 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
40539 uint32_t ret_ref = 0;
40540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40543 ret_ref = (uintptr_t)ret_var.inner;
40544 if (ret_var.is_owned) {
40550 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
40551 LDKPaymentParameters o_conv;
40552 o_conv.inner = (void*)(o & (~1));
40553 o_conv.is_owned = false;
40554 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40555 int64_t ret_conv = PaymentParameters_hash(&o_conv);
40559 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
40560 LDKPaymentParameters a_conv;
40561 a_conv.inner = (void*)(a & (~1));
40562 a_conv.is_owned = false;
40563 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40564 LDKPaymentParameters b_conv;
40565 b_conv.inner = (void*)(b & (~1));
40566 b_conv.is_owned = false;
40567 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40568 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
40572 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
40573 LDKPaymentParameters obj_conv;
40574 obj_conv.inner = (void*)(obj & (~1));
40575 obj_conv.is_owned = false;
40576 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40577 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
40578 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40579 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40580 CVec_u8Z_free(ret_var);
40584 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
40585 LDKu8slice ser_ref;
40586 ser_ref.datalen = ser->arr_len;
40587 ser_ref.data = ser->elems /* XXX ser leaks */;
40588 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
40589 *ret_conv = PaymentParameters_read(ser_ref);
40590 return (uint32_t)ret_conv;
40593 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
40594 LDKPublicKey payee_pubkey_ref;
40595 CHECK(payee_pubkey->arr_len == 33);
40596 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40597 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
40598 uint32_t ret_ref = 0;
40599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40602 ret_ref = (uintptr_t)ret_var.inner;
40603 if (ret_var.is_owned) {
40609 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
40610 LDKPublicKey payee_pubkey_ref;
40611 CHECK(payee_pubkey->arr_len == 33);
40612 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40613 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
40614 uint32_t ret_ref = 0;
40615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40618 ret_ref = (uintptr_t)ret_var.inner;
40619 if (ret_var.is_owned) {
40625 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
40626 LDKRouteHint this_obj_conv;
40627 this_obj_conv.inner = (void*)(this_obj & (~1));
40628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40630 RouteHint_free(this_obj_conv);
40633 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
40634 LDKRouteHint this_ptr_conv;
40635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40636 this_ptr_conv.is_owned = false;
40637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40638 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
40639 uint32_tArray ret_arr = NULL;
40640 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40641 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40642 for (size_t o = 0; o < ret_var.datalen; o++) {
40643 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
40644 uint32_t ret_conv_14_ref = 0;
40645 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40646 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40648 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40649 if (ret_conv_14_var.is_owned) {
40650 ret_conv_14_ref |= 1;
40652 ret_arr_ptr[o] = ret_conv_14_ref;
40655 FREE(ret_var.data);
40659 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
40660 LDKRouteHint this_ptr_conv;
40661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40662 this_ptr_conv.is_owned = false;
40663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40664 LDKCVec_RouteHintHopZ val_constr;
40665 val_constr.datalen = val->arr_len;
40666 if (val_constr.datalen > 0)
40667 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40669 val_constr.data = NULL;
40670 uint32_t* val_vals = val->elems /* XXX val leaks */;
40671 for (size_t o = 0; o < val_constr.datalen; o++) {
40672 uint32_t val_conv_14 = val_vals[o];
40673 LDKRouteHintHop val_conv_14_conv;
40674 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
40675 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
40676 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
40677 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
40678 val_constr.data[o] = val_conv_14_conv;
40680 RouteHint_set_a(&this_ptr_conv, val_constr);
40683 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
40684 LDKCVec_RouteHintHopZ a_arg_constr;
40685 a_arg_constr.datalen = a_arg->arr_len;
40686 if (a_arg_constr.datalen > 0)
40687 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40689 a_arg_constr.data = NULL;
40690 uint32_t* a_arg_vals = a_arg->elems /* XXX a_arg leaks */;
40691 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
40692 uint32_t a_arg_conv_14 = a_arg_vals[o];
40693 LDKRouteHintHop a_arg_conv_14_conv;
40694 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
40695 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
40696 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
40697 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
40698 a_arg_constr.data[o] = a_arg_conv_14_conv;
40700 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
40701 uint32_t ret_ref = 0;
40702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40705 ret_ref = (uintptr_t)ret_var.inner;
40706 if (ret_var.is_owned) {
40712 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
40713 LDKRouteHint ret_var = RouteHint_clone(arg);
40714 uint32_t ret_ref = 0;
40715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40718 ret_ref = (uintptr_t)ret_var.inner;
40719 if (ret_var.is_owned) {
40724 uint32_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
40725 LDKRouteHint arg_conv;
40726 arg_conv.inner = (void*)(arg & (~1));
40727 arg_conv.is_owned = false;
40728 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40729 uint32_t ret_conv = RouteHint_clone_ptr(&arg_conv);
40733 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
40734 LDKRouteHint orig_conv;
40735 orig_conv.inner = (void*)(orig & (~1));
40736 orig_conv.is_owned = false;
40737 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40738 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
40739 uint32_t ret_ref = 0;
40740 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40741 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40743 ret_ref = (uintptr_t)ret_var.inner;
40744 if (ret_var.is_owned) {
40750 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
40751 LDKRouteHint o_conv;
40752 o_conv.inner = (void*)(o & (~1));
40753 o_conv.is_owned = false;
40754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40755 int64_t ret_conv = RouteHint_hash(&o_conv);
40759 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
40760 LDKRouteHint a_conv;
40761 a_conv.inner = (void*)(a & (~1));
40762 a_conv.is_owned = false;
40763 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40764 LDKRouteHint b_conv;
40765 b_conv.inner = (void*)(b & (~1));
40766 b_conv.is_owned = false;
40767 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40768 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
40772 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
40773 LDKRouteHint obj_conv;
40774 obj_conv.inner = (void*)(obj & (~1));
40775 obj_conv.is_owned = false;
40776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40777 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
40778 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40779 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40780 CVec_u8Z_free(ret_var);
40784 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
40785 LDKu8slice ser_ref;
40786 ser_ref.datalen = ser->arr_len;
40787 ser_ref.data = ser->elems /* XXX ser leaks */;
40788 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
40789 *ret_conv = RouteHint_read(ser_ref);
40790 return (uint32_t)ret_conv;
40793 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
40794 LDKRouteHintHop this_obj_conv;
40795 this_obj_conv.inner = (void*)(this_obj & (~1));
40796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40798 RouteHintHop_free(this_obj_conv);
40801 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
40802 LDKRouteHintHop this_ptr_conv;
40803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40804 this_ptr_conv.is_owned = false;
40805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40806 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40807 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
40811 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
40812 LDKRouteHintHop this_ptr_conv;
40813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40814 this_ptr_conv.is_owned = false;
40815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40816 LDKPublicKey val_ref;
40817 CHECK(val->arr_len == 33);
40818 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40819 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
40822 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
40823 LDKRouteHintHop this_ptr_conv;
40824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40825 this_ptr_conv.is_owned = false;
40826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40827 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
40831 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
40832 LDKRouteHintHop this_ptr_conv;
40833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40834 this_ptr_conv.is_owned = false;
40835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40836 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
40839 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
40840 LDKRouteHintHop this_ptr_conv;
40841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40842 this_ptr_conv.is_owned = false;
40843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40844 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
40845 uint32_t ret_ref = 0;
40846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40849 ret_ref = (uintptr_t)ret_var.inner;
40850 if (ret_var.is_owned) {
40856 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
40857 LDKRouteHintHop this_ptr_conv;
40858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40859 this_ptr_conv.is_owned = false;
40860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40861 LDKRoutingFees val_conv;
40862 val_conv.inner = (void*)(val & (~1));
40863 val_conv.is_owned = (val & 1) || (val == 0);
40864 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40865 val_conv = RoutingFees_clone(&val_conv);
40866 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
40869 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
40870 LDKRouteHintHop this_ptr_conv;
40871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40872 this_ptr_conv.is_owned = false;
40873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40874 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
40878 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
40879 LDKRouteHintHop this_ptr_conv;
40880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40881 this_ptr_conv.is_owned = false;
40882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40883 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
40886 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
40887 LDKRouteHintHop this_ptr_conv;
40888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40889 this_ptr_conv.is_owned = false;
40890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40891 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40892 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
40893 uint32_t ret_ref = (uintptr_t)ret_copy;
40897 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
40898 LDKRouteHintHop this_ptr_conv;
40899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40900 this_ptr_conv.is_owned = false;
40901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40902 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40903 CHECK_ACCESS(val_ptr);
40904 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40905 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40906 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
40909 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
40910 LDKRouteHintHop this_ptr_conv;
40911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40912 this_ptr_conv.is_owned = false;
40913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40914 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40915 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
40916 uint32_t ret_ref = (uintptr_t)ret_copy;
40920 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
40921 LDKRouteHintHop this_ptr_conv;
40922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40923 this_ptr_conv.is_owned = false;
40924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40925 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40926 CHECK_ACCESS(val_ptr);
40927 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40928 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40929 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
40932 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) {
40933 LDKPublicKey src_node_id_arg_ref;
40934 CHECK(src_node_id_arg->arr_len == 33);
40935 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
40936 LDKRoutingFees fees_arg_conv;
40937 fees_arg_conv.inner = (void*)(fees_arg & (~1));
40938 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
40939 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40940 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40941 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
40942 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
40943 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
40944 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
40945 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
40946 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
40947 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
40948 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
40949 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);
40950 uint32_t ret_ref = 0;
40951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40954 ret_ref = (uintptr_t)ret_var.inner;
40955 if (ret_var.is_owned) {
40961 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
40962 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
40963 uint32_t ret_ref = 0;
40964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40967 ret_ref = (uintptr_t)ret_var.inner;
40968 if (ret_var.is_owned) {
40973 uint32_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
40974 LDKRouteHintHop arg_conv;
40975 arg_conv.inner = (void*)(arg & (~1));
40976 arg_conv.is_owned = false;
40977 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40978 uint32_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
40982 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
40983 LDKRouteHintHop orig_conv;
40984 orig_conv.inner = (void*)(orig & (~1));
40985 orig_conv.is_owned = false;
40986 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40987 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
40988 uint32_t ret_ref = 0;
40989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40992 ret_ref = (uintptr_t)ret_var.inner;
40993 if (ret_var.is_owned) {
40999 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
41000 LDKRouteHintHop o_conv;
41001 o_conv.inner = (void*)(o & (~1));
41002 o_conv.is_owned = false;
41003 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41004 int64_t ret_conv = RouteHintHop_hash(&o_conv);
41008 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
41009 LDKRouteHintHop a_conv;
41010 a_conv.inner = (void*)(a & (~1));
41011 a_conv.is_owned = false;
41012 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41013 LDKRouteHintHop b_conv;
41014 b_conv.inner = (void*)(b & (~1));
41015 b_conv.is_owned = false;
41016 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41017 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
41021 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
41022 LDKRouteHintHop obj_conv;
41023 obj_conv.inner = (void*)(obj & (~1));
41024 obj_conv.is_owned = false;
41025 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41026 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
41027 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41028 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41029 CVec_u8Z_free(ret_var);
41033 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
41034 LDKu8slice ser_ref;
41035 ser_ref.datalen = ser->arr_len;
41036 ser_ref.data = ser->elems /* XXX ser leaks */;
41037 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
41038 *ret_conv = RouteHintHop_read(ser_ref);
41039 return (uint32_t)ret_conv;
41042 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) {
41043 LDKPublicKey our_node_pubkey_ref;
41044 CHECK(our_node_pubkey->arr_len == 33);
41045 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41046 LDKRouteParameters route_params_conv;
41047 route_params_conv.inner = (void*)(route_params & (~1));
41048 route_params_conv.is_owned = false;
41049 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41050 LDKNetworkGraph network_graph_conv;
41051 network_graph_conv.inner = (void*)(network_graph & (~1));
41052 network_graph_conv.is_owned = false;
41053 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41054 LDKCVec_ChannelDetailsZ first_hops_constr;
41055 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
41056 if (first_hops != 0) {
41057 first_hops_constr.datalen = first_hops->arr_len;
41058 if (first_hops_constr.datalen > 0)
41059 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41061 first_hops_constr.data = NULL;
41062 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
41063 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
41064 uint32_t first_hops_conv_16 = first_hops_vals[q];
41065 LDKChannelDetails first_hops_conv_16_conv;
41066 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
41067 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
41068 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
41069 first_hops_constr.data[q] = first_hops_conv_16_conv;
41071 first_hops_ptr = &first_hops_constr;
41073 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41074 CHECK_ACCESS(logger_ptr);
41075 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41076 if (logger_conv.free == LDKLogger_JCalls_free) {
41077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41078 LDKLogger_JCalls_cloned(&logger_conv);
41080 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
41081 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
41082 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
41083 unsigned char random_seed_bytes_arr[32];
41084 CHECK(random_seed_bytes->arr_len == 32);
41085 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41086 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41087 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41088 *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);
41089 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
41090 return (uint32_t)ret_conv;
41093 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) {
41094 LDKPublicKey our_node_pubkey_ref;
41095 CHECK(our_node_pubkey->arr_len == 33);
41096 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41097 LDKCVec_PublicKeyZ hops_constr;
41098 hops_constr.datalen = hops->arr_len;
41099 if (hops_constr.datalen > 0)
41100 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
41102 hops_constr.data = NULL;
41103 int8_tArray* hops_vals = (void*) hops->elems /* XXX hops leaks */;
41104 for (size_t m = 0; m < hops_constr.datalen; m++) {
41105 int8_tArray hops_conv_12 = hops_vals[m];
41106 LDKPublicKey hops_conv_12_ref;
41107 CHECK(hops_conv_12->arr_len == 33);
41108 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
41109 hops_constr.data[m] = hops_conv_12_ref;
41111 LDKRouteParameters route_params_conv;
41112 route_params_conv.inner = (void*)(route_params & (~1));
41113 route_params_conv.is_owned = false;
41114 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41115 LDKNetworkGraph network_graph_conv;
41116 network_graph_conv.inner = (void*)(network_graph & (~1));
41117 network_graph_conv.is_owned = false;
41118 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41119 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41120 CHECK_ACCESS(logger_ptr);
41121 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41122 if (logger_conv.free == LDKLogger_JCalls_free) {
41123 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41124 LDKLogger_JCalls_cloned(&logger_conv);
41126 unsigned char random_seed_bytes_arr[32];
41127 CHECK(random_seed_bytes->arr_len == 32);
41128 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41129 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41130 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41131 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
41132 return (uint32_t)ret_conv;
41135 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
41136 if ((this_ptr & 1) != 0) return;
41137 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41138 CHECK_ACCESS(this_ptr_ptr);
41139 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
41140 FREE((void*)this_ptr);
41141 Score_free(this_ptr_conv);
41144 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
41145 if ((this_ptr & 1) != 0) return;
41146 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41147 CHECK_ACCESS(this_ptr_ptr);
41148 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
41149 FREE((void*)this_ptr);
41150 LockableScore_free(this_ptr_conv);
41153 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
41154 LDKMultiThreadedLockableScore this_obj_conv;
41155 this_obj_conv.inner = (void*)(this_obj & (~1));
41156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41158 MultiThreadedLockableScore_free(this_obj_conv);
41161 int8_tArray __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint32_t obj) {
41162 LDKMultiThreadedLockableScore obj_conv;
41163 obj_conv.inner = (void*)(obj & (~1));
41164 obj_conv.is_owned = false;
41165 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41166 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
41167 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41168 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41169 CVec_u8Z_free(ret_var);
41173 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
41174 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
41175 CHECK_ACCESS(score_ptr);
41176 LDKScore score_conv = *(LDKScore*)(score_ptr);
41177 if (score_conv.free == LDKScore_JCalls_free) {
41178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41179 LDKScore_JCalls_cloned(&score_conv);
41181 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
41182 uint32_t ret_ref = 0;
41183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41186 ret_ref = (uintptr_t)ret_var.inner;
41187 if (ret_var.is_owned) {
41193 void __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint32_t this_obj) {
41194 LDKChannelUsage this_obj_conv;
41195 this_obj_conv.inner = (void*)(this_obj & (~1));
41196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41198 ChannelUsage_free(this_obj_conv);
41201 int64_t __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint32_t this_ptr) {
41202 LDKChannelUsage this_ptr_conv;
41203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41204 this_ptr_conv.is_owned = false;
41205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41206 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
41210 void __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint32_t this_ptr, int64_t val) {
41211 LDKChannelUsage this_ptr_conv;
41212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41213 this_ptr_conv.is_owned = false;
41214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41215 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
41218 int64_t __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint32_t this_ptr) {
41219 LDKChannelUsage this_ptr_conv;
41220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41221 this_ptr_conv.is_owned = false;
41222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41223 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
41227 void __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint32_t this_ptr, int64_t val) {
41228 LDKChannelUsage this_ptr_conv;
41229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41230 this_ptr_conv.is_owned = false;
41231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41232 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
41235 uint32_t __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint32_t this_ptr) {
41236 LDKChannelUsage this_ptr_conv;
41237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41238 this_ptr_conv.is_owned = false;
41239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41240 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41241 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
41242 uint32_t ret_ref = (uintptr_t)ret_copy;
41246 void __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint32_t this_ptr, uint32_t val) {
41247 LDKChannelUsage this_ptr_conv;
41248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41249 this_ptr_conv.is_owned = false;
41250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41251 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41252 CHECK_ACCESS(val_ptr);
41253 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
41254 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
41255 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
41258 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) {
41259 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
41260 CHECK_ACCESS(effective_capacity_arg_ptr);
41261 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
41262 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
41263 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
41264 uint32_t ret_ref = 0;
41265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41268 ret_ref = (uintptr_t)ret_var.inner;
41269 if (ret_var.is_owned) {
41275 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
41276 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
41277 uint32_t ret_ref = 0;
41278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41281 ret_ref = (uintptr_t)ret_var.inner;
41282 if (ret_var.is_owned) {
41287 uint32_t __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint32_t arg) {
41288 LDKChannelUsage arg_conv;
41289 arg_conv.inner = (void*)(arg & (~1));
41290 arg_conv.is_owned = false;
41291 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41292 uint32_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
41296 uint32_t __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint32_t orig) {
41297 LDKChannelUsage orig_conv;
41298 orig_conv.inner = (void*)(orig & (~1));
41299 orig_conv.is_owned = false;
41300 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41301 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
41302 uint32_t ret_ref = 0;
41303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41306 ret_ref = (uintptr_t)ret_var.inner;
41307 if (ret_var.is_owned) {
41313 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
41314 LDKFixedPenaltyScorer this_obj_conv;
41315 this_obj_conv.inner = (void*)(this_obj & (~1));
41316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41318 FixedPenaltyScorer_free(this_obj_conv);
41321 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
41322 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
41323 uint32_t ret_ref = 0;
41324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41327 ret_ref = (uintptr_t)ret_var.inner;
41328 if (ret_var.is_owned) {
41333 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
41334 LDKFixedPenaltyScorer arg_conv;
41335 arg_conv.inner = (void*)(arg & (~1));
41336 arg_conv.is_owned = false;
41337 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41338 uint32_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
41342 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
41343 LDKFixedPenaltyScorer orig_conv;
41344 orig_conv.inner = (void*)(orig & (~1));
41345 orig_conv.is_owned = false;
41346 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41347 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
41348 uint32_t ret_ref = 0;
41349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41352 ret_ref = (uintptr_t)ret_var.inner;
41353 if (ret_var.is_owned) {
41359 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
41360 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
41361 uint32_t ret_ref = 0;
41362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41365 ret_ref = (uintptr_t)ret_var.inner;
41366 if (ret_var.is_owned) {
41372 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
41373 LDKFixedPenaltyScorer this_arg_conv;
41374 this_arg_conv.inner = (void*)(this_arg & (~1));
41375 this_arg_conv.is_owned = false;
41376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41377 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41378 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
41379 return (uint32_t)ret_ret;
41382 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
41383 LDKFixedPenaltyScorer obj_conv;
41384 obj_conv.inner = (void*)(obj & (~1));
41385 obj_conv.is_owned = false;
41386 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41387 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
41388 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41389 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41390 CVec_u8Z_free(ret_var);
41394 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
41395 LDKu8slice ser_ref;
41396 ser_ref.datalen = ser->arr_len;
41397 ser_ref.data = ser->elems /* XXX ser leaks */;
41398 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
41399 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
41400 return (uint32_t)ret_conv;
41403 void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint32_t this_obj) {
41404 LDKProbabilisticScorer this_obj_conv;
41405 this_obj_conv.inner = (void*)(this_obj & (~1));
41406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41408 ProbabilisticScorer_free(this_obj_conv);
41411 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
41412 LDKProbabilisticScoringParameters this_obj_conv;
41413 this_obj_conv.inner = (void*)(this_obj & (~1));
41414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41416 ProbabilisticScoringParameters_free(this_obj_conv);
41419 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
41420 LDKProbabilisticScoringParameters this_ptr_conv;
41421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41422 this_ptr_conv.is_owned = false;
41423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41424 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
41428 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
41429 LDKProbabilisticScoringParameters this_ptr_conv;
41430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41431 this_ptr_conv.is_owned = false;
41432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41433 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
41436 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
41437 LDKProbabilisticScoringParameters this_ptr_conv;
41438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41439 this_ptr_conv.is_owned = false;
41440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41441 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
41445 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) {
41446 LDKProbabilisticScoringParameters this_ptr_conv;
41447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41448 this_ptr_conv.is_owned = false;
41449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41450 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
41453 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
41454 LDKProbabilisticScoringParameters this_ptr_conv;
41455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41456 this_ptr_conv.is_owned = false;
41457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41458 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
41462 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) {
41463 LDKProbabilisticScoringParameters this_ptr_conv;
41464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41465 this_ptr_conv.is_owned = false;
41466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41467 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
41470 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(uint32_t this_ptr) {
41471 LDKProbabilisticScoringParameters this_ptr_conv;
41472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41473 this_ptr_conv.is_owned = false;
41474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41475 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
41479 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(uint32_t this_ptr, int64_t val) {
41480 LDKProbabilisticScoringParameters this_ptr_conv;
41481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41482 this_ptr_conv.is_owned = false;
41483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41484 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
41487 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_new"))) TS_ProbabilisticScoringParameters_new(int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) {
41488 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
41489 uint32_t ret_ref = 0;
41490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41493 ret_ref = (uintptr_t)ret_var.inner;
41494 if (ret_var.is_owned) {
41500 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
41501 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
41502 uint32_t ret_ref = 0;
41503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41506 ret_ref = (uintptr_t)ret_var.inner;
41507 if (ret_var.is_owned) {
41512 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
41513 LDKProbabilisticScoringParameters arg_conv;
41514 arg_conv.inner = (void*)(arg & (~1));
41515 arg_conv.is_owned = false;
41516 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41517 uint32_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
41521 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
41522 LDKProbabilisticScoringParameters orig_conv;
41523 orig_conv.inner = (void*)(orig & (~1));
41524 orig_conv.is_owned = false;
41525 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41526 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
41527 uint32_t ret_ref = 0;
41528 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41529 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41531 ret_ref = (uintptr_t)ret_var.inner;
41532 if (ret_var.is_owned) {
41538 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint32_t params, uint32_t network_graph, uint32_t logger) {
41539 LDKProbabilisticScoringParameters params_conv;
41540 params_conv.inner = (void*)(params & (~1));
41541 params_conv.is_owned = (params & 1) || (params == 0);
41542 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41543 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
41544 LDKNetworkGraph network_graph_conv;
41545 network_graph_conv.inner = (void*)(network_graph & (~1));
41546 network_graph_conv.is_owned = false;
41547 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41548 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41549 CHECK_ACCESS(logger_ptr);
41550 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41551 if (logger_conv.free == LDKLogger_JCalls_free) {
41552 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41553 LDKLogger_JCalls_cloned(&logger_conv);
41555 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
41556 uint32_t ret_ref = 0;
41557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41560 ret_ref = (uintptr_t)ret_var.inner;
41561 if (ret_var.is_owned) {
41567 void __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint32_t this_arg) {
41568 LDKProbabilisticScorer this_arg_conv;
41569 this_arg_conv.inner = (void*)(this_arg & (~1));
41570 this_arg_conv.is_owned = false;
41571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41572 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
41575 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
41576 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
41577 uint32_t ret_ref = 0;
41578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41581 ret_ref = (uintptr_t)ret_var.inner;
41582 if (ret_var.is_owned) {
41588 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint32_t this_arg) {
41589 LDKProbabilisticScorer this_arg_conv;
41590 this_arg_conv.inner = (void*)(this_arg & (~1));
41591 this_arg_conv.is_owned = false;
41592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41593 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41594 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
41595 return (uint32_t)ret_ret;
41598 int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint32_t obj) {
41599 LDKProbabilisticScorer obj_conv;
41600 obj_conv.inner = (void*)(obj & (~1));
41601 obj_conv.is_owned = false;
41602 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41603 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
41604 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41605 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41606 CVec_u8Z_free(ret_var);
41610 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) {
41611 LDKu8slice ser_ref;
41612 ser_ref.datalen = ser->arr_len;
41613 ser_ref.data = ser->elems /* XXX ser leaks */;
41614 LDKProbabilisticScoringParameters arg_a_conv;
41615 arg_a_conv.inner = (void*)(arg_a & (~1));
41616 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
41617 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
41618 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
41619 LDKNetworkGraph arg_b_conv;
41620 arg_b_conv.inner = (void*)(arg_b & (~1));
41621 arg_b_conv.is_owned = false;
41622 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
41623 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
41624 CHECK_ACCESS(arg_c_ptr);
41625 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
41626 if (arg_c_conv.free == LDKLogger_JCalls_free) {
41627 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41628 LDKLogger_JCalls_cloned(&arg_c_conv);
41630 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
41631 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
41632 return (uint32_t)ret_conv;
41635 void __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint32_t this_ptr) {
41636 if ((this_ptr & 1) != 0) return;
41637 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41638 CHECK_ACCESS(this_ptr_ptr);
41639 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
41640 FREE((void*)this_ptr);
41641 ParseError_free(this_ptr_conv);
41644 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
41645 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41646 *ret_copy = ParseError_clone(arg);
41647 uint32_t ret_ref = (uintptr_t)ret_copy;
41650 uint32_t __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint32_t arg) {
41651 LDKParseError* arg_conv = (LDKParseError*)arg;
41652 uint32_t ret_conv = ParseError_clone_ptr(arg_conv);
41656 uint32_t __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint32_t orig) {
41657 LDKParseError* orig_conv = (LDKParseError*)orig;
41658 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41659 *ret_copy = ParseError_clone(orig_conv);
41660 uint32_t ret_ref = (uintptr_t)ret_copy;
41664 uint32_t __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint32_t a) {
41665 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
41666 CHECK_ACCESS(a_ptr);
41667 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
41668 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
41669 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41670 *ret_copy = ParseError_bech32_error(a_conv);
41671 uint32_t ret_ref = (uintptr_t)ret_copy;
41675 uint32_t __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
41677 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41678 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
41679 uint32_t ret_ref = (uintptr_t)ret_copy;
41683 uint32_t __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
41684 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
41685 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41686 *ret_copy = ParseError_malformed_signature(a_conv);
41687 uint32_t ret_ref = (uintptr_t)ret_copy;
41691 uint32_t __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
41692 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41693 *ret_copy = ParseError_bad_prefix();
41694 uint32_t ret_ref = (uintptr_t)ret_copy;
41698 uint32_t __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
41699 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41700 *ret_copy = ParseError_unknown_currency();
41701 uint32_t ret_ref = (uintptr_t)ret_copy;
41705 uint32_t __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
41706 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41707 *ret_copy = ParseError_unknown_si_prefix();
41708 uint32_t ret_ref = (uintptr_t)ret_copy;
41712 uint32_t __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
41713 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41714 *ret_copy = ParseError_malformed_hrp();
41715 uint32_t ret_ref = (uintptr_t)ret_copy;
41719 uint32_t __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
41720 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41721 *ret_copy = ParseError_too_short_data_part();
41722 uint32_t ret_ref = (uintptr_t)ret_copy;
41726 uint32_t __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
41727 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41728 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
41729 uint32_t ret_ref = (uintptr_t)ret_copy;
41733 uint32_t __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
41735 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41736 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
41737 uint32_t ret_ref = (uintptr_t)ret_copy;
41741 uint32_t __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
41742 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41743 *ret_copy = ParseError_padding_error();
41744 uint32_t ret_ref = (uintptr_t)ret_copy;
41748 uint32_t __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
41749 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41750 *ret_copy = ParseError_integer_overflow_error();
41751 uint32_t ret_ref = (uintptr_t)ret_copy;
41755 uint32_t __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
41756 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41757 *ret_copy = ParseError_invalid_seg_wit_program_length();
41758 uint32_t ret_ref = (uintptr_t)ret_copy;
41762 uint32_t __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
41763 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41764 *ret_copy = ParseError_invalid_pub_key_hash_length();
41765 uint32_t ret_ref = (uintptr_t)ret_copy;
41769 uint32_t __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
41770 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41771 *ret_copy = ParseError_invalid_script_hash_length();
41772 uint32_t ret_ref = (uintptr_t)ret_copy;
41776 uint32_t __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
41777 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41778 *ret_copy = ParseError_invalid_recovery_id();
41779 uint32_t ret_ref = (uintptr_t)ret_copy;
41783 uint32_t __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
41784 LDKStr a_conv = str_ref_to_owned_c(a);
41785 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41786 *ret_copy = ParseError_invalid_slice_length(a_conv);
41787 uint32_t ret_ref = (uintptr_t)ret_copy;
41791 uint32_t __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
41792 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41793 *ret_copy = ParseError_skip();
41794 uint32_t ret_ref = (uintptr_t)ret_copy;
41798 void __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint32_t this_ptr) {
41799 if ((this_ptr & 1) != 0) return;
41800 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41801 CHECK_ACCESS(this_ptr_ptr);
41802 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
41803 FREE((void*)this_ptr);
41804 ParseOrSemanticError_free(this_ptr_conv);
41807 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
41808 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41809 *ret_copy = ParseOrSemanticError_clone(arg);
41810 uint32_t ret_ref = (uintptr_t)ret_copy;
41813 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint32_t arg) {
41814 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
41815 uint32_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
41819 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint32_t orig) {
41820 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
41821 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41822 *ret_copy = ParseOrSemanticError_clone(orig_conv);
41823 uint32_t ret_ref = (uintptr_t)ret_copy;
41827 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint32_t a) {
41828 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
41829 CHECK_ACCESS(a_ptr);
41830 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
41831 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
41832 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41833 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
41834 uint32_t ret_ref = (uintptr_t)ret_copy;
41838 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
41839 LDKSemanticError a_conv = LDKSemanticError_from_js(a);
41840 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41841 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
41842 uint32_t ret_ref = (uintptr_t)ret_copy;
41846 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
41847 LDKInvoice this_obj_conv;
41848 this_obj_conv.inner = (void*)(this_obj & (~1));
41849 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41851 Invoice_free(this_obj_conv);
41854 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
41856 a_conv.inner = (void*)(a & (~1));
41857 a_conv.is_owned = false;
41858 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41860 b_conv.inner = (void*)(b & (~1));
41861 b_conv.is_owned = false;
41862 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41863 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
41867 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
41868 LDKInvoice ret_var = Invoice_clone(arg);
41869 uint32_t ret_ref = 0;
41870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41873 ret_ref = (uintptr_t)ret_var.inner;
41874 if (ret_var.is_owned) {
41879 uint32_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
41880 LDKInvoice arg_conv;
41881 arg_conv.inner = (void*)(arg & (~1));
41882 arg_conv.is_owned = false;
41883 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41884 uint32_t ret_conv = Invoice_clone_ptr(&arg_conv);
41888 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
41889 LDKInvoice orig_conv;
41890 orig_conv.inner = (void*)(orig & (~1));
41891 orig_conv.is_owned = false;
41892 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41893 LDKInvoice ret_var = Invoice_clone(&orig_conv);
41894 uint32_t ret_ref = 0;
41895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41898 ret_ref = (uintptr_t)ret_var.inner;
41899 if (ret_var.is_owned) {
41905 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
41906 LDKSignedRawInvoice this_obj_conv;
41907 this_obj_conv.inner = (void*)(this_obj & (~1));
41908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41910 SignedRawInvoice_free(this_obj_conv);
41913 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
41914 LDKSignedRawInvoice a_conv;
41915 a_conv.inner = (void*)(a & (~1));
41916 a_conv.is_owned = false;
41917 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41918 LDKSignedRawInvoice b_conv;
41919 b_conv.inner = (void*)(b & (~1));
41920 b_conv.is_owned = false;
41921 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41922 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
41926 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
41927 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
41928 uint32_t ret_ref = 0;
41929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41932 ret_ref = (uintptr_t)ret_var.inner;
41933 if (ret_var.is_owned) {
41938 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
41939 LDKSignedRawInvoice arg_conv;
41940 arg_conv.inner = (void*)(arg & (~1));
41941 arg_conv.is_owned = false;
41942 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41943 uint32_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
41947 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
41948 LDKSignedRawInvoice orig_conv;
41949 orig_conv.inner = (void*)(orig & (~1));
41950 orig_conv.is_owned = false;
41951 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41952 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
41953 uint32_t ret_ref = 0;
41954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41957 ret_ref = (uintptr_t)ret_var.inner;
41958 if (ret_var.is_owned) {
41964 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
41965 LDKRawInvoice this_obj_conv;
41966 this_obj_conv.inner = (void*)(this_obj & (~1));
41967 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41969 RawInvoice_free(this_obj_conv);
41972 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
41973 LDKRawInvoice this_ptr_conv;
41974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41975 this_ptr_conv.is_owned = false;
41976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41977 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
41978 uint32_t ret_ref = 0;
41979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41982 ret_ref = (uintptr_t)ret_var.inner;
41983 if (ret_var.is_owned) {
41989 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
41990 LDKRawInvoice this_ptr_conv;
41991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41992 this_ptr_conv.is_owned = false;
41993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41994 LDKRawDataPart val_conv;
41995 val_conv.inner = (void*)(val & (~1));
41996 val_conv.is_owned = (val & 1) || (val == 0);
41997 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41998 val_conv = RawDataPart_clone(&val_conv);
41999 RawInvoice_set_data(&this_ptr_conv, val_conv);
42002 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
42003 LDKRawInvoice a_conv;
42004 a_conv.inner = (void*)(a & (~1));
42005 a_conv.is_owned = false;
42006 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42007 LDKRawInvoice b_conv;
42008 b_conv.inner = (void*)(b & (~1));
42009 b_conv.is_owned = false;
42010 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42011 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
42015 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
42016 LDKRawInvoice ret_var = RawInvoice_clone(arg);
42017 uint32_t ret_ref = 0;
42018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42021 ret_ref = (uintptr_t)ret_var.inner;
42022 if (ret_var.is_owned) {
42027 uint32_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
42028 LDKRawInvoice arg_conv;
42029 arg_conv.inner = (void*)(arg & (~1));
42030 arg_conv.is_owned = false;
42031 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42032 uint32_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
42036 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
42037 LDKRawInvoice orig_conv;
42038 orig_conv.inner = (void*)(orig & (~1));
42039 orig_conv.is_owned = false;
42040 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42041 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
42042 uint32_t ret_ref = 0;
42043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42046 ret_ref = (uintptr_t)ret_var.inner;
42047 if (ret_var.is_owned) {
42053 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
42054 LDKRawDataPart this_obj_conv;
42055 this_obj_conv.inner = (void*)(this_obj & (~1));
42056 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42058 RawDataPart_free(this_obj_conv);
42061 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
42062 LDKRawDataPart this_ptr_conv;
42063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42064 this_ptr_conv.is_owned = false;
42065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42066 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
42067 uint32_t ret_ref = 0;
42068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42071 ret_ref = (uintptr_t)ret_var.inner;
42072 if (ret_var.is_owned) {
42078 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
42079 LDKRawDataPart this_ptr_conv;
42080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42081 this_ptr_conv.is_owned = false;
42082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42083 LDKPositiveTimestamp val_conv;
42084 val_conv.inner = (void*)(val & (~1));
42085 val_conv.is_owned = (val & 1) || (val == 0);
42086 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42087 val_conv = PositiveTimestamp_clone(&val_conv);
42088 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
42091 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
42092 LDKRawDataPart a_conv;
42093 a_conv.inner = (void*)(a & (~1));
42094 a_conv.is_owned = false;
42095 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42096 LDKRawDataPart b_conv;
42097 b_conv.inner = (void*)(b & (~1));
42098 b_conv.is_owned = false;
42099 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42100 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
42104 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
42105 LDKRawDataPart ret_var = RawDataPart_clone(arg);
42106 uint32_t ret_ref = 0;
42107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42110 ret_ref = (uintptr_t)ret_var.inner;
42111 if (ret_var.is_owned) {
42116 uint32_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
42117 LDKRawDataPart arg_conv;
42118 arg_conv.inner = (void*)(arg & (~1));
42119 arg_conv.is_owned = false;
42120 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42121 uint32_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
42125 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
42126 LDKRawDataPart orig_conv;
42127 orig_conv.inner = (void*)(orig & (~1));
42128 orig_conv.is_owned = false;
42129 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42130 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
42131 uint32_t ret_ref = 0;
42132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135 ret_ref = (uintptr_t)ret_var.inner;
42136 if (ret_var.is_owned) {
42142 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
42143 LDKPositiveTimestamp this_obj_conv;
42144 this_obj_conv.inner = (void*)(this_obj & (~1));
42145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42147 PositiveTimestamp_free(this_obj_conv);
42150 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
42151 LDKPositiveTimestamp a_conv;
42152 a_conv.inner = (void*)(a & (~1));
42153 a_conv.is_owned = false;
42154 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42155 LDKPositiveTimestamp b_conv;
42156 b_conv.inner = (void*)(b & (~1));
42157 b_conv.is_owned = false;
42158 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42159 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
42163 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
42164 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
42165 uint32_t ret_ref = 0;
42166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42169 ret_ref = (uintptr_t)ret_var.inner;
42170 if (ret_var.is_owned) {
42175 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
42176 LDKPositiveTimestamp arg_conv;
42177 arg_conv.inner = (void*)(arg & (~1));
42178 arg_conv.is_owned = false;
42179 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42180 uint32_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
42184 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
42185 LDKPositiveTimestamp orig_conv;
42186 orig_conv.inner = (void*)(orig & (~1));
42187 orig_conv.is_owned = false;
42188 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42189 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
42190 uint32_t ret_ref = 0;
42191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42194 ret_ref = (uintptr_t)ret_var.inner;
42195 if (ret_var.is_owned) {
42201 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
42202 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
42203 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
42207 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
42208 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
42212 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
42213 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
42217 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
42218 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
42222 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
42223 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
42227 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
42228 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
42229 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
42230 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
42234 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
42235 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
42236 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
42240 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
42241 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
42242 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
42246 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
42247 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
42251 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
42252 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
42256 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
42257 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
42261 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
42262 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
42266 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
42267 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
42271 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
42272 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
42273 int64_t ret_conv = Currency_hash(o_conv);
42277 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
42278 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
42279 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
42280 jboolean ret_conv = Currency_eq(a_conv, b_conv);
42284 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
42285 LDKSha256 this_obj_conv;
42286 this_obj_conv.inner = (void*)(this_obj & (~1));
42287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42289 Sha256_free(this_obj_conv);
42292 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
42293 LDKSha256 ret_var = Sha256_clone(arg);
42294 uint32_t ret_ref = 0;
42295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42298 ret_ref = (uintptr_t)ret_var.inner;
42299 if (ret_var.is_owned) {
42304 uint32_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
42305 LDKSha256 arg_conv;
42306 arg_conv.inner = (void*)(arg & (~1));
42307 arg_conv.is_owned = false;
42308 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42309 uint32_t ret_conv = Sha256_clone_ptr(&arg_conv);
42313 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
42314 LDKSha256 orig_conv;
42315 orig_conv.inner = (void*)(orig & (~1));
42316 orig_conv.is_owned = false;
42317 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42318 LDKSha256 ret_var = Sha256_clone(&orig_conv);
42319 uint32_t ret_ref = 0;
42320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42323 ret_ref = (uintptr_t)ret_var.inner;
42324 if (ret_var.is_owned) {
42330 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
42332 o_conv.inner = (void*)(o & (~1));
42333 o_conv.is_owned = false;
42334 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42335 int64_t ret_conv = Sha256_hash(&o_conv);
42339 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
42341 a_conv.inner = (void*)(a & (~1));
42342 a_conv.is_owned = false;
42343 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42345 b_conv.inner = (void*)(b & (~1));
42346 b_conv.is_owned = false;
42347 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42348 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
42352 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
42353 LDKDescription this_obj_conv;
42354 this_obj_conv.inner = (void*)(this_obj & (~1));
42355 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42357 Description_free(this_obj_conv);
42360 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
42361 LDKDescription ret_var = Description_clone(arg);
42362 uint32_t ret_ref = 0;
42363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42366 ret_ref = (uintptr_t)ret_var.inner;
42367 if (ret_var.is_owned) {
42372 uint32_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
42373 LDKDescription arg_conv;
42374 arg_conv.inner = (void*)(arg & (~1));
42375 arg_conv.is_owned = false;
42376 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42377 uint32_t ret_conv = Description_clone_ptr(&arg_conv);
42381 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
42382 LDKDescription orig_conv;
42383 orig_conv.inner = (void*)(orig & (~1));
42384 orig_conv.is_owned = false;
42385 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42386 LDKDescription ret_var = Description_clone(&orig_conv);
42387 uint32_t ret_ref = 0;
42388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42391 ret_ref = (uintptr_t)ret_var.inner;
42392 if (ret_var.is_owned) {
42398 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
42399 LDKDescription o_conv;
42400 o_conv.inner = (void*)(o & (~1));
42401 o_conv.is_owned = false;
42402 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42403 int64_t ret_conv = Description_hash(&o_conv);
42407 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
42408 LDKDescription a_conv;
42409 a_conv.inner = (void*)(a & (~1));
42410 a_conv.is_owned = false;
42411 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42412 LDKDescription b_conv;
42413 b_conv.inner = (void*)(b & (~1));
42414 b_conv.is_owned = false;
42415 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42416 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
42420 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
42421 LDKPayeePubKey this_obj_conv;
42422 this_obj_conv.inner = (void*)(this_obj & (~1));
42423 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42425 PayeePubKey_free(this_obj_conv);
42428 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
42429 LDKPayeePubKey this_ptr_conv;
42430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42431 this_ptr_conv.is_owned = false;
42432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42433 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42434 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
42438 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
42439 LDKPayeePubKey this_ptr_conv;
42440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42441 this_ptr_conv.is_owned = false;
42442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42443 LDKPublicKey val_ref;
42444 CHECK(val->arr_len == 33);
42445 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42446 PayeePubKey_set_a(&this_ptr_conv, val_ref);
42449 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
42450 LDKPublicKey a_arg_ref;
42451 CHECK(a_arg->arr_len == 33);
42452 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
42453 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
42454 uint32_t ret_ref = 0;
42455 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42456 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42458 ret_ref = (uintptr_t)ret_var.inner;
42459 if (ret_var.is_owned) {
42465 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
42466 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
42467 uint32_t ret_ref = 0;
42468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42471 ret_ref = (uintptr_t)ret_var.inner;
42472 if (ret_var.is_owned) {
42477 uint32_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
42478 LDKPayeePubKey arg_conv;
42479 arg_conv.inner = (void*)(arg & (~1));
42480 arg_conv.is_owned = false;
42481 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42482 uint32_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
42486 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
42487 LDKPayeePubKey orig_conv;
42488 orig_conv.inner = (void*)(orig & (~1));
42489 orig_conv.is_owned = false;
42490 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42491 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
42492 uint32_t ret_ref = 0;
42493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42496 ret_ref = (uintptr_t)ret_var.inner;
42497 if (ret_var.is_owned) {
42503 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
42504 LDKPayeePubKey o_conv;
42505 o_conv.inner = (void*)(o & (~1));
42506 o_conv.is_owned = false;
42507 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42508 int64_t ret_conv = PayeePubKey_hash(&o_conv);
42512 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
42513 LDKPayeePubKey a_conv;
42514 a_conv.inner = (void*)(a & (~1));
42515 a_conv.is_owned = false;
42516 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42517 LDKPayeePubKey b_conv;
42518 b_conv.inner = (void*)(b & (~1));
42519 b_conv.is_owned = false;
42520 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42521 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
42525 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
42526 LDKExpiryTime this_obj_conv;
42527 this_obj_conv.inner = (void*)(this_obj & (~1));
42528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42530 ExpiryTime_free(this_obj_conv);
42533 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
42534 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
42535 uint32_t ret_ref = 0;
42536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42539 ret_ref = (uintptr_t)ret_var.inner;
42540 if (ret_var.is_owned) {
42545 uint32_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
42546 LDKExpiryTime arg_conv;
42547 arg_conv.inner = (void*)(arg & (~1));
42548 arg_conv.is_owned = false;
42549 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42550 uint32_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
42554 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
42555 LDKExpiryTime orig_conv;
42556 orig_conv.inner = (void*)(orig & (~1));
42557 orig_conv.is_owned = false;
42558 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42559 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
42560 uint32_t ret_ref = 0;
42561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42564 ret_ref = (uintptr_t)ret_var.inner;
42565 if (ret_var.is_owned) {
42571 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
42572 LDKExpiryTime o_conv;
42573 o_conv.inner = (void*)(o & (~1));
42574 o_conv.is_owned = false;
42575 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42576 int64_t ret_conv = ExpiryTime_hash(&o_conv);
42580 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
42581 LDKExpiryTime a_conv;
42582 a_conv.inner = (void*)(a & (~1));
42583 a_conv.is_owned = false;
42584 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42585 LDKExpiryTime b_conv;
42586 b_conv.inner = (void*)(b & (~1));
42587 b_conv.is_owned = false;
42588 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42589 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
42593 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
42594 LDKMinFinalCltvExpiry this_obj_conv;
42595 this_obj_conv.inner = (void*)(this_obj & (~1));
42596 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42598 MinFinalCltvExpiry_free(this_obj_conv);
42601 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
42602 LDKMinFinalCltvExpiry this_ptr_conv;
42603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42604 this_ptr_conv.is_owned = false;
42605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42606 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
42610 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
42611 LDKMinFinalCltvExpiry this_ptr_conv;
42612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42613 this_ptr_conv.is_owned = false;
42614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42615 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
42618 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
42619 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
42620 uint32_t ret_ref = 0;
42621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42624 ret_ref = (uintptr_t)ret_var.inner;
42625 if (ret_var.is_owned) {
42631 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
42632 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
42633 uint32_t ret_ref = 0;
42634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42637 ret_ref = (uintptr_t)ret_var.inner;
42638 if (ret_var.is_owned) {
42643 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
42644 LDKMinFinalCltvExpiry arg_conv;
42645 arg_conv.inner = (void*)(arg & (~1));
42646 arg_conv.is_owned = false;
42647 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42648 uint32_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
42652 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
42653 LDKMinFinalCltvExpiry orig_conv;
42654 orig_conv.inner = (void*)(orig & (~1));
42655 orig_conv.is_owned = false;
42656 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42657 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
42658 uint32_t ret_ref = 0;
42659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42662 ret_ref = (uintptr_t)ret_var.inner;
42663 if (ret_var.is_owned) {
42669 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
42670 LDKMinFinalCltvExpiry o_conv;
42671 o_conv.inner = (void*)(o & (~1));
42672 o_conv.is_owned = false;
42673 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42674 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
42678 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
42679 LDKMinFinalCltvExpiry a_conv;
42680 a_conv.inner = (void*)(a & (~1));
42681 a_conv.is_owned = false;
42682 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42683 LDKMinFinalCltvExpiry b_conv;
42684 b_conv.inner = (void*)(b & (~1));
42685 b_conv.is_owned = false;
42686 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42687 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
42691 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
42692 if ((this_ptr & 1) != 0) return;
42693 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42694 CHECK_ACCESS(this_ptr_ptr);
42695 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
42696 FREE((void*)this_ptr);
42697 Fallback_free(this_ptr_conv);
42700 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
42701 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42702 *ret_copy = Fallback_clone(arg);
42703 uint32_t ret_ref = (uintptr_t)ret_copy;
42706 uint32_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
42707 LDKFallback* arg_conv = (LDKFallback*)arg;
42708 uint32_t ret_conv = Fallback_clone_ptr(arg_conv);
42712 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
42713 LDKFallback* orig_conv = (LDKFallback*)orig;
42714 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42715 *ret_copy = Fallback_clone(orig_conv);
42716 uint32_t ret_ref = (uintptr_t)ret_copy;
42720 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
42722 LDKCVec_u8Z program_ref;
42723 program_ref.datalen = program->arr_len;
42724 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
42725 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
42726 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42727 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
42728 uint32_t ret_ref = (uintptr_t)ret_copy;
42732 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
42733 LDKTwentyBytes a_ref;
42734 CHECK(a->arr_len == 20);
42735 memcpy(a_ref.data, a->elems, 20); FREE(a);
42736 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42737 *ret_copy = Fallback_pub_key_hash(a_ref);
42738 uint32_t ret_ref = (uintptr_t)ret_copy;
42742 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
42743 LDKTwentyBytes a_ref;
42744 CHECK(a->arr_len == 20);
42745 memcpy(a_ref.data, a->elems, 20); FREE(a);
42746 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42747 *ret_copy = Fallback_script_hash(a_ref);
42748 uint32_t ret_ref = (uintptr_t)ret_copy;
42752 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
42753 LDKFallback* o_conv = (LDKFallback*)o;
42754 int64_t ret_conv = Fallback_hash(o_conv);
42758 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
42759 LDKFallback* a_conv = (LDKFallback*)a;
42760 LDKFallback* b_conv = (LDKFallback*)b;
42761 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
42765 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
42766 LDKInvoiceSignature this_obj_conv;
42767 this_obj_conv.inner = (void*)(this_obj & (~1));
42768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42770 InvoiceSignature_free(this_obj_conv);
42773 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
42774 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
42775 uint32_t ret_ref = 0;
42776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42779 ret_ref = (uintptr_t)ret_var.inner;
42780 if (ret_var.is_owned) {
42785 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
42786 LDKInvoiceSignature arg_conv;
42787 arg_conv.inner = (void*)(arg & (~1));
42788 arg_conv.is_owned = false;
42789 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42790 uint32_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
42794 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
42795 LDKInvoiceSignature orig_conv;
42796 orig_conv.inner = (void*)(orig & (~1));
42797 orig_conv.is_owned = false;
42798 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42799 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
42800 uint32_t ret_ref = 0;
42801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42804 ret_ref = (uintptr_t)ret_var.inner;
42805 if (ret_var.is_owned) {
42811 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
42812 LDKInvoiceSignature a_conv;
42813 a_conv.inner = (void*)(a & (~1));
42814 a_conv.is_owned = false;
42815 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42816 LDKInvoiceSignature b_conv;
42817 b_conv.inner = (void*)(b & (~1));
42818 b_conv.is_owned = false;
42819 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42820 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
42824 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
42825 LDKPrivateRoute this_obj_conv;
42826 this_obj_conv.inner = (void*)(this_obj & (~1));
42827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42829 PrivateRoute_free(this_obj_conv);
42832 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
42833 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
42834 uint32_t ret_ref = 0;
42835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42838 ret_ref = (uintptr_t)ret_var.inner;
42839 if (ret_var.is_owned) {
42844 uint32_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
42845 LDKPrivateRoute arg_conv;
42846 arg_conv.inner = (void*)(arg & (~1));
42847 arg_conv.is_owned = false;
42848 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42849 uint32_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
42853 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
42854 LDKPrivateRoute orig_conv;
42855 orig_conv.inner = (void*)(orig & (~1));
42856 orig_conv.is_owned = false;
42857 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42858 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
42859 uint32_t ret_ref = 0;
42860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42863 ret_ref = (uintptr_t)ret_var.inner;
42864 if (ret_var.is_owned) {
42870 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
42871 LDKPrivateRoute o_conv;
42872 o_conv.inner = (void*)(o & (~1));
42873 o_conv.is_owned = false;
42874 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42875 int64_t ret_conv = PrivateRoute_hash(&o_conv);
42879 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
42880 LDKPrivateRoute a_conv;
42881 a_conv.inner = (void*)(a & (~1));
42882 a_conv.is_owned = false;
42883 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42884 LDKPrivateRoute b_conv;
42885 b_conv.inner = (void*)(b & (~1));
42886 b_conv.is_owned = false;
42887 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42888 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
42892 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
42893 LDKSignedRawInvoice this_arg_conv;
42894 this_arg_conv.inner = (void*)(this_arg & (~1));
42895 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42897 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
42898 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
42899 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
42900 return ((uint32_t)ret_conv);
42903 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
42904 LDKSignedRawInvoice this_arg_conv;
42905 this_arg_conv.inner = (void*)(this_arg & (~1));
42906 this_arg_conv.is_owned = false;
42907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42908 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
42909 uint32_t ret_ref = 0;
42910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42913 ret_ref = (uintptr_t)ret_var.inner;
42914 if (ret_var.is_owned) {
42920 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
42921 LDKSignedRawInvoice this_arg_conv;
42922 this_arg_conv.inner = (void*)(this_arg & (~1));
42923 this_arg_conv.is_owned = false;
42924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42925 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42926 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
42930 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
42931 LDKSignedRawInvoice this_arg_conv;
42932 this_arg_conv.inner = (void*)(this_arg & (~1));
42933 this_arg_conv.is_owned = false;
42934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42935 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
42936 uint32_t ret_ref = 0;
42937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42940 ret_ref = (uintptr_t)ret_var.inner;
42941 if (ret_var.is_owned) {
42947 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
42948 LDKSignedRawInvoice this_arg_conv;
42949 this_arg_conv.inner = (void*)(this_arg & (~1));
42950 this_arg_conv.is_owned = false;
42951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42952 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
42953 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
42954 return (uint32_t)ret_conv;
42957 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
42958 LDKSignedRawInvoice this_arg_conv;
42959 this_arg_conv.inner = (void*)(this_arg & (~1));
42960 this_arg_conv.is_owned = false;
42961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42962 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
42966 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
42967 LDKRawInvoice this_arg_conv;
42968 this_arg_conv.inner = (void*)(this_arg & (~1));
42969 this_arg_conv.is_owned = false;
42970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42971 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42972 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
42976 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
42977 LDKRawInvoice this_arg_conv;
42978 this_arg_conv.inner = (void*)(this_arg & (~1));
42979 this_arg_conv.is_owned = false;
42980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42981 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
42982 uint32_t ret_ref = 0;
42983 if ((uintptr_t)ret_var.inner > 4096) {
42984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42987 ret_ref = (uintptr_t)ret_var.inner;
42988 if (ret_var.is_owned) {
42995 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
42996 LDKRawInvoice this_arg_conv;
42997 this_arg_conv.inner = (void*)(this_arg & (~1));
42998 this_arg_conv.is_owned = false;
42999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43000 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
43001 uint32_t ret_ref = 0;
43002 if ((uintptr_t)ret_var.inner > 4096) {
43003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43006 ret_ref = (uintptr_t)ret_var.inner;
43007 if (ret_var.is_owned) {
43014 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
43015 LDKRawInvoice this_arg_conv;
43016 this_arg_conv.inner = (void*)(this_arg & (~1));
43017 this_arg_conv.is_owned = false;
43018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43019 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
43020 uint32_t ret_ref = 0;
43021 if ((uintptr_t)ret_var.inner > 4096) {
43022 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43023 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43025 ret_ref = (uintptr_t)ret_var.inner;
43026 if (ret_var.is_owned) {
43033 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
43034 LDKRawInvoice this_arg_conv;
43035 this_arg_conv.inner = (void*)(this_arg & (~1));
43036 this_arg_conv.is_owned = false;
43037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43038 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
43039 uint32_t ret_ref = 0;
43040 if ((uintptr_t)ret_var.inner > 4096) {
43041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43044 ret_ref = (uintptr_t)ret_var.inner;
43045 if (ret_var.is_owned) {
43052 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
43053 LDKRawInvoice this_arg_conv;
43054 this_arg_conv.inner = (void*)(this_arg & (~1));
43055 this_arg_conv.is_owned = false;
43056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43057 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
43058 uint32_t ret_ref = 0;
43059 if ((uintptr_t)ret_var.inner > 4096) {
43060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43063 ret_ref = (uintptr_t)ret_var.inner;
43064 if (ret_var.is_owned) {
43071 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
43072 LDKRawInvoice this_arg_conv;
43073 this_arg_conv.inner = (void*)(this_arg & (~1));
43074 this_arg_conv.is_owned = false;
43075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43076 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
43077 uint32_t ret_ref = 0;
43078 if ((uintptr_t)ret_var.inner > 4096) {
43079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43082 ret_ref = (uintptr_t)ret_var.inner;
43083 if (ret_var.is_owned) {
43090 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
43091 LDKRawInvoice this_arg_conv;
43092 this_arg_conv.inner = (void*)(this_arg & (~1));
43093 this_arg_conv.is_owned = false;
43094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43095 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43096 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
43100 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
43101 LDKRawInvoice this_arg_conv;
43102 this_arg_conv.inner = (void*)(this_arg & (~1));
43103 this_arg_conv.is_owned = false;
43104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43105 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
43106 uint32_t ret_ref = 0;
43107 if ((uintptr_t)ret_var.inner > 4096) {
43108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43111 ret_ref = (uintptr_t)ret_var.inner;
43112 if (ret_var.is_owned) {
43119 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
43120 LDKRawInvoice this_arg_conv;
43121 this_arg_conv.inner = (void*)(this_arg & (~1));
43122 this_arg_conv.is_owned = false;
43123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43124 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
43125 uint32_tArray ret_arr = NULL;
43126 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43127 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43128 for (size_t o = 0; o < ret_var.datalen; o++) {
43129 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43130 uint32_t ret_conv_14_ref = 0;
43131 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43132 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43134 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43135 if (ret_conv_14_var.is_owned) {
43136 ret_conv_14_ref |= 1;
43138 ret_arr_ptr[o] = ret_conv_14_ref;
43141 FREE(ret_var.data);
43145 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
43146 LDKRawInvoice this_arg_conv;
43147 this_arg_conv.inner = (void*)(this_arg & (~1));
43148 this_arg_conv.is_owned = false;
43149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43150 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43151 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
43152 uint32_t ret_ref = (uintptr_t)ret_copy;
43156 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
43157 LDKRawInvoice 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 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
43165 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
43166 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43167 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
43168 return (uint32_t)ret_conv;
43171 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
43172 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43173 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
43174 return (uint32_t)ret_conv;
43177 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
43178 LDKPositiveTimestamp this_arg_conv;
43179 this_arg_conv.inner = (void*)(this_arg & (~1));
43180 this_arg_conv.is_owned = false;
43181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43182 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
43186 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
43187 LDKPositiveTimestamp this_arg_conv;
43188 this_arg_conv.inner = (void*)(this_arg & (~1));
43189 this_arg_conv.is_owned = false;
43190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43191 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
43195 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
43196 LDKInvoice this_arg_conv;
43197 this_arg_conv.inner = (void*)(this_arg & (~1));
43198 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43200 this_arg_conv = Invoice_clone(&this_arg_conv);
43201 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
43202 uint32_t ret_ref = 0;
43203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43206 ret_ref = (uintptr_t)ret_var.inner;
43207 if (ret_var.is_owned) {
43213 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
43214 LDKInvoice this_arg_conv;
43215 this_arg_conv.inner = (void*)(this_arg & (~1));
43216 this_arg_conv.is_owned = false;
43217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43218 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
43219 *ret_conv = Invoice_check_signature(&this_arg_conv);
43220 return (uint32_t)ret_conv;
43223 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
43224 LDKSignedRawInvoice signed_invoice_conv;
43225 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
43226 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
43227 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
43228 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
43229 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
43230 *ret_conv = Invoice_from_signed(signed_invoice_conv);
43231 return (uint32_t)ret_conv;
43234 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
43235 LDKInvoice this_arg_conv;
43236 this_arg_conv.inner = (void*)(this_arg & (~1));
43237 this_arg_conv.is_owned = false;
43238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43239 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
43243 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
43244 LDKInvoice this_arg_conv;
43245 this_arg_conv.inner = (void*)(this_arg & (~1));
43246 this_arg_conv.is_owned = false;
43247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43248 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43249 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
43253 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
43254 LDKInvoice this_arg_conv;
43255 this_arg_conv.inner = (void*)(this_arg & (~1));
43256 this_arg_conv.is_owned = false;
43257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43258 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43259 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
43263 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
43264 LDKInvoice this_arg_conv;
43265 this_arg_conv.inner = (void*)(this_arg & (~1));
43266 this_arg_conv.is_owned = false;
43267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43268 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43269 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
43273 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
43274 LDKInvoice this_arg_conv;
43275 this_arg_conv.inner = (void*)(this_arg & (~1));
43276 this_arg_conv.is_owned = false;
43277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43278 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
43279 uint32_t ret_ref = 0;
43280 if ((uintptr_t)ret_var.inner > 4096) {
43281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43284 ret_ref = (uintptr_t)ret_var.inner;
43285 if (ret_var.is_owned) {
43292 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
43293 LDKInvoice this_arg_conv;
43294 this_arg_conv.inner = (void*)(this_arg & (~1));
43295 this_arg_conv.is_owned = false;
43296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43297 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43298 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
43302 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
43303 LDKInvoice this_arg_conv;
43304 this_arg_conv.inner = (void*)(this_arg & (~1));
43305 this_arg_conv.is_owned = false;
43306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43307 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
43311 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
43312 LDKInvoice this_arg_conv;
43313 this_arg_conv.inner = (void*)(this_arg & (~1));
43314 this_arg_conv.is_owned = false;
43315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43316 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
43320 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
43321 LDKInvoice this_arg_conv;
43322 this_arg_conv.inner = (void*)(this_arg & (~1));
43323 this_arg_conv.is_owned = false;
43324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43325 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
43329 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
43330 LDKInvoice this_arg_conv;
43331 this_arg_conv.inner = (void*)(this_arg & (~1));
43332 this_arg_conv.is_owned = false;
43333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43334 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
43335 uint32_tArray ret_arr = NULL;
43336 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43337 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43338 for (size_t o = 0; o < ret_var.datalen; o++) {
43339 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43340 uint32_t ret_conv_14_ref = 0;
43341 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43342 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43344 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43345 if (ret_conv_14_var.is_owned) {
43346 ret_conv_14_ref |= 1;
43348 ret_arr_ptr[o] = ret_conv_14_ref;
43351 FREE(ret_var.data);
43355 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
43356 LDKInvoice this_arg_conv;
43357 this_arg_conv.inner = (void*)(this_arg & (~1));
43358 this_arg_conv.is_owned = false;
43359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43360 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
43361 uint32_tArray ret_arr = NULL;
43362 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43363 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43364 for (size_t l = 0; l < ret_var.datalen; l++) {
43365 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43366 uint32_t ret_conv_11_ref = 0;
43367 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43368 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43370 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
43371 if (ret_conv_11_var.is_owned) {
43372 ret_conv_11_ref |= 1;
43374 ret_arr_ptr[l] = ret_conv_11_ref;
43377 FREE(ret_var.data);
43381 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
43382 LDKInvoice this_arg_conv;
43383 this_arg_conv.inner = (void*)(this_arg & (~1));
43384 this_arg_conv.is_owned = false;
43385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43386 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
43390 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
43391 LDKInvoice this_arg_conv;
43392 this_arg_conv.inner = (void*)(this_arg & (~1));
43393 this_arg_conv.is_owned = false;
43394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43395 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43396 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
43397 uint32_t ret_ref = (uintptr_t)ret_copy;
43401 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
43402 LDKStr description_conv = str_ref_to_owned_c(description);
43403 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
43404 *ret_conv = Description_new(description_conv);
43405 return (uint32_t)ret_conv;
43408 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
43409 LDKDescription this_arg_conv;
43410 this_arg_conv.inner = (void*)(this_arg & (~1));
43411 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43413 this_arg_conv = Description_clone(&this_arg_conv);
43414 LDKStr ret_str = Description_into_inner(this_arg_conv);
43415 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43420 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
43421 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
43422 uint32_t ret_ref = 0;
43423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43426 ret_ref = (uintptr_t)ret_var.inner;
43427 if (ret_var.is_owned) {
43433 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
43434 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
43435 uint32_t ret_ref = 0;
43436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43439 ret_ref = (uintptr_t)ret_var.inner;
43440 if (ret_var.is_owned) {
43446 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
43447 LDKExpiryTime this_arg_conv;
43448 this_arg_conv.inner = (void*)(this_arg & (~1));
43449 this_arg_conv.is_owned = false;
43450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43451 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
43455 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
43456 LDKExpiryTime this_arg_conv;
43457 this_arg_conv.inner = (void*)(this_arg & (~1));
43458 this_arg_conv.is_owned = false;
43459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43460 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
43464 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
43465 LDKRouteHint hops_conv;
43466 hops_conv.inner = (void*)(hops & (~1));
43467 hops_conv.is_owned = (hops & 1) || (hops == 0);
43468 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
43469 hops_conv = RouteHint_clone(&hops_conv);
43470 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
43471 *ret_conv = PrivateRoute_new(hops_conv);
43472 return (uint32_t)ret_conv;
43475 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
43476 LDKPrivateRoute this_arg_conv;
43477 this_arg_conv.inner = (void*)(this_arg & (~1));
43478 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43480 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
43481 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
43482 uint32_t ret_ref = 0;
43483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43486 ret_ref = (uintptr_t)ret_var.inner;
43487 if (ret_var.is_owned) {
43493 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
43494 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
43495 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
43499 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
43500 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
43504 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
43505 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
43509 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
43510 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
43514 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
43515 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
43519 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
43520 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
43524 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
43525 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
43526 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
43527 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
43531 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
43532 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
43533 LDKStr ret_str = CreationError_to_str(o_conv);
43534 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43539 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
43540 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
43541 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
43545 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
43546 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
43550 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
43551 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
43555 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
43556 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
43560 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
43561 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
43565 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
43566 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
43570 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
43571 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
43575 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
43576 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
43580 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
43581 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
43585 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
43586 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
43590 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
43591 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
43595 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
43596 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
43597 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
43598 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
43602 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
43603 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
43604 LDKStr ret_str = SemanticError_to_str(o_conv);
43605 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43610 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
43611 if ((this_ptr & 1) != 0) return;
43612 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43613 CHECK_ACCESS(this_ptr_ptr);
43614 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
43615 FREE((void*)this_ptr);
43616 SignOrCreationError_free(this_ptr_conv);
43619 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
43620 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43621 *ret_copy = SignOrCreationError_clone(arg);
43622 uint32_t ret_ref = (uintptr_t)ret_copy;
43625 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
43626 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
43627 uint32_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
43631 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
43632 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
43633 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43634 *ret_copy = SignOrCreationError_clone(orig_conv);
43635 uint32_t ret_ref = (uintptr_t)ret_copy;
43639 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
43640 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43641 *ret_copy = SignOrCreationError_sign_error();
43642 uint32_t ret_ref = (uintptr_t)ret_copy;
43646 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
43647 LDKCreationError a_conv = LDKCreationError_from_js(a);
43648 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43649 *ret_copy = SignOrCreationError_creation_error(a_conv);
43650 uint32_t ret_ref = (uintptr_t)ret_copy;
43654 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
43655 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
43656 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
43657 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
43661 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
43662 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
43663 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
43664 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43669 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
43670 LDKInvoicePayer this_obj_conv;
43671 this_obj_conv.inner = (void*)(this_obj & (~1));
43672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43674 InvoicePayer_free(this_obj_conv);
43677 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
43678 if ((this_ptr & 1) != 0) return;
43679 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43680 CHECK_ACCESS(this_ptr_ptr);
43681 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
43682 FREE((void*)this_ptr);
43683 Payer_free(this_ptr_conv);
43686 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
43687 if ((this_ptr & 1) != 0) return;
43688 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43689 CHECK_ACCESS(this_ptr_ptr);
43690 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43691 FREE((void*)this_ptr);
43692 Router_free(this_ptr_conv);
43695 void __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint32_t this_ptr) {
43696 if ((this_ptr & 1) != 0) return;
43697 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43698 CHECK_ACCESS(this_ptr_ptr);
43699 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
43700 FREE((void*)this_ptr);
43701 Retry_free(this_ptr_conv);
43704 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
43705 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43706 *ret_copy = Retry_clone(arg);
43707 uint32_t ret_ref = (uintptr_t)ret_copy;
43710 uint32_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint32_t arg) {
43711 LDKRetry* arg_conv = (LDKRetry*)arg;
43712 uint32_t ret_conv = Retry_clone_ptr(arg_conv);
43716 uint32_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint32_t orig) {
43717 LDKRetry* orig_conv = (LDKRetry*)orig;
43718 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43719 *ret_copy = Retry_clone(orig_conv);
43720 uint32_t ret_ref = (uintptr_t)ret_copy;
43724 uint32_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
43725 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43726 *ret_copy = Retry_attempts(a);
43727 uint32_t ret_ref = (uintptr_t)ret_copy;
43731 jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint32_t a, uint32_t b) {
43732 LDKRetry* a_conv = (LDKRetry*)a;
43733 LDKRetry* b_conv = (LDKRetry*)b;
43734 jboolean ret_conv = Retry_eq(a_conv, b_conv);
43738 int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint32_t o) {
43739 LDKRetry* o_conv = (LDKRetry*)o;
43740 int64_t ret_conv = Retry_hash(o_conv);
43744 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
43745 if ((this_ptr & 1) != 0) return;
43746 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43747 CHECK_ACCESS(this_ptr_ptr);
43748 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
43749 FREE((void*)this_ptr);
43750 PaymentError_free(this_ptr_conv);
43753 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
43754 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43755 *ret_copy = PaymentError_clone(arg);
43756 uint32_t ret_ref = (uintptr_t)ret_copy;
43759 uint32_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
43760 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
43761 uint32_t ret_conv = PaymentError_clone_ptr(arg_conv);
43765 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
43766 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
43767 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43768 *ret_copy = PaymentError_clone(orig_conv);
43769 uint32_t ret_ref = (uintptr_t)ret_copy;
43773 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
43774 LDKStr a_conv = str_ref_to_owned_c(a);
43775 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43776 *ret_copy = PaymentError_invoice(a_conv);
43777 uint32_t ret_ref = (uintptr_t)ret_copy;
43781 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
43782 LDKLightningError a_conv;
43783 a_conv.inner = (void*)(a & (~1));
43784 a_conv.is_owned = (a & 1) || (a == 0);
43785 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43786 a_conv = LightningError_clone(&a_conv);
43787 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43788 *ret_copy = PaymentError_routing(a_conv);
43789 uint32_t ret_ref = (uintptr_t)ret_copy;
43793 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
43794 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43795 CHECK_ACCESS(a_ptr);
43796 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
43797 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
43798 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43799 *ret_copy = PaymentError_sending(a_conv);
43800 uint32_t ret_ref = (uintptr_t)ret_copy;
43804 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) {
43805 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
43806 CHECK_ACCESS(payer_ptr);
43807 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
43808 if (payer_conv.free == LDKPayer_JCalls_free) {
43809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43810 LDKPayer_JCalls_cloned(&payer_conv);
43812 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
43813 CHECK_ACCESS(router_ptr);
43814 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43815 if (router_conv.free == LDKRouter_JCalls_free) {
43816 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43817 LDKRouter_JCalls_cloned(&router_conv);
43819 LDKMultiThreadedLockableScore scorer_conv;
43820 scorer_conv.inner = (void*)(scorer & (~1));
43821 scorer_conv.is_owned = false;
43822 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
43823 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43824 CHECK_ACCESS(logger_ptr);
43825 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43826 if (logger_conv.free == LDKLogger_JCalls_free) {
43827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43828 LDKLogger_JCalls_cloned(&logger_conv);
43830 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
43831 CHECK_ACCESS(event_handler_ptr);
43832 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43833 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43835 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43837 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
43838 CHECK_ACCESS(retry_ptr);
43839 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
43840 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
43841 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
43842 uint32_t ret_ref = 0;
43843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43846 ret_ref = (uintptr_t)ret_var.inner;
43847 if (ret_var.is_owned) {
43853 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
43854 LDKInvoicePayer this_arg_conv;
43855 this_arg_conv.inner = (void*)(this_arg & (~1));
43856 this_arg_conv.is_owned = false;
43857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43858 LDKInvoice invoice_conv;
43859 invoice_conv.inner = (void*)(invoice & (~1));
43860 invoice_conv.is_owned = false;
43861 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43862 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43863 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
43864 return (uint32_t)ret_conv;
43867 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) {
43868 LDKInvoicePayer this_arg_conv;
43869 this_arg_conv.inner = (void*)(this_arg & (~1));
43870 this_arg_conv.is_owned = false;
43871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43872 LDKInvoice invoice_conv;
43873 invoice_conv.inner = (void*)(invoice & (~1));
43874 invoice_conv.is_owned = false;
43875 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43876 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43877 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
43878 return (uint32_t)ret_conv;
43881 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) {
43882 LDKInvoicePayer this_arg_conv;
43883 this_arg_conv.inner = (void*)(this_arg & (~1));
43884 this_arg_conv.is_owned = false;
43885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43886 LDKPublicKey pubkey_ref;
43887 CHECK(pubkey->arr_len == 33);
43888 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43889 LDKThirtyTwoBytes payment_preimage_ref;
43890 CHECK(payment_preimage->arr_len == 32);
43891 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
43892 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43893 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
43894 return (uint32_t)ret_conv;
43897 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
43898 LDKInvoicePayer this_arg_conv;
43899 this_arg_conv.inner = (void*)(this_arg & (~1));
43900 this_arg_conv.is_owned = false;
43901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43902 unsigned char payment_hash_arr[32];
43903 CHECK(payment_hash->arr_len == 32);
43904 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
43905 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
43906 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
43909 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
43910 LDKInvoicePayer this_arg_conv;
43911 this_arg_conv.inner = (void*)(this_arg & (~1));
43912 this_arg_conv.is_owned = false;
43913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43914 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43915 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
43916 return (uint32_t)ret_ret;
43919 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) {
43920 LDKChannelManager channelmanager_conv;
43921 channelmanager_conv.inner = (void*)(channelmanager & (~1));
43922 channelmanager_conv.is_owned = false;
43923 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43924 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
43925 CHECK_ACCESS(keys_manager_ptr);
43926 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43927 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43928 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43929 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43931 LDKCurrency network_conv = LDKCurrency_from_js(network);
43932 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
43933 CHECK_ACCESS(amt_msat_ptr);
43934 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
43935 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
43936 LDKSha256 description_hash_conv;
43937 description_hash_conv.inner = (void*)(description_hash & (~1));
43938 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
43939 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
43940 description_hash_conv = Sha256_clone(&description_hash_conv);
43941 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
43942 *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);
43943 return (uint32_t)ret_conv;
43946 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) {
43947 LDKChannelManager channelmanager_conv;
43948 channelmanager_conv.inner = (void*)(channelmanager & (~1));
43949 channelmanager_conv.is_owned = false;
43950 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43951 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
43952 CHECK_ACCESS(keys_manager_ptr);
43953 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43954 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43955 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43956 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43958 LDKCurrency network_conv = LDKCurrency_from_js(network);
43959 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
43960 CHECK_ACCESS(amt_msat_ptr);
43961 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
43962 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
43963 LDKStr description_conv = str_ref_to_owned_c(description);
43964 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
43965 *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);
43966 return (uint32_t)ret_conv;
43969 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
43970 LDKDefaultRouter this_obj_conv;
43971 this_obj_conv.inner = (void*)(this_obj & (~1));
43972 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43974 DefaultRouter_free(this_obj_conv);
43977 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger, int8_tArray random_seed_bytes) {
43978 LDKNetworkGraph network_graph_conv;
43979 network_graph_conv.inner = (void*)(network_graph & (~1));
43980 network_graph_conv.is_owned = false;
43981 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43982 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43983 CHECK_ACCESS(logger_ptr);
43984 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43985 if (logger_conv.free == LDKLogger_JCalls_free) {
43986 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43987 LDKLogger_JCalls_cloned(&logger_conv);
43989 LDKThirtyTwoBytes random_seed_bytes_ref;
43990 CHECK(random_seed_bytes->arr_len == 32);
43991 memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43992 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
43993 uint32_t ret_ref = 0;
43994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43997 ret_ref = (uintptr_t)ret_var.inner;
43998 if (ret_var.is_owned) {
44004 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
44005 LDKDefaultRouter this_arg_conv;
44006 this_arg_conv.inner = (void*)(this_arg & (~1));
44007 this_arg_conv.is_owned = false;
44008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44009 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44010 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44011 return (uint32_t)ret_ret;
44014 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
44015 LDKChannelManager this_arg_conv;
44016 this_arg_conv.inner = (void*)(this_arg & (~1));
44017 this_arg_conv.is_owned = false;
44018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44019 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
44020 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
44021 return (uint32_t)ret_ret;
44024 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
44025 LDKStr s_conv = str_ref_to_owned_c(s);
44026 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
44027 *ret_conv = SiPrefix_from_str(s_conv);
44028 return (uint32_t)ret_conv;
44031 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
44032 LDKStr s_conv = str_ref_to_owned_c(s);
44033 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
44034 *ret_conv = Invoice_from_str(s_conv);
44035 return (uint32_t)ret_conv;
44038 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
44039 LDKStr s_conv = str_ref_to_owned_c(s);
44040 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
44041 *ret_conv = SignedRawInvoice_from_str(s_conv);
44042 return (uint32_t)ret_conv;
44045 jstring __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint32_t o) {
44046 LDKParseError* o_conv = (LDKParseError*)o;
44047 LDKStr ret_str = ParseError_to_str(o_conv);
44048 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44053 jstring __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint32_t o) {
44054 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
44055 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
44056 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44061 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
44063 o_conv.inner = (void*)(o & (~1));
44064 o_conv.is_owned = false;
44065 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44066 LDKStr ret_str = Invoice_to_str(&o_conv);
44067 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44072 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
44073 LDKSignedRawInvoice o_conv;
44074 o_conv.inner = (void*)(o & (~1));
44075 o_conv.is_owned = false;
44076 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44077 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
44078 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44083 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
44084 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
44085 LDKStr ret_str = Currency_to_str(o_conv);
44086 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44091 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
44092 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
44093 LDKStr ret_str = SiPrefix_to_str(o_conv);
44094 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);