5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16 return val == 0xdeadbeef0badf00dULL;
20 void *malloc(size_t size);
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
38 #define DECL_ARR_TYPE(ty, name) \
39 struct name##array { \
43 typedef struct name##array * name##Array; \
44 static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), #name" array init", lineno); \
46 arr->arr_len = arr_len; \
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(int8_t, int8_t);
52 DECL_ARR_TYPE(uint32_t, uint32_t);
53 DECL_ARR_TYPE(void*, ptr);
54 DECL_ARR_TYPE(char, char);
55 typedef charArray jstring;
57 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
58 charArray arr = init_charArray(len, __LINE__);
59 memcpy(arr->elems, chars, len);
62 static inline LDKStr str_ref_to_owned_c(const jstring str) {
63 char* newchars = MALLOC(str->arr_len + 1, "String chars");
64 memcpy(newchars, str->elems, str->arr_len);
65 newchars[str->arr_len] = 0;
69 .chars_is_owned = true
74 typedef bool jboolean;
76 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
77 return (uint32_t)MALLOC(size, "JS-Called malloc");
79 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
83 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
84 const char *res = check_get_ldk_bindings_version();
85 if (res == NULL) return NULL;
86 return str_ref_to_ts(res, strlen(res));
88 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
89 const char *res = check_get_ldk_version();
90 if (res == NULL) return NULL;
91 return str_ref_to_ts(res, strlen(res));
94 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
95 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
97 case 0: return LDKAccessError_UnknownChain;
98 case 1: return LDKAccessError_UnknownTx;
102 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
104 case LDKAccessError_UnknownChain: return 0;
105 case LDKAccessError_UnknownTx: return 1;
109 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
111 case 0: return LDKCOption_NoneZ_Some;
112 case 1: return LDKCOption_NoneZ_None;
116 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
118 case LDKCOption_NoneZ_Some: return 0;
119 case LDKCOption_NoneZ_None: return 1;
123 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
125 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
126 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
130 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
132 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
133 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
137 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
139 case 0: return LDKConfirmationTarget_Background;
140 case 1: return LDKConfirmationTarget_Normal;
141 case 2: return LDKConfirmationTarget_HighPriority;
145 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
147 case LDKConfirmationTarget_Background: return 0;
148 case LDKConfirmationTarget_Normal: return 1;
149 case LDKConfirmationTarget_HighPriority: return 2;
153 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
155 case 0: return LDKCreationError_DescriptionTooLong;
156 case 1: return LDKCreationError_RouteTooLong;
157 case 2: return LDKCreationError_TimestampOutOfBounds;
158 case 3: return LDKCreationError_InvalidAmount;
159 case 4: return LDKCreationError_MissingRouteHints;
163 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
165 case LDKCreationError_DescriptionTooLong: return 0;
166 case LDKCreationError_RouteTooLong: return 1;
167 case LDKCreationError_TimestampOutOfBounds: return 2;
168 case LDKCreationError_InvalidAmount: return 3;
169 case LDKCreationError_MissingRouteHints: return 4;
173 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
175 case 0: return LDKCurrency_Bitcoin;
176 case 1: return LDKCurrency_BitcoinTestnet;
177 case 2: return LDKCurrency_Regtest;
178 case 3: return LDKCurrency_Simnet;
179 case 4: return LDKCurrency_Signet;
183 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
185 case LDKCurrency_Bitcoin: return 0;
186 case LDKCurrency_BitcoinTestnet: return 1;
187 case LDKCurrency_Regtest: return 2;
188 case LDKCurrency_Simnet: return 3;
189 case LDKCurrency_Signet: return 4;
193 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
195 case 0: return LDKIOError_NotFound;
196 case 1: return LDKIOError_PermissionDenied;
197 case 2: return LDKIOError_ConnectionRefused;
198 case 3: return LDKIOError_ConnectionReset;
199 case 4: return LDKIOError_ConnectionAborted;
200 case 5: return LDKIOError_NotConnected;
201 case 6: return LDKIOError_AddrInUse;
202 case 7: return LDKIOError_AddrNotAvailable;
203 case 8: return LDKIOError_BrokenPipe;
204 case 9: return LDKIOError_AlreadyExists;
205 case 10: return LDKIOError_WouldBlock;
206 case 11: return LDKIOError_InvalidInput;
207 case 12: return LDKIOError_InvalidData;
208 case 13: return LDKIOError_TimedOut;
209 case 14: return LDKIOError_WriteZero;
210 case 15: return LDKIOError_Interrupted;
211 case 16: return LDKIOError_Other;
212 case 17: return LDKIOError_UnexpectedEof;
216 static inline int32_t LDKIOError_to_js(LDKIOError val) {
218 case LDKIOError_NotFound: return 0;
219 case LDKIOError_PermissionDenied: return 1;
220 case LDKIOError_ConnectionRefused: return 2;
221 case LDKIOError_ConnectionReset: return 3;
222 case LDKIOError_ConnectionAborted: return 4;
223 case LDKIOError_NotConnected: return 5;
224 case LDKIOError_AddrInUse: return 6;
225 case LDKIOError_AddrNotAvailable: return 7;
226 case LDKIOError_BrokenPipe: return 8;
227 case LDKIOError_AlreadyExists: return 9;
228 case LDKIOError_WouldBlock: return 10;
229 case LDKIOError_InvalidInput: return 11;
230 case LDKIOError_InvalidData: return 12;
231 case LDKIOError_TimedOut: return 13;
232 case LDKIOError_WriteZero: return 14;
233 case LDKIOError_Interrupted: return 15;
234 case LDKIOError_Other: return 16;
235 case LDKIOError_UnexpectedEof: return 17;
239 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
241 case 0: return LDKLevel_Gossip;
242 case 1: return LDKLevel_Trace;
243 case 2: return LDKLevel_Debug;
244 case 3: return LDKLevel_Info;
245 case 4: return LDKLevel_Warn;
246 case 5: return LDKLevel_Error;
250 static inline int32_t LDKLevel_to_js(LDKLevel val) {
252 case LDKLevel_Gossip: return 0;
253 case LDKLevel_Trace: return 1;
254 case LDKLevel_Debug: return 2;
255 case LDKLevel_Info: return 3;
256 case LDKLevel_Warn: return 4;
257 case LDKLevel_Error: return 5;
261 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
263 case 0: return LDKNetwork_Bitcoin;
264 case 1: return LDKNetwork_Testnet;
265 case 2: return LDKNetwork_Regtest;
266 case 3: return LDKNetwork_Signet;
270 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
272 case LDKNetwork_Bitcoin: return 0;
273 case LDKNetwork_Testnet: return 1;
274 case LDKNetwork_Regtest: return 2;
275 case LDKNetwork_Signet: return 3;
279 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
281 case 0: return LDKRecipient_Node;
282 case 1: return LDKRecipient_PhantomNode;
286 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
288 case LDKRecipient_Node: return 0;
289 case LDKRecipient_PhantomNode: return 1;
293 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
295 case 0: return LDKSecp256k1Error_IncorrectSignature;
296 case 1: return LDKSecp256k1Error_InvalidMessage;
297 case 2: return LDKSecp256k1Error_InvalidPublicKey;
298 case 3: return LDKSecp256k1Error_InvalidSignature;
299 case 4: return LDKSecp256k1Error_InvalidSecretKey;
300 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
301 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
302 case 7: return LDKSecp256k1Error_InvalidTweak;
303 case 8: return LDKSecp256k1Error_NotEnoughMemory;
304 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
305 case 10: return LDKSecp256k1Error_InvalidParityValue;
309 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
311 case LDKSecp256k1Error_IncorrectSignature: return 0;
312 case LDKSecp256k1Error_InvalidMessage: return 1;
313 case LDKSecp256k1Error_InvalidPublicKey: return 2;
314 case LDKSecp256k1Error_InvalidSignature: return 3;
315 case LDKSecp256k1Error_InvalidSecretKey: return 4;
316 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
317 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
318 case LDKSecp256k1Error_InvalidTweak: return 7;
319 case LDKSecp256k1Error_NotEnoughMemory: return 8;
320 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
321 case LDKSecp256k1Error_InvalidParityValue: return 10;
325 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
327 case 0: return LDKSemanticError_NoPaymentHash;
328 case 1: return LDKSemanticError_MultiplePaymentHashes;
329 case 2: return LDKSemanticError_NoDescription;
330 case 3: return LDKSemanticError_MultipleDescriptions;
331 case 4: return LDKSemanticError_NoPaymentSecret;
332 case 5: return LDKSemanticError_MultiplePaymentSecrets;
333 case 6: return LDKSemanticError_InvalidFeatures;
334 case 7: return LDKSemanticError_InvalidRecoveryId;
335 case 8: return LDKSemanticError_InvalidSignature;
336 case 9: return LDKSemanticError_ImpreciseAmount;
340 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
342 case LDKSemanticError_NoPaymentHash: return 0;
343 case LDKSemanticError_MultiplePaymentHashes: return 1;
344 case LDKSemanticError_NoDescription: return 2;
345 case LDKSemanticError_MultipleDescriptions: return 3;
346 case LDKSemanticError_NoPaymentSecret: return 4;
347 case LDKSemanticError_MultiplePaymentSecrets: return 5;
348 case LDKSemanticError_InvalidFeatures: return 6;
349 case LDKSemanticError_InvalidRecoveryId: return 7;
350 case LDKSemanticError_InvalidSignature: return 8;
351 case LDKSemanticError_ImpreciseAmount: return 9;
355 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
357 case 0: return LDKSiPrefix_Milli;
358 case 1: return LDKSiPrefix_Micro;
359 case 2: return LDKSiPrefix_Nano;
360 case 3: return LDKSiPrefix_Pico;
364 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
366 case LDKSiPrefix_Milli: return 0;
367 case LDKSiPrefix_Micro: return 1;
368 case LDKSiPrefix_Nano: return 2;
369 case LDKSiPrefix_Pico: return 3;
373 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint32_t ptr) {
374 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
376 case LDKBech32Error_MissingSeparator: return 0;
377 case LDKBech32Error_InvalidChecksum: return 1;
378 case LDKBech32Error_InvalidLength: return 2;
379 case LDKBech32Error_InvalidChar: return 3;
380 case LDKBech32Error_InvalidData: return 4;
381 case LDKBech32Error_InvalidPadding: return 5;
382 case LDKBech32Error_MixedCase: return 6;
386 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint32_t ptr) {
387 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
388 assert(obj->tag == LDKBech32Error_InvalidChar);
389 int32_t invalid_char_conv = obj->invalid_char;
390 return invalid_char_conv;
392 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint32_t ptr) {
393 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
394 assert(obj->tag == LDKBech32Error_InvalidData);
395 int8_t invalid_data_conv = obj->invalid_data;
396 return invalid_data_conv;
398 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
399 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
400 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
403 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) {
404 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
405 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
406 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
407 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
408 CVec_u8Z_free(ret_var);
412 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) {
413 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
414 int64_t ret_conv = TxOut_get_value(thing_conv);
418 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
419 CHECK(owner->result_ok);
420 return *owner->contents.result;
422 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
423 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
424 CResult_NoneNoneZ_get_ok(owner_conv);
427 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
428 CHECK(!owner->result_ok);
429 return *owner->contents.err;
431 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
432 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
433 CResult_NoneNoneZ_get_err(owner_conv);
436 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
437 CHECK(owner->result_ok);
438 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
440 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint32_t owner) {
441 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
442 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
443 uint32_t ret_ref = 0;
444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
447 ret_ref = (uintptr_t)ret_var.inner;
448 if (ret_var.is_owned) {
454 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
455 CHECK(!owner->result_ok);
456 return DecodeError_clone(&*owner->contents.err);
458 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint32_t owner) {
459 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
460 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
461 uint32_t ret_ref = 0;
462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
465 ret_ref = (uintptr_t)ret_var.inner;
466 if (ret_var.is_owned) {
472 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
473 CHECK(owner->result_ok);
474 return *owner->contents.result;
476 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
477 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
478 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
479 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
483 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
484 CHECK(!owner->result_ok);
485 return *owner->contents.err;
487 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
488 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
489 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
493 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
494 CHECK(owner->result_ok);
495 return *owner->contents.result;
497 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
498 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
499 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
500 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
504 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
505 CHECK(!owner->result_ok);
506 return *owner->contents.err;
508 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
509 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
510 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
514 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
515 CHECK(owner->result_ok);
516 return TxCreationKeys_clone(&*owner->contents.result);
518 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
519 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
520 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
521 uint32_t ret_ref = 0;
522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
525 ret_ref = (uintptr_t)ret_var.inner;
526 if (ret_var.is_owned) {
532 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
533 CHECK(!owner->result_ok);
534 return DecodeError_clone(&*owner->contents.err);
536 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
537 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
538 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
539 uint32_t ret_ref = 0;
540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
543 ret_ref = (uintptr_t)ret_var.inner;
544 if (ret_var.is_owned) {
550 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
551 CHECK(owner->result_ok);
552 return ChannelPublicKeys_clone(&*owner->contents.result);
554 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
555 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
556 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
557 uint32_t ret_ref = 0;
558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
561 ret_ref = (uintptr_t)ret_var.inner;
562 if (ret_var.is_owned) {
568 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
569 CHECK(!owner->result_ok);
570 return DecodeError_clone(&*owner->contents.err);
572 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
573 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
574 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
575 uint32_t ret_ref = 0;
576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
579 ret_ref = (uintptr_t)ret_var.inner;
580 if (ret_var.is_owned) {
586 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
587 CHECK(owner->result_ok);
588 return TxCreationKeys_clone(&*owner->contents.result);
590 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
591 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
592 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
593 uint32_t ret_ref = 0;
594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
597 ret_ref = (uintptr_t)ret_var.inner;
598 if (ret_var.is_owned) {
604 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
605 CHECK(!owner->result_ok);
606 return *owner->contents.err;
608 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
609 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
610 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
614 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
615 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
617 case LDKCOption_u32Z_Some: return 0;
618 case LDKCOption_u32Z_None: return 1;
622 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
623 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
624 assert(obj->tag == LDKCOption_u32Z_Some);
625 int32_t some_conv = obj->some;
628 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
629 CHECK(owner->result_ok);
630 return HTLCOutputInCommitment_clone(&*owner->contents.result);
632 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
633 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
634 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
635 uint32_t ret_ref = 0;
636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
639 ret_ref = (uintptr_t)ret_var.inner;
640 if (ret_var.is_owned) {
646 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
647 CHECK(!owner->result_ok);
648 return DecodeError_clone(&*owner->contents.err);
650 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
651 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
652 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
653 uint32_t ret_ref = 0;
654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
657 ret_ref = (uintptr_t)ret_var.inner;
658 if (ret_var.is_owned) {
664 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
665 CHECK(owner->result_ok);
666 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
668 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
669 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
670 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
671 uint32_t ret_ref = 0;
672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
675 ret_ref = (uintptr_t)ret_var.inner;
676 if (ret_var.is_owned) {
682 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
683 CHECK(!owner->result_ok);
684 return DecodeError_clone(&*owner->contents.err);
686 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
687 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
688 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
689 uint32_t ret_ref = 0;
690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
693 ret_ref = (uintptr_t)ret_var.inner;
694 if (ret_var.is_owned) {
700 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
701 CHECK(owner->result_ok);
702 return ChannelTransactionParameters_clone(&*owner->contents.result);
704 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
705 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
706 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
707 uint32_t ret_ref = 0;
708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
711 ret_ref = (uintptr_t)ret_var.inner;
712 if (ret_var.is_owned) {
718 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
719 CHECK(!owner->result_ok);
720 return DecodeError_clone(&*owner->contents.err);
722 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
723 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
724 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
725 uint32_t ret_ref = 0;
726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
729 ret_ref = (uintptr_t)ret_var.inner;
730 if (ret_var.is_owned) {
736 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
737 CHECK(owner->result_ok);
738 return HolderCommitmentTransaction_clone(&*owner->contents.result);
740 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
741 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
742 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
743 uint32_t ret_ref = 0;
744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
747 ret_ref = (uintptr_t)ret_var.inner;
748 if (ret_var.is_owned) {
754 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
755 CHECK(!owner->result_ok);
756 return DecodeError_clone(&*owner->contents.err);
758 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
759 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
760 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
761 uint32_t ret_ref = 0;
762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
765 ret_ref = (uintptr_t)ret_var.inner;
766 if (ret_var.is_owned) {
772 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
773 CHECK(owner->result_ok);
774 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
776 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
777 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
778 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
779 uint32_t ret_ref = 0;
780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
783 ret_ref = (uintptr_t)ret_var.inner;
784 if (ret_var.is_owned) {
790 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
791 CHECK(!owner->result_ok);
792 return DecodeError_clone(&*owner->contents.err);
794 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
795 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
796 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
797 uint32_t ret_ref = 0;
798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
801 ret_ref = (uintptr_t)ret_var.inner;
802 if (ret_var.is_owned) {
808 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
809 CHECK(owner->result_ok);
810 return &*owner->contents.result;
812 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
813 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
814 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
815 uint32_t ret_ref = 0;
816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
819 ret_ref = (uintptr_t)ret_var.inner & ~1;
823 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
824 CHECK(!owner->result_ok);
825 return *owner->contents.err;
827 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
828 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
829 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
832 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
833 CHECK(owner->result_ok);
834 return CommitmentTransaction_clone(&*owner->contents.result);
836 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
837 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
838 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
839 uint32_t ret_ref = 0;
840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
843 ret_ref = (uintptr_t)ret_var.inner;
844 if (ret_var.is_owned) {
850 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
851 CHECK(!owner->result_ok);
852 return DecodeError_clone(&*owner->contents.err);
854 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
855 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
856 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
857 uint32_t ret_ref = 0;
858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
861 ret_ref = (uintptr_t)ret_var.inner;
862 if (ret_var.is_owned) {
868 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
869 CHECK(owner->result_ok);
870 return &*owner->contents.result;
872 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
873 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
874 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
875 uint32_t ret_ref = 0;
876 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
877 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
878 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
879 ret_ref = (uintptr_t)ret_var.inner & ~1;
883 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
884 CHECK(!owner->result_ok);
885 return *owner->contents.err;
887 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
888 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
889 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
892 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
893 CHECK(owner->result_ok);
894 return *owner->contents.result;
896 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
897 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
898 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
899 ptrArray ret_arr = NULL;
900 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
901 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
902 for (size_t m = 0; m < ret_var.datalen; m++) {
903 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
904 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
905 ret_arr_ptr[m] = ret_conv_12_arr;
911 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
912 CHECK(!owner->result_ok);
913 return *owner->contents.err;
915 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
916 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
917 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
920 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
921 CHECK(owner->result_ok);
922 return ShutdownScript_clone(&*owner->contents.result);
924 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
925 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
926 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
927 uint32_t ret_ref = 0;
928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
931 ret_ref = (uintptr_t)ret_var.inner;
932 if (ret_var.is_owned) {
938 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
939 CHECK(!owner->result_ok);
940 return DecodeError_clone(&*owner->contents.err);
942 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
943 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
944 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
945 uint32_t ret_ref = 0;
946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
949 ret_ref = (uintptr_t)ret_var.inner;
950 if (ret_var.is_owned) {
956 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
957 CHECK(owner->result_ok);
958 return ShutdownScript_clone(&*owner->contents.result);
960 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
961 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
962 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
963 uint32_t ret_ref = 0;
964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
967 ret_ref = (uintptr_t)ret_var.inner;
968 if (ret_var.is_owned) {
974 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
975 CHECK(!owner->result_ok);
976 return InvalidShutdownScript_clone(&*owner->contents.err);
978 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
979 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
980 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
981 uint32_t ret_ref = 0;
982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
985 ret_ref = (uintptr_t)ret_var.inner;
986 if (ret_var.is_owned) {
992 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
993 CHECK(owner->result_ok);
994 return RouteHop_clone(&*owner->contents.result);
996 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
997 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
998 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
999 uint32_t ret_ref = 0;
1000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1003 ret_ref = (uintptr_t)ret_var.inner;
1004 if (ret_var.is_owned) {
1010 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1011 CHECK(!owner->result_ok);
1012 return DecodeError_clone(&*owner->contents.err);
1014 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
1015 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1016 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1017 uint32_t ret_ref = 0;
1018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1021 ret_ref = (uintptr_t)ret_var.inner;
1022 if (ret_var.is_owned) {
1028 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1029 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1030 for (size_t i = 0; i < ret.datalen; i++) {
1031 ret.data[i] = RouteHop_clone(&orig->data[i]);
1035 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1036 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1037 for (size_t i = 0; i < ret.datalen; i++) {
1038 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1042 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1043 CHECK(owner->result_ok);
1044 return Route_clone(&*owner->contents.result);
1046 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
1047 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1048 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1049 uint32_t ret_ref = 0;
1050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1053 ret_ref = (uintptr_t)ret_var.inner;
1054 if (ret_var.is_owned) {
1060 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1061 CHECK(!owner->result_ok);
1062 return DecodeError_clone(&*owner->contents.err);
1064 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
1065 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1066 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1067 uint32_t ret_ref = 0;
1068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1071 ret_ref = (uintptr_t)ret_var.inner;
1072 if (ret_var.is_owned) {
1078 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1079 CHECK(owner->result_ok);
1080 return RouteParameters_clone(&*owner->contents.result);
1082 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
1083 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1084 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1085 uint32_t ret_ref = 0;
1086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1089 ret_ref = (uintptr_t)ret_var.inner;
1090 if (ret_var.is_owned) {
1096 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1097 CHECK(!owner->result_ok);
1098 return DecodeError_clone(&*owner->contents.err);
1100 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
1101 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1102 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1103 uint32_t ret_ref = 0;
1104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1107 ret_ref = (uintptr_t)ret_var.inner;
1108 if (ret_var.is_owned) {
1114 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1115 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1116 for (size_t i = 0; i < ret.datalen; i++) {
1117 ret.data[i] = RouteHint_clone(&orig->data[i]);
1121 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1122 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1124 case LDKCOption_u64Z_Some: return 0;
1125 case LDKCOption_u64Z_None: return 1;
1129 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1130 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1131 assert(obj->tag == LDKCOption_u64Z_Some);
1132 int64_t some_conv = obj->some;
1135 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1136 CHECK(owner->result_ok);
1137 return PaymentParameters_clone(&*owner->contents.result);
1139 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint32_t owner) {
1140 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1141 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1142 uint32_t ret_ref = 0;
1143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1146 ret_ref = (uintptr_t)ret_var.inner;
1147 if (ret_var.is_owned) {
1153 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1154 CHECK(!owner->result_ok);
1155 return DecodeError_clone(&*owner->contents.err);
1157 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint32_t owner) {
1158 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1159 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1160 uint32_t ret_ref = 0;
1161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1164 ret_ref = (uintptr_t)ret_var.inner;
1165 if (ret_var.is_owned) {
1171 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1172 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1173 for (size_t i = 0; i < ret.datalen; i++) {
1174 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1178 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1179 CHECK(owner->result_ok);
1180 return RouteHint_clone(&*owner->contents.result);
1182 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
1183 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1184 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1185 uint32_t ret_ref = 0;
1186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1189 ret_ref = (uintptr_t)ret_var.inner;
1190 if (ret_var.is_owned) {
1196 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1197 CHECK(!owner->result_ok);
1198 return DecodeError_clone(&*owner->contents.err);
1200 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
1201 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1202 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1203 uint32_t ret_ref = 0;
1204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1207 ret_ref = (uintptr_t)ret_var.inner;
1208 if (ret_var.is_owned) {
1214 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1215 CHECK(owner->result_ok);
1216 return RouteHintHop_clone(&*owner->contents.result);
1218 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
1219 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1220 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1221 uint32_t ret_ref = 0;
1222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1225 ret_ref = (uintptr_t)ret_var.inner;
1226 if (ret_var.is_owned) {
1232 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1233 CHECK(!owner->result_ok);
1234 return DecodeError_clone(&*owner->contents.err);
1236 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
1237 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1238 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1239 uint32_t ret_ref = 0;
1240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1243 ret_ref = (uintptr_t)ret_var.inner;
1244 if (ret_var.is_owned) {
1250 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1251 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1252 for (size_t i = 0; i < ret.datalen; i++) {
1253 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1257 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1258 CHECK(owner->result_ok);
1259 return Route_clone(&*owner->contents.result);
1261 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
1262 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1263 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1264 uint32_t ret_ref = 0;
1265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1268 ret_ref = (uintptr_t)ret_var.inner;
1269 if (ret_var.is_owned) {
1275 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1276 CHECK(!owner->result_ok);
1277 return LightningError_clone(&*owner->contents.err);
1279 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
1280 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1281 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1282 uint32_t ret_ref = 0;
1283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1286 ret_ref = (uintptr_t)ret_var.inner;
1287 if (ret_var.is_owned) {
1293 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1294 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1296 case LDKPaymentPurpose_InvoicePayment: return 0;
1297 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1301 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1302 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1303 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1304 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1305 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1306 return payment_preimage_arr;
1308 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1309 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1310 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1311 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1312 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1313 return payment_secret_arr;
1315 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1316 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1317 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1318 int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1319 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1320 return spontaneous_payment_arr;
1322 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1323 CHECK(owner->result_ok);
1324 return PaymentPurpose_clone(&*owner->contents.result);
1326 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint32_t owner) {
1327 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1328 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1329 *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1330 uint32_t ret_ref = (uintptr_t)ret_copy;
1334 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1335 CHECK(!owner->result_ok);
1336 return DecodeError_clone(&*owner->contents.err);
1338 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint32_t owner) {
1339 LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(owner & ~1);
1340 LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1341 uint32_t ret_ref = 0;
1342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1345 ret_ref = (uintptr_t)ret_var.inner;
1346 if (ret_var.is_owned) {
1352 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1353 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1355 case LDKClosureReason_CounterpartyForceClosed: return 0;
1356 case LDKClosureReason_HolderForceClosed: return 1;
1357 case LDKClosureReason_CooperativeClosure: return 2;
1358 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1359 case LDKClosureReason_FundingTimedOut: return 4;
1360 case LDKClosureReason_ProcessingError: return 5;
1361 case LDKClosureReason_DisconnectedPeer: return 6;
1362 case LDKClosureReason_OutdatedChannelManager: return 7;
1366 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1367 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1368 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1369 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1370 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1371 return peer_msg_conv;
1373 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1374 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1375 assert(obj->tag == LDKClosureReason_ProcessingError);
1376 LDKStr err_str = obj->processing_error.err;
1377 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1380 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
1381 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1383 case LDKCOption_ClosureReasonZ_Some: return 0;
1384 case LDKCOption_ClosureReasonZ_None: return 1;
1388 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
1389 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1390 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1391 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1394 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1395 CHECK(owner->result_ok);
1396 return COption_ClosureReasonZ_clone(&*owner->contents.result);
1398 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
1399 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1400 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1401 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1402 uint32_t ret_ref = (uintptr_t)ret_copy;
1406 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1407 CHECK(!owner->result_ok);
1408 return DecodeError_clone(&*owner->contents.err);
1410 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
1411 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1412 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1413 uint32_t ret_ref = 0;
1414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1417 ret_ref = (uintptr_t)ret_var.inner;
1418 if (ret_var.is_owned) {
1424 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1425 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1427 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1428 case LDKNetworkUpdate_ChannelFailure: return 1;
1429 case LDKNetworkUpdate_NodeFailure: return 2;
1433 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1434 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1435 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1436 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1437 uint32_t msg_ref = 0;
1438 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1439 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1440 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1441 msg_ref = (uintptr_t)msg_var.inner & ~1;
1444 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint32_t ptr) {
1445 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1446 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1447 int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1448 return short_channel_id_conv;
1450 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint32_t ptr) {
1451 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1452 assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1453 jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1454 return is_permanent_conv;
1456 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1457 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1458 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1459 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1460 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1463 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1464 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1465 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1466 jboolean is_permanent_conv = obj->node_failure.is_permanent;
1467 return is_permanent_conv;
1469 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1470 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1472 case LDKCOption_NetworkUpdateZ_Some: return 0;
1473 case LDKCOption_NetworkUpdateZ_None: return 1;
1477 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1478 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1479 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1480 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1483 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1484 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1486 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1487 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1488 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1492 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1493 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1494 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1495 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1496 uint32_t outpoint_ref = 0;
1497 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1498 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1499 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1500 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
1501 return outpoint_ref;
1503 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1504 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1505 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1506 uint32_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1507 return (uint32_t)output_ref;
1509 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1510 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1511 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1512 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1513 uint32_t delayed_payment_output_ref = 0;
1514 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1515 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1516 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1517 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
1518 return delayed_payment_output_ref;
1520 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1521 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1522 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1523 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1524 uint32_t static_payment_output_ref = 0;
1525 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1526 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1527 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1528 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
1529 return static_payment_output_ref;
1531 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1532 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1533 for (size_t i = 0; i < ret.datalen; i++) {
1534 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1538 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1539 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1541 case LDKEvent_FundingGenerationReady: return 0;
1542 case LDKEvent_PaymentReceived: return 1;
1543 case LDKEvent_PaymentClaimed: return 2;
1544 case LDKEvent_PaymentSent: return 3;
1545 case LDKEvent_PaymentFailed: return 4;
1546 case LDKEvent_PaymentPathSuccessful: return 5;
1547 case LDKEvent_PaymentPathFailed: return 6;
1548 case LDKEvent_PendingHTLCsForwardable: return 7;
1549 case LDKEvent_SpendableOutputs: return 8;
1550 case LDKEvent_PaymentForwarded: return 9;
1551 case LDKEvent_ChannelClosed: return 10;
1552 case LDKEvent_DiscardFunding: return 11;
1553 case LDKEvent_OpenChannelRequest: return 12;
1557 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1558 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1559 assert(obj->tag == LDKEvent_FundingGenerationReady);
1560 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1561 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1562 return temporary_channel_id_arr;
1564 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint32_t ptr) {
1565 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1566 assert(obj->tag == LDKEvent_FundingGenerationReady);
1567 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1568 memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1569 return counterparty_node_id_arr;
1571 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1572 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1573 assert(obj->tag == LDKEvent_FundingGenerationReady);
1574 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1575 return channel_value_satoshis_conv;
1577 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1578 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1579 assert(obj->tag == LDKEvent_FundingGenerationReady);
1580 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1581 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1582 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1583 return output_script_arr;
1585 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1586 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1587 assert(obj->tag == LDKEvent_FundingGenerationReady);
1588 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1589 return user_channel_id_conv;
1591 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1592 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1593 assert(obj->tag == LDKEvent_PaymentReceived);
1594 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1595 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1596 return payment_hash_arr;
1598 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint32_t ptr) {
1599 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1600 assert(obj->tag == LDKEvent_PaymentReceived);
1601 int64_t amount_msat_conv = obj->payment_received.amount_msat;
1602 return amount_msat_conv;
1604 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1605 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1606 assert(obj->tag == LDKEvent_PaymentReceived);
1607 uint32_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
1610 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint32_t ptr) {
1611 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1612 assert(obj->tag == LDKEvent_PaymentClaimed);
1613 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1614 memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1615 return payment_hash_arr;
1617 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint32_t ptr) {
1618 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1619 assert(obj->tag == LDKEvent_PaymentClaimed);
1620 int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1621 return amount_msat_conv;
1623 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint32_t ptr) {
1624 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1625 assert(obj->tag == LDKEvent_PaymentClaimed);
1626 uint32_t purpose_ref = ((uintptr_t)&obj->payment_claimed.purpose) | 1;
1629 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1630 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1631 assert(obj->tag == LDKEvent_PaymentSent);
1632 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1633 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1634 return payment_id_arr;
1636 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1637 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1638 assert(obj->tag == LDKEvent_PaymentSent);
1639 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1640 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1641 return payment_preimage_arr;
1643 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1644 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1645 assert(obj->tag == LDKEvent_PaymentSent);
1646 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1647 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1648 return payment_hash_arr;
1650 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1651 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1652 assert(obj->tag == LDKEvent_PaymentSent);
1653 uint32_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
1654 return fee_paid_msat_ref;
1656 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1657 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1658 assert(obj->tag == LDKEvent_PaymentFailed);
1659 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1660 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1661 return payment_id_arr;
1663 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1664 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1665 assert(obj->tag == LDKEvent_PaymentFailed);
1666 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1667 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1668 return payment_hash_arr;
1670 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1671 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1672 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1673 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1674 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1675 return payment_id_arr;
1677 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1678 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1679 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1680 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1681 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1682 return payment_hash_arr;
1684 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1685 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1686 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1687 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1688 uint32_tArray path_arr = NULL;
1689 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1690 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1691 for (size_t k = 0; k < path_var.datalen; k++) {
1692 LDKRouteHop path_conv_10_var = path_var.data[k];
1693 uint32_t path_conv_10_ref = 0;
1694 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1695 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1696 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1697 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1698 path_arr_ptr[k] = path_conv_10_ref;
1703 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1704 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1705 assert(obj->tag == LDKEvent_PaymentPathFailed);
1706 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1707 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1708 return payment_id_arr;
1710 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1711 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1712 assert(obj->tag == LDKEvent_PaymentPathFailed);
1713 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1714 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1715 return payment_hash_arr;
1717 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1718 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1719 assert(obj->tag == LDKEvent_PaymentPathFailed);
1720 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1721 return rejected_by_dest_conv;
1723 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1724 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1725 assert(obj->tag == LDKEvent_PaymentPathFailed);
1726 uint32_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
1727 return network_update_ref;
1729 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1730 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1731 assert(obj->tag == LDKEvent_PaymentPathFailed);
1732 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1733 return all_paths_failed_conv;
1735 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1736 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1737 assert(obj->tag == LDKEvent_PaymentPathFailed);
1738 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1739 uint32_tArray path_arr = NULL;
1740 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1741 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1742 for (size_t k = 0; k < path_var.datalen; k++) {
1743 LDKRouteHop path_conv_10_var = path_var.data[k];
1744 uint32_t path_conv_10_ref = 0;
1745 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1746 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1747 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1748 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1749 path_arr_ptr[k] = path_conv_10_ref;
1754 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1755 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1756 assert(obj->tag == LDKEvent_PaymentPathFailed);
1757 uint32_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
1758 return short_channel_id_ref;
1760 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1761 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1762 assert(obj->tag == LDKEvent_PaymentPathFailed);
1763 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1764 uint32_t retry_ref = 0;
1765 if ((uintptr_t)retry_var.inner > 4096) {
1766 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1767 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1768 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1769 retry_ref = (uintptr_t)retry_var.inner & ~1;
1773 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1774 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1775 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1776 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1777 return time_forwardable_conv;
1779 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1780 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1781 assert(obj->tag == LDKEvent_SpendableOutputs);
1782 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1783 uint32_tArray outputs_arr = NULL;
1784 outputs_arr = init_uint32_tArray(outputs_var.datalen, __LINE__);
1785 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1786 for (size_t b = 0; b < outputs_var.datalen; b++) {
1787 uint32_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
1788 outputs_arr_ptr[b] = outputs_conv_27_ref;
1793 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint32_t ptr) {
1794 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1795 assert(obj->tag == LDKEvent_PaymentForwarded);
1796 int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1797 memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1798 return prev_channel_id_arr;
1800 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint32_t ptr) {
1801 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1802 assert(obj->tag == LDKEvent_PaymentForwarded);
1803 int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1804 memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1805 return next_channel_id_arr;
1807 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1808 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1809 assert(obj->tag == LDKEvent_PaymentForwarded);
1810 uint32_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1811 return fee_earned_msat_ref;
1813 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1814 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1815 assert(obj->tag == LDKEvent_PaymentForwarded);
1816 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1817 return claim_from_onchain_tx_conv;
1819 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1820 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1821 assert(obj->tag == LDKEvent_ChannelClosed);
1822 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1823 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1824 return channel_id_arr;
1826 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1827 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1828 assert(obj->tag == LDKEvent_ChannelClosed);
1829 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1830 return user_channel_id_conv;
1832 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1833 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1834 assert(obj->tag == LDKEvent_ChannelClosed);
1835 uint32_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
1838 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1839 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1840 assert(obj->tag == LDKEvent_DiscardFunding);
1841 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1842 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1843 return channel_id_arr;
1845 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1846 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1847 assert(obj->tag == LDKEvent_DiscardFunding);
1848 LDKTransaction transaction_var = obj->discard_funding.transaction;
1849 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1850 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1851 return transaction_arr;
1853 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint32_t ptr) {
1854 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1855 assert(obj->tag == LDKEvent_OpenChannelRequest);
1856 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1857 memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1858 return temporary_channel_id_arr;
1860 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint32_t ptr) {
1861 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1862 assert(obj->tag == LDKEvent_OpenChannelRequest);
1863 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1864 memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1865 return counterparty_node_id_arr;
1867 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint32_t ptr) {
1868 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1869 assert(obj->tag == LDKEvent_OpenChannelRequest);
1870 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1871 return funding_satoshis_conv;
1873 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint32_t ptr) {
1874 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1875 assert(obj->tag == LDKEvent_OpenChannelRequest);
1876 int64_t push_msat_conv = obj->open_channel_request.push_msat;
1877 return push_msat_conv;
1879 uint32_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint32_t ptr) {
1880 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1881 assert(obj->tag == LDKEvent_OpenChannelRequest);
1882 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1883 uint32_t channel_type_ref = 0;
1884 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1885 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1886 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1887 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
1888 return channel_type_ref;
1890 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
1891 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1893 case LDKCOption_EventZ_Some: return 0;
1894 case LDKCOption_EventZ_None: return 1;
1898 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
1899 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1900 assert(obj->tag == LDKCOption_EventZ_Some);
1901 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1904 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1905 CHECK(owner->result_ok);
1906 return COption_EventZ_clone(&*owner->contents.result);
1908 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
1909 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1910 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1911 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1912 uint32_t ret_ref = (uintptr_t)ret_copy;
1916 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1917 CHECK(!owner->result_ok);
1918 return DecodeError_clone(&*owner->contents.err);
1920 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
1921 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1922 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1923 uint32_t ret_ref = 0;
1924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1927 ret_ref = (uintptr_t)ret_var.inner;
1928 if (ret_var.is_owned) {
1934 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
1935 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1937 case LDKErrorAction_DisconnectPeer: return 0;
1938 case LDKErrorAction_IgnoreError: return 1;
1939 case LDKErrorAction_IgnoreAndLog: return 2;
1940 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1941 case LDKErrorAction_SendErrorMessage: return 4;
1942 case LDKErrorAction_SendWarningMessage: return 5;
1946 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
1947 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1948 assert(obj->tag == LDKErrorAction_DisconnectPeer);
1949 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1950 uint32_t msg_ref = 0;
1951 if ((uintptr_t)msg_var.inner > 4096) {
1952 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1953 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1954 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1955 msg_ref = (uintptr_t)msg_var.inner & ~1;
1959 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
1960 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1961 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
1962 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1963 return ignore_and_log_conv;
1965 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
1966 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1967 assert(obj->tag == LDKErrorAction_SendErrorMessage);
1968 LDKErrorMessage msg_var = obj->send_error_message.msg;
1969 uint32_t msg_ref = 0;
1970 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1971 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1972 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1973 msg_ref = (uintptr_t)msg_var.inner & ~1;
1976 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint32_t ptr) {
1977 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1978 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1979 LDKWarningMessage msg_var = obj->send_warning_message.msg;
1980 uint32_t msg_ref = 0;
1981 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1984 msg_ref = (uintptr_t)msg_var.inner & ~1;
1987 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint32_t ptr) {
1988 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1989 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1990 uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
1991 return log_level_conv;
1993 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
1994 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1996 case LDKMessageSendEvent_SendAcceptChannel: return 0;
1997 case LDKMessageSendEvent_SendOpenChannel: return 1;
1998 case LDKMessageSendEvent_SendFundingCreated: return 2;
1999 case LDKMessageSendEvent_SendFundingSigned: return 3;
2000 case LDKMessageSendEvent_SendChannelReady: return 4;
2001 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2002 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2003 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2004 case LDKMessageSendEvent_SendClosingSigned: return 8;
2005 case LDKMessageSendEvent_SendShutdown: return 9;
2006 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2007 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2008 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2009 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2010 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2011 case LDKMessageSendEvent_HandleError: return 15;
2012 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2013 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2014 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2015 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2019 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2020 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2021 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2022 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2023 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2026 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2027 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2028 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2029 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2030 uint32_t msg_ref = 0;
2031 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2032 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2033 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2034 msg_ref = (uintptr_t)msg_var.inner & ~1;
2037 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2038 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2039 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2040 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2041 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2044 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2045 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2046 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2047 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2048 uint32_t msg_ref = 0;
2049 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2050 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2051 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2052 msg_ref = (uintptr_t)msg_var.inner & ~1;
2055 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2056 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2057 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2058 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2059 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2062 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2063 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2064 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2065 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2066 uint32_t msg_ref = 0;
2067 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2068 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2069 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2070 msg_ref = (uintptr_t)msg_var.inner & ~1;
2073 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2074 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2075 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2076 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2077 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2080 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2081 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2082 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2083 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2084 uint32_t msg_ref = 0;
2085 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2086 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2087 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2088 msg_ref = (uintptr_t)msg_var.inner & ~1;
2091 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint32_t ptr) {
2092 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2093 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2094 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2095 memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2098 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint32_t ptr) {
2099 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2100 assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2101 LDKChannelReady msg_var = obj->send_channel_ready.msg;
2102 uint32_t msg_ref = 0;
2103 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2104 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2105 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2106 msg_ref = (uintptr_t)msg_var.inner & ~1;
2109 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2110 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2111 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2112 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2113 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2116 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2117 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2118 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2119 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2120 uint32_t msg_ref = 0;
2121 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2122 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2123 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2124 msg_ref = (uintptr_t)msg_var.inner & ~1;
2127 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
2128 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2129 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2130 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2131 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2134 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
2135 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2136 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2137 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2138 uint32_t updates_ref = 0;
2139 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2140 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2141 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2142 updates_ref = (uintptr_t)updates_var.inner & ~1;
2145 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
2146 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2147 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2148 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2149 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2152 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
2153 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2154 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2155 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2156 uint32_t msg_ref = 0;
2157 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2158 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2159 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2160 msg_ref = (uintptr_t)msg_var.inner & ~1;
2163 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
2164 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2165 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2166 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2167 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2170 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
2171 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2172 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2173 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2174 uint32_t msg_ref = 0;
2175 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2176 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2177 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2178 msg_ref = (uintptr_t)msg_var.inner & ~1;
2181 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
2182 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2183 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2184 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2185 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2188 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
2189 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2190 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2191 LDKShutdown msg_var = obj->send_shutdown.msg;
2192 uint32_t msg_ref = 0;
2193 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2194 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2195 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2196 msg_ref = (uintptr_t)msg_var.inner & ~1;
2199 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
2200 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2201 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2202 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2203 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2206 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
2207 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2208 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2209 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2210 uint32_t msg_ref = 0;
2211 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2212 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2213 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2214 msg_ref = (uintptr_t)msg_var.inner & ~1;
2217 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
2218 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2219 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2220 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2221 uint32_t msg_ref = 0;
2222 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2223 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2224 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2225 msg_ref = (uintptr_t)msg_var.inner & ~1;
2228 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
2229 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2230 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2231 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2232 uint32_t update_msg_ref = 0;
2233 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2234 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2235 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2236 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2237 return update_msg_ref;
2239 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
2240 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2241 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2242 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2243 uint32_t msg_ref = 0;
2244 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2245 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2246 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2247 msg_ref = (uintptr_t)msg_var.inner & ~1;
2250 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
2251 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2252 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2253 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2254 uint32_t msg_ref = 0;
2255 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2256 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2257 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2258 msg_ref = (uintptr_t)msg_var.inner & ~1;
2261 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
2262 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2263 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2264 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2265 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2268 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
2269 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2270 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2271 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2272 uint32_t msg_ref = 0;
2273 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2274 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2275 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2276 msg_ref = (uintptr_t)msg_var.inner & ~1;
2279 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
2280 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2281 assert(obj->tag == LDKMessageSendEvent_HandleError);
2282 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2283 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2286 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
2287 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2288 assert(obj->tag == LDKMessageSendEvent_HandleError);
2289 uint32_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2292 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
2293 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2294 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2295 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2296 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2299 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
2300 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2301 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2302 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2303 uint32_t msg_ref = 0;
2304 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2305 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2306 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2307 msg_ref = (uintptr_t)msg_var.inner & ~1;
2310 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
2311 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2312 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2313 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2314 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2317 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
2318 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2319 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2320 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2321 uint32_t msg_ref = 0;
2322 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2323 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2324 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2325 msg_ref = (uintptr_t)msg_var.inner & ~1;
2328 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
2329 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2330 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2331 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2332 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2335 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
2336 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2337 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2338 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2339 uint32_t msg_ref = 0;
2340 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2341 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2342 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2343 msg_ref = (uintptr_t)msg_var.inner & ~1;
2346 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint32_t ptr) {
2347 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2348 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2349 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2350 memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2353 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint32_t ptr) {
2354 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2355 assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2356 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2357 uint32_t msg_ref = 0;
2358 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2359 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2360 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2361 msg_ref = (uintptr_t)msg_var.inner & ~1;
2364 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2365 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2366 for (size_t i = 0; i < ret.datalen; i++) {
2367 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2371 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2372 CHECK(owner->result_ok);
2373 return TxOut_clone(&*owner->contents.result);
2375 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
2376 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2377 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2378 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2379 return (uint32_t)ret_ref;
2382 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2383 CHECK(!owner->result_ok);
2384 return AccessError_clone(&*owner->contents.err);
2386 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
2387 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
2388 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2392 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2395 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
2396 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2397 uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2401 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2404 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
2405 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
2406 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2407 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2408 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2412 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2413 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2414 for (size_t i = 0; i < ret.datalen; i++) {
2415 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2419 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2420 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2421 for (size_t i = 0; i < ret.datalen; i++) {
2422 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2426 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2427 CHECK(owner->result_ok);
2428 return *owner->contents.result;
2430 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
2431 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2432 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2435 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2436 CHECK(!owner->result_ok);
2437 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2439 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
2440 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
2441 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2445 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
2446 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2448 case LDKMonitorEvent_HTLCEvent: return 0;
2449 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2450 case LDKMonitorEvent_UpdateCompleted: return 2;
2451 case LDKMonitorEvent_UpdateFailed: return 3;
2455 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
2456 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2457 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2458 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2459 uint32_t htlc_event_ref = 0;
2460 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2461 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2462 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2463 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2464 return htlc_event_ref;
2466 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
2467 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2468 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2469 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2470 uint32_t commitment_tx_confirmed_ref = 0;
2471 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2472 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2473 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2474 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2475 return commitment_tx_confirmed_ref;
2477 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
2478 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2479 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2480 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2481 uint32_t funding_txo_ref = 0;
2482 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2483 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2484 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2485 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2486 return funding_txo_ref;
2488 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
2489 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2490 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2491 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2492 return monitor_update_id_conv;
2494 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
2495 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2496 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2497 LDKOutPoint update_failed_var = obj->update_failed;
2498 uint32_t update_failed_ref = 0;
2499 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2500 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2501 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2502 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2503 return update_failed_ref;
2505 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2506 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2507 for (size_t i = 0; i < ret.datalen; i++) {
2508 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2512 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2513 return OutPoint_clone(&owner->a);
2515 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_a(uint32_t owner) {
2516 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2517 LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv);
2518 uint32_t ret_ref = 0;
2519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2522 ret_ref = (uintptr_t)ret_var.inner;
2523 if (ret_var.is_owned) {
2529 static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){
2530 return CVec_MonitorEventZ_clone(&owner->b);
2532 uint32_tArray __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_get_b(uint32_t owner) {
2533 LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1);
2534 LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv);
2535 uint32_tArray ret_arr = NULL;
2536 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
2537 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
2538 for (size_t o = 0; o < ret_var.datalen; o++) {
2539 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2540 *ret_conv_14_copy = ret_var.data[o];
2541 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
2542 ret_arr_ptr[o] = ret_conv_14_ref;
2549 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) {
2550 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen };
2551 for (size_t i = 0; i < ret.datalen; i++) {
2552 ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]);
2556 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
2557 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2559 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2560 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2564 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
2565 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2566 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2567 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2568 *some_conv = obj->some;
2569 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2570 return ((uint32_t)some_conv);
2572 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2573 CHECK(owner->result_ok);
2574 return FixedPenaltyScorer_clone(&*owner->contents.result);
2576 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint32_t owner) {
2577 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2578 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2579 uint32_t ret_ref = 0;
2580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2583 ret_ref = (uintptr_t)ret_var.inner;
2584 if (ret_var.is_owned) {
2590 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2591 CHECK(!owner->result_ok);
2592 return DecodeError_clone(&*owner->contents.err);
2594 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint32_t owner) {
2595 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2596 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2597 uint32_t ret_ref = 0;
2598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2601 ret_ref = (uintptr_t)ret_var.inner;
2602 if (ret_var.is_owned) {
2608 typedef struct LDKLogger_JCalls {
2609 atomic_size_t refcnt;
2610 uint32_t instance_ptr;
2612 static void LDKLogger_JCalls_free(void* this_arg) {
2613 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2614 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2618 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2619 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2620 LDKRecord record_var = *record;
2621 uint32_t record_ref = 0;
2622 record_var = Record_clone(&record_var);
2623 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2624 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2625 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2626 record_ref = (uintptr_t)record_var.inner;
2627 if (record_var.is_owned) {
2630 js_invoke_function_u_u(j_calls->instance_ptr, 0, (uint32_t)record_ref);
2632 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2633 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2634 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2636 static inline LDKLogger LDKLogger_init (JSValue o) {
2637 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2638 atomic_init(&calls->refcnt, 1);
2639 calls->instance_ptr = o;
2642 .this_arg = (void*) calls,
2643 .log = log_LDKLogger_jcall,
2644 .free = LDKLogger_JCalls_free,
2648 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2649 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2650 *res_ptr = LDKLogger_init(o);
2651 return (long)res_ptr;
2653 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2654 CHECK(owner->result_ok);
2655 return &*owner->contents.result;
2657 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint32_t owner) {
2658 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2659 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2660 uint32_t ret_ref = 0;
2661 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2662 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2664 ret_ref = (uintptr_t)ret_var.inner & ~1;
2668 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2669 CHECK(!owner->result_ok);
2670 return DecodeError_clone(&*owner->contents.err);
2672 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint32_t owner) {
2673 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2674 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2675 uint32_t ret_ref = 0;
2676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2679 ret_ref = (uintptr_t)ret_var.inner;
2680 if (ret_var.is_owned) {
2686 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2687 CHECK(owner->result_ok);
2688 return InitFeatures_clone(&*owner->contents.result);
2690 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2691 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2692 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2693 uint32_t ret_ref = 0;
2694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2697 ret_ref = (uintptr_t)ret_var.inner;
2698 if (ret_var.is_owned) {
2704 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2705 CHECK(!owner->result_ok);
2706 return DecodeError_clone(&*owner->contents.err);
2708 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2709 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2710 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2711 uint32_t ret_ref = 0;
2712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2715 ret_ref = (uintptr_t)ret_var.inner;
2716 if (ret_var.is_owned) {
2722 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2723 CHECK(owner->result_ok);
2724 return ChannelFeatures_clone(&*owner->contents.result);
2726 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2727 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2728 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2729 uint32_t ret_ref = 0;
2730 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2731 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2733 ret_ref = (uintptr_t)ret_var.inner;
2734 if (ret_var.is_owned) {
2740 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2741 CHECK(!owner->result_ok);
2742 return DecodeError_clone(&*owner->contents.err);
2744 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2745 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2746 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2747 uint32_t ret_ref = 0;
2748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2751 ret_ref = (uintptr_t)ret_var.inner;
2752 if (ret_var.is_owned) {
2758 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2759 CHECK(owner->result_ok);
2760 return NodeFeatures_clone(&*owner->contents.result);
2762 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2763 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2764 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2765 uint32_t ret_ref = 0;
2766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2769 ret_ref = (uintptr_t)ret_var.inner;
2770 if (ret_var.is_owned) {
2776 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2777 CHECK(!owner->result_ok);
2778 return DecodeError_clone(&*owner->contents.err);
2780 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2781 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2782 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2783 uint32_t ret_ref = 0;
2784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2787 ret_ref = (uintptr_t)ret_var.inner;
2788 if (ret_var.is_owned) {
2794 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2795 CHECK(owner->result_ok);
2796 return InvoiceFeatures_clone(&*owner->contents.result);
2798 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2799 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2800 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2801 uint32_t ret_ref = 0;
2802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2805 ret_ref = (uintptr_t)ret_var.inner;
2806 if (ret_var.is_owned) {
2812 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2813 CHECK(!owner->result_ok);
2814 return DecodeError_clone(&*owner->contents.err);
2816 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2817 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2818 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2819 uint32_t ret_ref = 0;
2820 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2821 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2823 ret_ref = (uintptr_t)ret_var.inner;
2824 if (ret_var.is_owned) {
2830 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2831 CHECK(owner->result_ok);
2832 return ChannelTypeFeatures_clone(&*owner->contents.result);
2834 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2835 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2836 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2837 uint32_t ret_ref = 0;
2838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2841 ret_ref = (uintptr_t)ret_var.inner;
2842 if (ret_var.is_owned) {
2848 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2849 CHECK(!owner->result_ok);
2850 return DecodeError_clone(&*owner->contents.err);
2852 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2853 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2854 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2855 uint32_t ret_ref = 0;
2856 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2857 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2859 ret_ref = (uintptr_t)ret_var.inner;
2860 if (ret_var.is_owned) {
2866 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2867 CHECK(owner->result_ok);
2868 return NodeId_clone(&*owner->contents.result);
2870 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
2871 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2872 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2873 uint32_t ret_ref = 0;
2874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2877 ret_ref = (uintptr_t)ret_var.inner;
2878 if (ret_var.is_owned) {
2884 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2885 CHECK(!owner->result_ok);
2886 return DecodeError_clone(&*owner->contents.err);
2888 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
2889 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
2890 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2891 uint32_t ret_ref = 0;
2892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2895 ret_ref = (uintptr_t)ret_var.inner;
2896 if (ret_var.is_owned) {
2902 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2903 CHECK(owner->result_ok);
2904 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2906 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
2907 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2908 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2909 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2910 uint32_t ret_ref = (uintptr_t)ret_copy;
2914 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2915 CHECK(!owner->result_ok);
2916 return DecodeError_clone(&*owner->contents.err);
2918 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
2919 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
2920 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2921 uint32_t ret_ref = 0;
2922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2925 ret_ref = (uintptr_t)ret_var.inner;
2926 if (ret_var.is_owned) {
2932 typedef struct LDKAccess_JCalls {
2933 atomic_size_t refcnt;
2934 uint32_t instance_ptr;
2936 static void LDKAccess_JCalls_free(void* this_arg) {
2937 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2938 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2942 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2943 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2944 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2945 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2946 int64_t short_channel_id_conv = short_channel_id;
2947 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id_conv);
2948 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2949 CHECK_ACCESS(ret_ptr);
2950 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2954 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2955 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2956 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2958 static inline LDKAccess LDKAccess_init (JSValue o) {
2959 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2960 atomic_init(&calls->refcnt, 1);
2961 calls->instance_ptr = o;
2964 .this_arg = (void*) calls,
2965 .get_utxo = get_utxo_LDKAccess_jcall,
2966 .free = LDKAccess_JCalls_free,
2970 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2971 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2972 *res_ptr = LDKAccess_init(o);
2973 return (long)res_ptr;
2975 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) {
2976 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
2977 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2978 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2979 unsigned char genesis_hash_arr[32];
2980 CHECK(genesis_hash->arr_len == 32);
2981 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2982 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2983 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2984 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2985 return (uint32_t)ret_conv;
2988 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
2989 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
2991 case LDKCOption_AccessZ_Some: return 0;
2992 case LDKCOption_AccessZ_None: return 1;
2996 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
2997 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
2998 assert(obj->tag == LDKCOption_AccessZ_Some);
2999 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3000 *some_ret = obj->some;
3001 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3002 if ((*some_ret).free == LDKAccess_JCalls_free) {
3003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3004 LDKAccess_JCalls_cloned(&(*some_ret));
3006 return (uint32_t)some_ret;
3008 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3009 CHECK(owner->result_ok);
3010 return *owner->contents.result;
3012 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
3013 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3014 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3018 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3019 CHECK(!owner->result_ok);
3020 return LightningError_clone(&*owner->contents.err);
3022 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
3023 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
3024 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3025 uint32_t ret_ref = 0;
3026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3029 ret_ref = (uintptr_t)ret_var.inner;
3030 if (ret_var.is_owned) {
3036 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3037 return ChannelAnnouncement_clone(&owner->a);
3039 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
3040 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3041 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3042 uint32_t ret_ref = 0;
3043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3046 ret_ref = (uintptr_t)ret_var.inner;
3047 if (ret_var.is_owned) {
3053 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3054 return ChannelUpdate_clone(&owner->b);
3056 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
3057 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3058 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3059 uint32_t ret_ref = 0;
3060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3063 ret_ref = (uintptr_t)ret_var.inner;
3064 if (ret_var.is_owned) {
3070 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3071 return ChannelUpdate_clone(&owner->c);
3073 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
3074 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
3075 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3076 uint32_t ret_ref = 0;
3077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3080 ret_ref = (uintptr_t)ret_var.inner;
3081 if (ret_var.is_owned) {
3087 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3088 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3089 for (size_t i = 0; i < ret.datalen; i++) {
3090 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3094 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3095 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3096 for (size_t i = 0; i < ret.datalen; i++) {
3097 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3101 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3102 CHECK(owner->result_ok);
3103 return *owner->contents.result;
3105 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
3106 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3107 CResult_NoneLightningErrorZ_get_ok(owner_conv);
3110 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3111 CHECK(!owner->result_ok);
3112 return LightningError_clone(&*owner->contents.err);
3114 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
3115 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
3116 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3117 uint32_t ret_ref = 0;
3118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3121 ret_ref = (uintptr_t)ret_var.inner;
3122 if (ret_var.is_owned) {
3128 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3129 CHECK(owner->result_ok);
3130 return ChannelUpdateInfo_clone(&*owner->contents.result);
3132 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
3133 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3134 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3135 uint32_t ret_ref = 0;
3136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3139 ret_ref = (uintptr_t)ret_var.inner;
3140 if (ret_var.is_owned) {
3146 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3147 CHECK(!owner->result_ok);
3148 return DecodeError_clone(&*owner->contents.err);
3150 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
3151 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
3152 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3153 uint32_t ret_ref = 0;
3154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3157 ret_ref = (uintptr_t)ret_var.inner;
3158 if (ret_var.is_owned) {
3164 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3165 CHECK(owner->result_ok);
3166 return ChannelInfo_clone(&*owner->contents.result);
3168 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3169 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3170 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3171 uint32_t ret_ref = 0;
3172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3175 ret_ref = (uintptr_t)ret_var.inner;
3176 if (ret_var.is_owned) {
3182 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3183 CHECK(!owner->result_ok);
3184 return DecodeError_clone(&*owner->contents.err);
3186 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3187 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3188 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3189 uint32_t ret_ref = 0;
3190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3193 ret_ref = (uintptr_t)ret_var.inner;
3194 if (ret_var.is_owned) {
3200 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3201 CHECK(owner->result_ok);
3202 return RoutingFees_clone(&*owner->contents.result);
3204 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3205 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3206 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3207 uint32_t ret_ref = 0;
3208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3211 ret_ref = (uintptr_t)ret_var.inner;
3212 if (ret_var.is_owned) {
3218 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3219 CHECK(!owner->result_ok);
3220 return DecodeError_clone(&*owner->contents.err);
3222 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3223 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3224 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3225 uint32_t ret_ref = 0;
3226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3229 ret_ref = (uintptr_t)ret_var.inner;
3230 if (ret_var.is_owned) {
3236 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3237 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3239 case LDKNetAddress_IPv4: return 0;
3240 case LDKNetAddress_IPv6: return 1;
3241 case LDKNetAddress_OnionV2: return 2;
3242 case LDKNetAddress_OnionV3: return 3;
3246 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3247 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3248 assert(obj->tag == LDKNetAddress_IPv4);
3249 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3250 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3253 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3254 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3255 assert(obj->tag == LDKNetAddress_IPv4);
3256 int16_t port_conv = obj->i_pv4.port;
3259 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3260 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3261 assert(obj->tag == LDKNetAddress_IPv6);
3262 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3263 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3266 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3267 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3268 assert(obj->tag == LDKNetAddress_IPv6);
3269 int16_t port_conv = obj->i_pv6.port;
3272 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3273 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3274 assert(obj->tag == LDKNetAddress_OnionV2);
3275 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3276 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3277 return onion_v2_arr;
3279 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3280 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3281 assert(obj->tag == LDKNetAddress_OnionV3);
3282 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3283 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3284 return ed25519_pubkey_arr;
3286 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3287 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3288 assert(obj->tag == LDKNetAddress_OnionV3);
3289 int16_t checksum_conv = obj->onion_v3.checksum;
3290 return checksum_conv;
3292 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3293 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3294 assert(obj->tag == LDKNetAddress_OnionV3);
3295 int8_t version_conv = obj->onion_v3.version;
3296 return version_conv;
3298 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3299 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3300 assert(obj->tag == LDKNetAddress_OnionV3);
3301 int16_t port_conv = obj->onion_v3.port;
3304 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3305 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3306 for (size_t i = 0; i < ret.datalen; i++) {
3307 ret.data[i] = NetAddress_clone(&orig->data[i]);
3311 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3312 CHECK(owner->result_ok);
3313 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3315 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3316 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3317 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3318 uint32_t ret_ref = 0;
3319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3322 ret_ref = (uintptr_t)ret_var.inner;
3323 if (ret_var.is_owned) {
3329 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3330 CHECK(!owner->result_ok);
3331 return DecodeError_clone(&*owner->contents.err);
3333 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3334 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3335 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3336 uint32_t ret_ref = 0;
3337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3340 ret_ref = (uintptr_t)ret_var.inner;
3341 if (ret_var.is_owned) {
3347 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3348 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3349 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3352 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3353 CHECK(owner->result_ok);
3354 return NodeInfo_clone(&*owner->contents.result);
3356 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3357 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3358 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3359 uint32_t ret_ref = 0;
3360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3363 ret_ref = (uintptr_t)ret_var.inner;
3364 if (ret_var.is_owned) {
3370 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3371 CHECK(!owner->result_ok);
3372 return DecodeError_clone(&*owner->contents.err);
3374 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3375 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3376 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3377 uint32_t ret_ref = 0;
3378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3381 ret_ref = (uintptr_t)ret_var.inner;
3382 if (ret_var.is_owned) {
3388 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3389 CHECK(owner->result_ok);
3390 return &*owner->contents.result;
3392 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3393 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3394 LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3395 uint32_t ret_ref = 0;
3396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3399 ret_ref = (uintptr_t)ret_var.inner & ~1;
3403 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3404 CHECK(!owner->result_ok);
3405 return DecodeError_clone(&*owner->contents.err);
3407 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3408 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3409 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3410 uint32_t ret_ref = 0;
3411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3414 ret_ref = (uintptr_t)ret_var.inner;
3415 if (ret_var.is_owned) {
3421 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
3422 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3424 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3425 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3429 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
3430 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3431 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3432 LDKCVec_NetAddressZ some_var = obj->some;
3433 uint32_tArray some_arr = NULL;
3434 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
3435 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
3436 for (size_t m = 0; m < some_var.datalen; m++) {
3437 uint32_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
3438 some_arr_ptr[m] = some_conv_12_ref;
3443 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3444 CHECK(owner->result_ok);
3445 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3447 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3448 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3449 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3450 uint32_t ret_ref = 0;
3451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3454 ret_ref = (uintptr_t)ret_var.inner;
3455 if (ret_var.is_owned) {
3461 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3462 CHECK(!owner->result_ok);
3463 return DecodeError_clone(&*owner->contents.err);
3465 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3466 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3467 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3468 uint32_t ret_ref = 0;
3469 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3470 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3472 ret_ref = (uintptr_t)ret_var.inner;
3473 if (ret_var.is_owned) {
3479 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3480 CHECK(owner->result_ok);
3481 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3483 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3484 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3485 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3486 uint32_t ret_ref = 0;
3487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3490 ret_ref = (uintptr_t)ret_var.inner;
3491 if (ret_var.is_owned) {
3497 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3498 CHECK(!owner->result_ok);
3499 return DecodeError_clone(&*owner->contents.err);
3501 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3502 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3503 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3504 uint32_t ret_ref = 0;
3505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3508 ret_ref = (uintptr_t)ret_var.inner;
3509 if (ret_var.is_owned) {
3515 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3516 CHECK(owner->result_ok);
3517 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3519 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
3520 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3521 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3522 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3523 uint32_t ret_ref = (uintptr_t)ret_copy;
3527 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3528 CHECK(!owner->result_ok);
3529 return DecodeError_clone(&*owner->contents.err);
3531 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
3532 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3533 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3534 uint32_t ret_ref = 0;
3535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3538 ret_ref = (uintptr_t)ret_var.inner;
3539 if (ret_var.is_owned) {
3545 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3546 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3547 for (size_t i = 0; i < ret.datalen; i++) {
3548 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3552 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3555 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
3556 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3557 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3558 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3562 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3565 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
3566 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3567 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3568 ptrArray ret_arr = NULL;
3569 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3570 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3571 for (size_t m = 0; m < ret_var.datalen; m++) {
3572 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3573 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3574 ret_arr_ptr[m] = ret_conv_12_arr;
3580 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3581 CHECK(owner->result_ok);
3582 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3584 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
3585 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3586 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3587 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3588 return ((uint32_t)ret_conv);
3591 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3592 CHECK(!owner->result_ok);
3593 return *owner->contents.err;
3595 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
3596 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3597 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3600 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3601 CHECK(owner->result_ok);
3602 return *owner->contents.result;
3604 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
3605 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3606 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3607 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3611 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3612 CHECK(!owner->result_ok);
3613 return *owner->contents.err;
3615 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
3616 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3617 CResult_SignatureNoneZ_get_err(owner_conv);
3620 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3623 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
3624 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3625 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3626 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3630 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3633 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
3634 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3635 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3636 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3640 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3641 CHECK(owner->result_ok);
3642 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3644 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
3645 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3646 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3647 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3648 return ((uint32_t)ret_conv);
3651 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3652 CHECK(!owner->result_ok);
3653 return *owner->contents.err;
3655 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
3656 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3657 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3660 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3661 CHECK(owner->result_ok);
3662 return *owner->contents.result;
3664 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
3665 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3666 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3667 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3671 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3672 CHECK(!owner->result_ok);
3673 return *owner->contents.err;
3675 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
3676 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3677 CResult_SecretKeyNoneZ_get_err(owner_conv);
3680 typedef struct LDKBaseSign_JCalls {
3681 atomic_size_t refcnt;
3682 uint32_t instance_ptr;
3683 } LDKBaseSign_JCalls;
3684 static void LDKBaseSign_JCalls_free(void* this_arg) {
3685 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3686 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3690 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3691 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3692 int64_t idx_conv = idx;
3693 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 2, (uint32_t)idx_conv);
3694 LDKPublicKey ret_ref;
3695 CHECK(ret->arr_len == 33);
3696 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3699 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3700 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3701 int64_t idx_conv = idx;
3702 int8_tArray ret = (int8_tArray)js_invoke_function_u_b(j_calls->instance_ptr, 3, (uint32_t)idx_conv);
3703 LDKThirtyTwoBytes ret_ref;
3704 CHECK(ret->arr_len == 32);
3705 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3708 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3709 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3710 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3711 uint32_t holder_tx_ref = 0;
3712 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3713 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3714 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3715 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3716 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3717 if (holder_tx_var.is_owned) {
3720 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3721 ptrArray preimages_arr = NULL;
3722 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3723 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3724 for (size_t m = 0; m < preimages_var.datalen; m++) {
3725 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3726 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3727 preimages_arr_ptr[m] = preimages_conv_12_arr;
3730 FREE(preimages_var.data);
3731 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 4, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
3732 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3733 CHECK_ACCESS(ret_ptr);
3734 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3738 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3739 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3740 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 5);
3741 LDKThirtyTwoBytes ret_ref;
3742 CHECK(ret->arr_len == 32);
3743 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3746 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3747 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3748 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3749 uint32_t commitment_tx_ref = 0;
3750 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3751 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3754 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3755 if (commitment_tx_var.is_owned) {
3756 commitment_tx_ref |= 1;
3758 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3759 ptrArray preimages_arr = NULL;
3760 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3761 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3762 for (size_t m = 0; m < preimages_var.datalen; m++) {
3763 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3764 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3765 preimages_arr_ptr[m] = preimages_conv_12_arr;
3768 FREE(preimages_var.data);
3769 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
3770 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3771 CHECK_ACCESS(ret_ptr);
3772 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3776 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3777 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3778 int64_t idx_conv = idx;
3779 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3780 memcpy(secret_arr->elems, *secret, 32);
3781 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 7, (uint32_t)idx_conv, (uint32_t)secret_arr);
3782 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3783 CHECK_ACCESS(ret_ptr);
3784 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3788 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3789 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3790 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3791 uint32_t commitment_tx_ref = 0;
3792 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3793 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3794 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3795 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3796 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3797 if (commitment_tx_var.is_owned) {
3798 commitment_tx_ref |= 1;
3800 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 8, (uint32_t)commitment_tx_ref);
3801 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3802 CHECK_ACCESS(ret_ptr);
3803 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3807 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]) {
3808 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3809 LDKTransaction justice_tx_var = justice_tx;
3810 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3811 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3812 Transaction_free(justice_tx_var);
3813 uint32_t input_conv = input;
3814 int64_t amount_conv = amount;
3815 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3816 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3817 uint32_t ret = js_invoke_function_u_uuuu(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr);
3818 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3819 CHECK_ACCESS(ret_ptr);
3820 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3824 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) {
3825 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3826 LDKTransaction justice_tx_var = justice_tx;
3827 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3828 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3829 Transaction_free(justice_tx_var);
3830 uint32_t input_conv = input;
3831 int64_t amount_conv = amount;
3832 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3833 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3834 LDKHTLCOutputInCommitment htlc_var = *htlc;
3835 uint32_t htlc_ref = 0;
3836 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3837 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3838 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3839 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3840 htlc_ref = (uintptr_t)htlc_var.inner;
3841 if (htlc_var.is_owned) {
3844 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
3845 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3846 CHECK_ACCESS(ret_ptr);
3847 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3851 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) {
3852 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3853 LDKTransaction htlc_tx_var = htlc_tx;
3854 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3855 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3856 Transaction_free(htlc_tx_var);
3857 uint32_t input_conv = input;
3858 int64_t amount_conv = amount;
3859 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3860 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3861 LDKHTLCOutputInCommitment htlc_var = *htlc;
3862 uint32_t htlc_ref = 0;
3863 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3864 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3865 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3866 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3867 htlc_ref = (uintptr_t)htlc_var.inner;
3868 if (htlc_var.is_owned) {
3871 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, (uint32_t)input_conv, (uint32_t)amount_conv, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
3872 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3873 CHECK_ACCESS(ret_ptr);
3874 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3878 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3879 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3880 LDKClosingTransaction closing_tx_var = *closing_tx;
3881 uint32_t closing_tx_ref = 0;
3882 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3883 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3884 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3885 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3886 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3887 if (closing_tx_var.is_owned) {
3888 closing_tx_ref |= 1;
3890 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 12, (uint32_t)closing_tx_ref);
3891 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3892 CHECK_ACCESS(ret_ptr);
3893 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3897 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3898 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3899 LDKUnsignedChannelAnnouncement msg_var = *msg;
3900 uint32_t msg_ref = 0;
3901 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3902 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3903 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3904 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3905 msg_ref = (uintptr_t)msg_var.inner;
3906 if (msg_var.is_owned) {
3909 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 13, (uint32_t)msg_ref);
3910 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3911 CHECK_ACCESS(ret_ptr);
3912 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3916 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3917 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3918 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3919 uint32_t channel_parameters_ref = 0;
3920 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3921 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3922 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3923 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3924 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3925 if (channel_parameters_var.is_owned) {
3926 channel_parameters_ref |= 1;
3928 js_invoke_function_u_u(j_calls->instance_ptr, 14, (uint32_t)channel_parameters_ref);
3930 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3931 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3932 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3934 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
3935 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3936 atomic_init(&calls->refcnt, 1);
3937 calls->instance_ptr = o;
3939 LDKChannelPublicKeys pubkeys_conv;
3940 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3941 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3942 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3945 .this_arg = (void*) calls,
3946 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3947 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3948 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3949 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3950 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3951 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3952 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3953 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3954 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3955 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3956 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3957 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3958 .ready_channel = ready_channel_LDKBaseSign_jcall,
3959 .free = LDKBaseSign_JCalls_free,
3960 .pubkeys = pubkeys_conv,
3961 .set_pubkeys = NULL,
3965 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
3966 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3967 *res_ptr = LDKBaseSign_init(o, pubkeys);
3968 return (long)res_ptr;
3970 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
3971 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3972 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3973 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3974 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3975 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3979 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
3980 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3981 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3982 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3983 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3984 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3988 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) {
3989 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3991 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3992 LDKHolderCommitmentTransaction holder_tx_conv;
3993 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3994 holder_tx_conv.is_owned = false;
3995 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3996 LDKCVec_PaymentPreimageZ preimages_constr;
3997 preimages_constr.datalen = preimages->arr_len;
3998 if (preimages_constr.datalen > 0)
3999 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4001 preimages_constr.data = NULL;
4002 int8_tArray* preimages_vals = (void*) preimages->elems;
4003 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4004 int8_tArray preimages_conv_12 = preimages_vals[m];
4005 LDKThirtyTwoBytes preimages_conv_12_ref;
4006 CHECK(preimages_conv_12->arr_len == 32);
4007 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4008 preimages_constr.data[m] = preimages_conv_12_ref;
4011 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4012 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4013 return (uint32_t)ret_conv;
4016 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
4017 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4018 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4019 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4020 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4021 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4025 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) {
4026 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4027 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4028 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4029 LDKCommitmentTransaction commitment_tx_conv;
4030 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4031 commitment_tx_conv.is_owned = false;
4032 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4033 LDKCVec_PaymentPreimageZ preimages_constr;
4034 preimages_constr.datalen = preimages->arr_len;
4035 if (preimages_constr.datalen > 0)
4036 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4038 preimages_constr.data = NULL;
4039 int8_tArray* preimages_vals = (void*) preimages->elems;
4040 for (size_t m = 0; m < preimages_constr.datalen; m++) {
4041 int8_tArray preimages_conv_12 = preimages_vals[m];
4042 LDKThirtyTwoBytes preimages_conv_12_ref;
4043 CHECK(preimages_conv_12->arr_len == 32);
4044 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4045 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_u_(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_u_uu(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_u_uu(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_u_(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;
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;
5073 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5074 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5075 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5077 static inline LDKWatch LDKWatch_init (JSValue o) {
5078 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5079 atomic_init(&calls->refcnt, 1);
5080 calls->instance_ptr = o;
5083 .this_arg = (void*) calls,
5084 .watch_channel = watch_channel_LDKWatch_jcall,
5085 .update_channel = update_channel_LDKWatch_jcall,
5086 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5087 .free = LDKWatch_JCalls_free,
5091 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5092 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5093 *res_ptr = LDKWatch_init(o);
5094 return (long)res_ptr;
5096 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5097 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5098 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5099 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5100 LDKOutPoint funding_txo_conv;
5101 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5102 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5103 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5104 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5105 LDKChannelMonitor monitor_conv;
5106 monitor_conv.inner = (void*)(monitor & (~1));
5107 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5108 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5109 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5110 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5111 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5112 return (uint32_t)ret_conv;
5115 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5116 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5117 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5118 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5119 LDKOutPoint funding_txo_conv;
5120 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5121 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5122 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5123 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5124 LDKChannelMonitorUpdate update_conv;
5125 update_conv.inner = (void*)(update & (~1));
5126 update_conv.is_owned = (update & 1) || (update == 0);
5127 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5128 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5129 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5130 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5131 return (uint32_t)ret_conv;
5134 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5135 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5136 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5137 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5138 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5139 uint32_tArray ret_arr = NULL;
5140 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5141 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5142 for (size_t m = 0; m < ret_var.datalen; m++) {
5143 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
5144 *ret_conv_38_conv = ret_var.data[m];
5145 ret_arr_ptr[m] = ((uint32_t)ret_conv_38_conv);
5152 typedef struct LDKBroadcasterInterface_JCalls {
5153 atomic_size_t refcnt;
5154 uint32_t instance_ptr;
5155 } LDKBroadcasterInterface_JCalls;
5156 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5157 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5158 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5162 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5163 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5164 LDKTransaction tx_var = tx;
5165 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5166 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5167 Transaction_free(tx_var);
5168 js_invoke_function_u_u(j_calls->instance_ptr, 19, (uint32_t)tx_arr);
5170 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5171 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5172 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5174 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5175 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5176 atomic_init(&calls->refcnt, 1);
5177 calls->instance_ptr = o;
5179 LDKBroadcasterInterface ret = {
5180 .this_arg = (void*) calls,
5181 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5182 .free = LDKBroadcasterInterface_JCalls_free,
5186 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5187 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5188 *res_ptr = LDKBroadcasterInterface_init(o);
5189 return (long)res_ptr;
5191 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
5192 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5193 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5194 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5195 LDKTransaction tx_ref;
5196 tx_ref.datalen = tx->arr_len;
5197 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5198 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5199 tx_ref.data_is_owned = true;
5200 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5203 typedef struct LDKKeysInterface_JCalls {
5204 atomic_size_t refcnt;
5205 uint32_t instance_ptr;
5206 } LDKKeysInterface_JCalls;
5207 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5208 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5209 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5213 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5214 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5215 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5216 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 20, (uint32_t)recipient_conv);
5217 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5218 CHECK_ACCESS(ret_ptr);
5219 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5223 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5224 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5225 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 21);
5226 LDKCVec_u8Z ret_ref;
5227 ret_ref.datalen = ret->arr_len;
5228 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5229 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5232 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5233 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5234 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 22);
5235 LDKShutdownScript ret_conv;
5236 ret_conv.inner = (void*)(ret & (~1));
5237 ret_conv.is_owned = (ret & 1) || (ret == 0);
5238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5241 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5242 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5243 jboolean inbound_conv = inbound;
5244 int64_t channel_value_satoshis_conv = channel_value_satoshis;
5245 uint32_t ret = js_invoke_function_u_bb(j_calls->instance_ptr, 23, (uint32_t)inbound_conv, (uint32_t)channel_value_satoshis_conv);
5246 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5247 CHECK_ACCESS(ret_ptr);
5248 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5252 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5253 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5254 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 24);
5255 LDKThirtyTwoBytes ret_ref;
5256 CHECK(ret->arr_len == 32);
5257 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5260 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5261 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5262 LDKu8slice reader_var = reader;
5263 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5264 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5265 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 25, (uint32_t)reader_arr);
5266 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5267 CHECK_ACCESS(ret_ptr);
5268 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5272 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5273 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5274 LDKu8slice hrp_bytes_var = hrp_bytes;
5275 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5276 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5277 LDKCVec_u5Z invoice_data_var = invoice_data;
5278 ptrArray invoice_data_arr = NULL;
5279 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5280 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
5281 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5282 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5283 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5286 FREE(invoice_data_var.data);
5287 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5288 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 26, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, (uint32_t)receipient_conv);
5289 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5290 CHECK_ACCESS(ret_ptr);
5291 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5295 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5296 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5297 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 27);
5298 LDKThirtyTwoBytes ret_ref;
5299 CHECK(ret->arr_len == 32);
5300 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5303 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5304 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5305 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5307 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5308 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5309 atomic_init(&calls->refcnt, 1);
5310 calls->instance_ptr = o;
5312 LDKKeysInterface ret = {
5313 .this_arg = (void*) calls,
5314 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5315 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5316 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5317 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5318 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5319 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5320 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5321 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5322 .free = LDKKeysInterface_JCalls_free,
5326 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5327 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5328 *res_ptr = LDKKeysInterface_init(o);
5329 return (long)res_ptr;
5331 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
5332 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5333 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5334 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5335 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5336 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5337 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5338 return (uint32_t)ret_conv;
5341 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
5342 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5343 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5344 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5345 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5346 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5347 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5348 CVec_u8Z_free(ret_var);
5352 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
5353 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5354 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5355 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5356 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5357 uint32_t ret_ref = 0;
5358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5361 ret_ref = (uintptr_t)ret_var.inner;
5362 if (ret_var.is_owned) {
5368 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) {
5369 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5371 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5372 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5373 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5374 return (uint32_t)ret_ret;
5377 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
5378 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5379 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5380 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5381 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5382 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5386 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
5387 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5388 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5389 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5390 LDKu8slice reader_ref;
5391 reader_ref.datalen = reader->arr_len;
5392 reader_ref.data = reader->elems;
5393 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5394 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5396 return (uint32_t)ret_conv;
5399 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) {
5400 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5401 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5402 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5403 LDKu8slice hrp_bytes_ref;
5404 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5405 hrp_bytes_ref.data = hrp_bytes->elems;
5406 LDKCVec_u5Z invoice_data_constr;
5407 invoice_data_constr.datalen = invoice_data->arr_len;
5408 if (invoice_data_constr.datalen > 0)
5409 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5411 invoice_data_constr.data = NULL;
5412 int8_t* invoice_data_vals = (void*) invoice_data->elems;
5413 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5414 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5416 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5419 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5420 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5421 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5423 return (uint32_t)ret_conv;
5426 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
5427 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5428 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5429 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5430 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5431 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5435 typedef struct LDKFeeEstimator_JCalls {
5436 atomic_size_t refcnt;
5437 uint32_t instance_ptr;
5438 } LDKFeeEstimator_JCalls;
5439 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5440 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5441 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5445 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5446 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5447 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5448 return js_invoke_function_u_u(j_calls->instance_ptr, 28, (uint32_t)confirmation_target_conv);
5450 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5451 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5452 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5454 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5455 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5456 atomic_init(&calls->refcnt, 1);
5457 calls->instance_ptr = o;
5459 LDKFeeEstimator ret = {
5460 .this_arg = (void*) calls,
5461 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5462 .free = LDKFeeEstimator_JCalls_free,
5466 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5467 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5468 *res_ptr = LDKFeeEstimator_init(o);
5469 return (long)res_ptr;
5471 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) {
5472 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5473 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5474 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5475 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5476 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5480 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5481 return ThirtyTwoBytes_clone(&owner->a);
5483 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
5484 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5485 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5486 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5490 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5493 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
5494 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5495 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5496 uint32_t ret_ref = 0;
5497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5500 ret_ref = (uintptr_t)ret_var.inner & ~1;
5504 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5505 CHECK(owner->result_ok);
5506 return &*owner->contents.result;
5508 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
5509 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5510 uint32_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
5514 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5515 CHECK(!owner->result_ok);
5516 return DecodeError_clone(&*owner->contents.err);
5518 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
5519 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5520 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5521 uint32_t ret_ref = 0;
5522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5525 ret_ref = (uintptr_t)ret_var.inner;
5526 if (ret_var.is_owned) {
5532 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5533 CHECK(owner->result_ok);
5534 return ChannelConfig_clone(&*owner->contents.result);
5536 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
5537 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5538 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5539 uint32_t ret_ref = 0;
5540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5543 ret_ref = (uintptr_t)ret_var.inner;
5544 if (ret_var.is_owned) {
5550 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5551 CHECK(!owner->result_ok);
5552 return DecodeError_clone(&*owner->contents.err);
5554 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
5555 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5556 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5557 uint32_t ret_ref = 0;
5558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5561 ret_ref = (uintptr_t)ret_var.inner;
5562 if (ret_var.is_owned) {
5568 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5569 CHECK(owner->result_ok);
5570 return OutPoint_clone(&*owner->contents.result);
5572 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
5573 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5574 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5575 uint32_t ret_ref = 0;
5576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5579 ret_ref = (uintptr_t)ret_var.inner;
5580 if (ret_var.is_owned) {
5586 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5587 CHECK(!owner->result_ok);
5588 return DecodeError_clone(&*owner->contents.err);
5590 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
5591 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5592 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5593 uint32_t ret_ref = 0;
5594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5597 ret_ref = (uintptr_t)ret_var.inner;
5598 if (ret_var.is_owned) {
5604 typedef struct LDKType_JCalls {
5605 atomic_size_t refcnt;
5606 uint32_t instance_ptr;
5608 static void LDKType_JCalls_free(void* this_arg) {
5609 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5610 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5614 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5615 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5616 return js_invoke_function_u_(j_calls->instance_ptr, 29);
5618 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5619 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5620 jstring ret = (jstring)js_invoke_function_u_(j_calls->instance_ptr, 30);
5621 LDKStr ret_conv = str_ref_to_owned_c(ret);
5624 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5625 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5626 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 31);
5627 LDKCVec_u8Z ret_ref;
5628 ret_ref.datalen = ret->arr_len;
5629 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5630 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5633 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5634 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5635 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5637 static inline LDKType LDKType_init (JSValue o) {
5638 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5639 atomic_init(&calls->refcnt, 1);
5640 calls->instance_ptr = o;
5643 .this_arg = (void*) calls,
5644 .type_id = type_id_LDKType_jcall,
5645 .debug_str = debug_str_LDKType_jcall,
5646 .write = write_LDKType_jcall,
5647 .cloned = LDKType_JCalls_cloned,
5648 .free = LDKType_JCalls_free,
5652 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5653 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5654 *res_ptr = LDKType_init(o);
5655 return (long)res_ptr;
5657 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
5658 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5659 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5660 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5661 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5665 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
5666 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5667 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5668 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5669 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5670 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5675 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
5676 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5677 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5678 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5679 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5680 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5681 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5682 CVec_u8Z_free(ret_var);
5686 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5687 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5689 case LDKCOption_TypeZ_Some: return 0;
5690 case LDKCOption_TypeZ_None: return 1;
5694 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5695 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5696 assert(obj->tag == LDKCOption_TypeZ_Some);
5697 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5698 *some_ret = Type_clone(&obj->some);
5699 return (uint32_t)some_ret;
5701 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5702 CHECK(owner->result_ok);
5703 return COption_TypeZ_clone(&*owner->contents.result);
5705 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5706 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5707 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5708 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5709 uint32_t ret_ref = (uintptr_t)ret_copy;
5713 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5714 CHECK(!owner->result_ok);
5715 return DecodeError_clone(&*owner->contents.err);
5717 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
5718 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5719 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5720 uint32_t ret_ref = 0;
5721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5724 ret_ref = (uintptr_t)ret_var.inner;
5725 if (ret_var.is_owned) {
5731 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
5732 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5734 case LDKPaymentError_Invoice: return 0;
5735 case LDKPaymentError_Routing: return 1;
5736 case LDKPaymentError_Sending: return 2;
5740 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
5741 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5742 assert(obj->tag == LDKPaymentError_Invoice);
5743 LDKStr invoice_str = obj->invoice;
5744 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5745 return invoice_conv;
5747 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
5748 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5749 assert(obj->tag == LDKPaymentError_Routing);
5750 LDKLightningError routing_var = obj->routing;
5751 uint32_t routing_ref = 0;
5752 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5753 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5754 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5755 routing_ref = (uintptr_t)routing_var.inner & ~1;
5758 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
5759 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5760 assert(obj->tag == LDKPaymentError_Sending);
5761 uint32_t sending_ref = ((uintptr_t)&obj->sending) | 1;
5764 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5765 CHECK(owner->result_ok);
5766 return ThirtyTwoBytes_clone(&*owner->contents.result);
5768 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
5769 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5770 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5771 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5775 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5776 CHECK(!owner->result_ok);
5777 return PaymentError_clone(&*owner->contents.err);
5779 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
5780 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5781 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5782 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5783 uint32_t ret_ref = (uintptr_t)ret_copy;
5787 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint32_t ptr) {
5788 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5790 case LDKParseError_Bech32Error: return 0;
5791 case LDKParseError_ParseAmountError: return 1;
5792 case LDKParseError_MalformedSignature: return 2;
5793 case LDKParseError_BadPrefix: return 3;
5794 case LDKParseError_UnknownCurrency: return 4;
5795 case LDKParseError_UnknownSiPrefix: return 5;
5796 case LDKParseError_MalformedHRP: return 6;
5797 case LDKParseError_TooShortDataPart: return 7;
5798 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5799 case LDKParseError_DescriptionDecodeError: return 9;
5800 case LDKParseError_PaddingError: return 10;
5801 case LDKParseError_IntegerOverflowError: return 11;
5802 case LDKParseError_InvalidSegWitProgramLength: return 12;
5803 case LDKParseError_InvalidPubKeyHashLength: return 13;
5804 case LDKParseError_InvalidScriptHashLength: return 14;
5805 case LDKParseError_InvalidRecoveryId: return 15;
5806 case LDKParseError_InvalidSliceLength: return 16;
5807 case LDKParseError_Skip: return 17;
5811 uint32_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint32_t ptr) {
5812 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5813 assert(obj->tag == LDKParseError_Bech32Error);
5814 uint32_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
5815 return bech32_error_ref;
5817 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint32_t ptr) {
5818 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5819 assert(obj->tag == LDKParseError_ParseAmountError);
5820 /*obj->parse_amount_error*/
5823 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint32_t ptr) {
5824 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5825 assert(obj->tag == LDKParseError_MalformedSignature);
5826 uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5827 return malformed_signature_conv;
5829 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint32_t ptr) {
5830 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5831 assert(obj->tag == LDKParseError_DescriptionDecodeError);
5832 /*obj->description_decode_error*/
5835 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint32_t ptr) {
5836 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
5837 assert(obj->tag == LDKParseError_InvalidSliceLength);
5838 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5839 jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5840 return invalid_slice_length_conv;
5842 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5843 CHECK(owner->result_ok);
5844 return SiPrefix_clone(&*owner->contents.result);
5846 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint32_t owner) {
5847 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5848 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5852 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5853 CHECK(!owner->result_ok);
5854 return ParseError_clone(&*owner->contents.err);
5856 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint32_t owner) {
5857 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
5858 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5859 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5860 uint32_t ret_ref = (uintptr_t)ret_copy;
5864 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint32_t ptr) {
5865 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5867 case LDKParseOrSemanticError_ParseError: return 0;
5868 case LDKParseOrSemanticError_SemanticError: return 1;
5872 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint32_t ptr) {
5873 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5874 assert(obj->tag == LDKParseOrSemanticError_ParseError);
5875 uint32_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
5876 return parse_error_ref;
5878 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint32_t ptr) {
5879 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
5880 assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5881 uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5882 return semantic_error_conv;
5884 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5885 CHECK(owner->result_ok);
5886 return Invoice_clone(&*owner->contents.result);
5888 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint32_t owner) {
5889 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5890 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5891 uint32_t ret_ref = 0;
5892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5895 ret_ref = (uintptr_t)ret_var.inner;
5896 if (ret_var.is_owned) {
5902 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5903 CHECK(!owner->result_ok);
5904 return ParseOrSemanticError_clone(&*owner->contents.err);
5906 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint32_t owner) {
5907 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
5908 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5909 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5910 uint32_t ret_ref = (uintptr_t)ret_copy;
5914 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5915 CHECK(owner->result_ok);
5916 return SignedRawInvoice_clone(&*owner->contents.result);
5918 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint32_t owner) {
5919 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5920 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5921 uint32_t ret_ref = 0;
5922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5925 ret_ref = (uintptr_t)ret_var.inner;
5926 if (ret_var.is_owned) {
5932 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5933 CHECK(!owner->result_ok);
5934 return ParseError_clone(&*owner->contents.err);
5936 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint32_t owner) {
5937 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
5938 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5939 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5940 uint32_t ret_ref = (uintptr_t)ret_copy;
5944 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5945 return RawInvoice_clone(&owner->a);
5947 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
5948 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5949 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5950 uint32_t ret_ref = 0;
5951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5954 ret_ref = (uintptr_t)ret_var.inner;
5955 if (ret_var.is_owned) {
5961 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5962 return ThirtyTwoBytes_clone(&owner->b);
5964 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
5965 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5966 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5967 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5971 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5972 return InvoiceSignature_clone(&owner->c);
5974 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
5975 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5976 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5977 uint32_t ret_ref = 0;
5978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5981 ret_ref = (uintptr_t)ret_var.inner;
5982 if (ret_var.is_owned) {
5988 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5989 CHECK(owner->result_ok);
5990 return PayeePubKey_clone(&*owner->contents.result);
5992 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
5993 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5994 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5995 uint32_t ret_ref = 0;
5996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5999 ret_ref = (uintptr_t)ret_var.inner;
6000 if (ret_var.is_owned) {
6006 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6007 CHECK(!owner->result_ok);
6008 return *owner->contents.err;
6010 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
6011 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6012 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6016 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6017 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6018 for (size_t i = 0; i < ret.datalen; i++) {
6019 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6023 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6024 CHECK(owner->result_ok);
6025 return PositiveTimestamp_clone(&*owner->contents.result);
6027 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
6028 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6029 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6030 uint32_t ret_ref = 0;
6031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6034 ret_ref = (uintptr_t)ret_var.inner;
6035 if (ret_var.is_owned) {
6041 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6042 CHECK(!owner->result_ok);
6043 return CreationError_clone(&*owner->contents.err);
6045 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
6046 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6047 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6051 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6052 CHECK(owner->result_ok);
6053 return *owner->contents.result;
6055 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
6056 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6057 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6060 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6061 CHECK(!owner->result_ok);
6062 return SemanticError_clone(&*owner->contents.err);
6064 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
6065 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6066 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6070 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6071 CHECK(owner->result_ok);
6072 return Invoice_clone(&*owner->contents.result);
6074 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
6075 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6076 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6077 uint32_t ret_ref = 0;
6078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6081 ret_ref = (uintptr_t)ret_var.inner;
6082 if (ret_var.is_owned) {
6088 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6089 CHECK(!owner->result_ok);
6090 return SemanticError_clone(&*owner->contents.err);
6092 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
6093 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6094 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6098 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6099 CHECK(owner->result_ok);
6100 return Description_clone(&*owner->contents.result);
6102 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
6103 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6104 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6105 uint32_t ret_ref = 0;
6106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6109 ret_ref = (uintptr_t)ret_var.inner;
6110 if (ret_var.is_owned) {
6116 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6117 CHECK(!owner->result_ok);
6118 return CreationError_clone(&*owner->contents.err);
6120 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
6121 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6122 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6126 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6127 CHECK(owner->result_ok);
6128 return PrivateRoute_clone(&*owner->contents.result);
6130 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
6131 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6132 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6133 uint32_t ret_ref = 0;
6134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6137 ret_ref = (uintptr_t)ret_var.inner;
6138 if (ret_var.is_owned) {
6144 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6145 CHECK(!owner->result_ok);
6146 return CreationError_clone(&*owner->contents.err);
6148 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
6149 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6150 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6154 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6155 CHECK(owner->result_ok);
6156 return *owner->contents.result;
6158 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
6159 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6160 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6161 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6165 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6166 CHECK(!owner->result_ok);
6167 return *owner->contents.err;
6169 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
6170 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6171 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6175 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6176 CHECK(owner->result_ok);
6177 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6179 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6180 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6181 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6182 uint32_t ret_ref = 0;
6183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6186 ret_ref = (uintptr_t)ret_var.inner;
6187 if (ret_var.is_owned) {
6193 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6194 CHECK(!owner->result_ok);
6195 return DecodeError_clone(&*owner->contents.err);
6197 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
6198 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6199 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6200 uint32_t ret_ref = 0;
6201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6204 ret_ref = (uintptr_t)ret_var.inner;
6205 if (ret_var.is_owned) {
6211 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
6212 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6214 case LDKCOption_MonitorEventZ_Some: return 0;
6215 case LDKCOption_MonitorEventZ_None: return 1;
6219 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
6220 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6221 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6222 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6225 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6226 CHECK(owner->result_ok);
6227 return COption_MonitorEventZ_clone(&*owner->contents.result);
6229 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
6230 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6231 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6232 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6233 uint32_t ret_ref = (uintptr_t)ret_copy;
6237 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6238 CHECK(!owner->result_ok);
6239 return DecodeError_clone(&*owner->contents.err);
6241 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
6242 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6243 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6244 uint32_t ret_ref = 0;
6245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6248 ret_ref = (uintptr_t)ret_var.inner;
6249 if (ret_var.is_owned) {
6255 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6256 CHECK(owner->result_ok);
6257 return HTLCUpdate_clone(&*owner->contents.result);
6259 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
6260 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6261 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6262 uint32_t ret_ref = 0;
6263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6266 ret_ref = (uintptr_t)ret_var.inner;
6267 if (ret_var.is_owned) {
6273 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6274 CHECK(!owner->result_ok);
6275 return DecodeError_clone(&*owner->contents.err);
6277 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
6278 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6279 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6280 uint32_t ret_ref = 0;
6281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6284 ret_ref = (uintptr_t)ret_var.inner;
6285 if (ret_var.is_owned) {
6291 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6292 return OutPoint_clone(&owner->a);
6294 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
6295 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6296 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6297 uint32_t ret_ref = 0;
6298 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6299 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6300 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6301 ret_ref = (uintptr_t)ret_var.inner;
6302 if (ret_var.is_owned) {
6308 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6309 return CVec_u8Z_clone(&owner->b);
6311 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
6312 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6313 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6314 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6315 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6316 CVec_u8Z_free(ret_var);
6320 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6323 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
6324 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6325 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6329 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6330 return CVec_u8Z_clone(&owner->b);
6332 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
6333 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6334 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6335 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6336 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6337 CVec_u8Z_free(ret_var);
6341 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6342 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6343 for (size_t i = 0; i < ret.datalen; i++) {
6344 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6348 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6349 return ThirtyTwoBytes_clone(&owner->a);
6351 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
6352 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6353 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6354 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6358 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6359 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6361 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
6362 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6363 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6364 uint32_tArray ret_arr = NULL;
6365 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6366 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6367 for (size_t v = 0; v < ret_var.datalen; v++) {
6368 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6369 *ret_conv_21_conv = ret_var.data[v];
6370 ret_arr_ptr[v] = ((uint32_t)ret_conv_21_conv);
6377 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6378 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 };
6379 for (size_t i = 0; i < ret.datalen; i++) {
6380 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6384 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6385 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6386 for (size_t i = 0; i < ret.datalen; i++) {
6387 ret.data[i] = Event_clone(&orig->data[i]);
6391 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6394 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
6395 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6396 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6400 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6401 return TxOut_clone(&owner->b);
6403 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
6404 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6405 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6406 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6407 return (uint32_t)ret_ref;
6410 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6411 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6412 for (size_t i = 0; i < ret.datalen; i++) {
6413 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6417 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6418 return ThirtyTwoBytes_clone(&owner->a);
6420 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
6421 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6422 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6423 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6427 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6428 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6430 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
6431 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6432 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6433 uint32_tArray ret_arr = NULL;
6434 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
6435 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
6436 for (size_t u = 0; u < ret_var.datalen; u++) {
6437 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6438 *ret_conv_20_conv = ret_var.data[u];
6439 ret_arr_ptr[u] = ((uint32_t)ret_conv_20_conv);
6446 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6447 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 };
6448 for (size_t i = 0; i < ret.datalen; i++) {
6449 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6453 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
6454 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6456 case LDKBalance_ClaimableOnChannelClose: return 0;
6457 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6458 case LDKBalance_ContentiousClaimable: return 2;
6459 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6463 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
6464 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6465 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6466 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6467 return claimable_amount_satoshis_conv;
6469 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
6470 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6471 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6472 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6473 return claimable_amount_satoshis_conv;
6475 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
6476 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6477 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6478 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6479 return confirmation_height_conv;
6481 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
6482 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6483 assert(obj->tag == LDKBalance_ContentiousClaimable);
6484 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6485 return claimable_amount_satoshis_conv;
6487 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
6488 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6489 assert(obj->tag == LDKBalance_ContentiousClaimable);
6490 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6491 return timeout_height_conv;
6493 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
6494 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6495 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6496 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6497 return claimable_amount_satoshis_conv;
6499 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
6500 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6501 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6502 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6503 return claimable_height_conv;
6505 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6506 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6507 for (size_t i = 0; i < ret.datalen; i++) {
6508 ret.data[i] = Balance_clone(&orig->data[i]);
6512 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6513 return ThirtyTwoBytes_clone(&owner->a);
6515 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
6516 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6517 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6518 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6522 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6523 return ChannelMonitor_clone(&owner->b);
6525 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
6526 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
6527 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6528 uint32_t ret_ref = 0;
6529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6532 ret_ref = (uintptr_t)ret_var.inner;
6533 if (ret_var.is_owned) {
6539 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6540 CHECK(owner->result_ok);
6541 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6543 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
6544 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6545 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6546 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6547 return ((uint32_t)ret_conv);
6550 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6551 CHECK(!owner->result_ok);
6552 return DecodeError_clone(&*owner->contents.err);
6554 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
6555 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6556 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6557 uint32_t ret_ref = 0;
6558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6561 ret_ref = (uintptr_t)ret_var.inner;
6562 if (ret_var.is_owned) {
6568 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6571 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
6572 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6573 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6574 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6578 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6579 return Type_clone(&owner->b);
6581 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
6582 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6583 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6584 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6585 return (uint32_t)ret_ret;
6588 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6589 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6590 for (size_t i = 0; i < ret.datalen; i++) {
6591 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6595 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint32_t ptr) {
6596 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6598 case LDKCOption_NetAddressZ_Some: return 0;
6599 case LDKCOption_NetAddressZ_None: return 1;
6603 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint32_t ptr) {
6604 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
6605 assert(obj->tag == LDKCOption_NetAddressZ_Some);
6606 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
6609 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6610 CHECK(owner->result_ok);
6611 return CVec_u8Z_clone(&*owner->contents.result);
6613 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
6614 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6615 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6616 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6617 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6618 CVec_u8Z_free(ret_var);
6622 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6623 CHECK(!owner->result_ok);
6624 return PeerHandleError_clone(&*owner->contents.err);
6626 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
6627 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6628 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6629 uint32_t ret_ref = 0;
6630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6633 ret_ref = (uintptr_t)ret_var.inner;
6634 if (ret_var.is_owned) {
6640 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6641 CHECK(owner->result_ok);
6642 return *owner->contents.result;
6644 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
6645 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6646 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6649 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6650 CHECK(!owner->result_ok);
6651 return PeerHandleError_clone(&*owner->contents.err);
6653 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
6654 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6655 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6656 uint32_t ret_ref = 0;
6657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6660 ret_ref = (uintptr_t)ret_var.inner;
6661 if (ret_var.is_owned) {
6667 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6668 CHECK(owner->result_ok);
6669 return *owner->contents.result;
6671 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6672 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6673 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6677 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6678 CHECK(!owner->result_ok);
6679 return PeerHandleError_clone(&*owner->contents.err);
6681 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6682 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6683 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6684 uint32_t ret_ref = 0;
6685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6688 ret_ref = (uintptr_t)ret_var.inner;
6689 if (ret_var.is_owned) {
6695 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6696 CHECK(owner->result_ok);
6697 return *owner->contents.result;
6699 void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint32_t owner) {
6700 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6701 CResult_NoneErrorZ_get_ok(owner_conv);
6704 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6705 CHECK(!owner->result_ok);
6706 return *owner->contents.err;
6708 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint32_t owner) {
6709 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
6710 uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6714 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6715 CHECK(owner->result_ok);
6716 return NetAddress_clone(&*owner->contents.result);
6718 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
6719 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6720 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6721 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6722 uint32_t ret_ref = (uintptr_t)ret_copy;
6726 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6727 CHECK(!owner->result_ok);
6728 return DecodeError_clone(&*owner->contents.err);
6730 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
6731 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6732 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6733 uint32_t ret_ref = 0;
6734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6737 ret_ref = (uintptr_t)ret_var.inner;
6738 if (ret_var.is_owned) {
6744 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6745 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6746 for (size_t i = 0; i < ret.datalen; i++) {
6747 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6751 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6752 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6753 for (size_t i = 0; i < ret.datalen; i++) {
6754 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6758 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6759 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6760 for (size_t i = 0; i < ret.datalen; i++) {
6761 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6765 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6766 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6767 for (size_t i = 0; i < ret.datalen; i++) {
6768 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6772 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6773 CHECK(owner->result_ok);
6774 return AcceptChannel_clone(&*owner->contents.result);
6776 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
6777 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6778 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6779 uint32_t ret_ref = 0;
6780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6783 ret_ref = (uintptr_t)ret_var.inner;
6784 if (ret_var.is_owned) {
6790 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6791 CHECK(!owner->result_ok);
6792 return DecodeError_clone(&*owner->contents.err);
6794 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
6795 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6796 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6797 uint32_t ret_ref = 0;
6798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6801 ret_ref = (uintptr_t)ret_var.inner;
6802 if (ret_var.is_owned) {
6808 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6809 CHECK(owner->result_ok);
6810 return AnnouncementSignatures_clone(&*owner->contents.result);
6812 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
6813 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6814 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6815 uint32_t ret_ref = 0;
6816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6819 ret_ref = (uintptr_t)ret_var.inner;
6820 if (ret_var.is_owned) {
6826 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6827 CHECK(!owner->result_ok);
6828 return DecodeError_clone(&*owner->contents.err);
6830 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
6831 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6832 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6833 uint32_t ret_ref = 0;
6834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6837 ret_ref = (uintptr_t)ret_var.inner;
6838 if (ret_var.is_owned) {
6844 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6845 CHECK(owner->result_ok);
6846 return ChannelReestablish_clone(&*owner->contents.result);
6848 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
6849 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6850 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6851 uint32_t ret_ref = 0;
6852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6855 ret_ref = (uintptr_t)ret_var.inner;
6856 if (ret_var.is_owned) {
6862 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6863 CHECK(!owner->result_ok);
6864 return DecodeError_clone(&*owner->contents.err);
6866 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
6867 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6868 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6869 uint32_t ret_ref = 0;
6870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6873 ret_ref = (uintptr_t)ret_var.inner;
6874 if (ret_var.is_owned) {
6880 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6881 CHECK(owner->result_ok);
6882 return ClosingSigned_clone(&*owner->contents.result);
6884 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6885 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6886 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6887 uint32_t ret_ref = 0;
6888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6891 ret_ref = (uintptr_t)ret_var.inner;
6892 if (ret_var.is_owned) {
6898 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6899 CHECK(!owner->result_ok);
6900 return DecodeError_clone(&*owner->contents.err);
6902 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
6903 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6904 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6905 uint32_t ret_ref = 0;
6906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6909 ret_ref = (uintptr_t)ret_var.inner;
6910 if (ret_var.is_owned) {
6916 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6917 CHECK(owner->result_ok);
6918 return ClosingSignedFeeRange_clone(&*owner->contents.result);
6920 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
6921 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6922 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6923 uint32_t ret_ref = 0;
6924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6927 ret_ref = (uintptr_t)ret_var.inner;
6928 if (ret_var.is_owned) {
6934 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6935 CHECK(!owner->result_ok);
6936 return DecodeError_clone(&*owner->contents.err);
6938 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
6939 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6940 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6941 uint32_t ret_ref = 0;
6942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6945 ret_ref = (uintptr_t)ret_var.inner;
6946 if (ret_var.is_owned) {
6952 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6953 CHECK(owner->result_ok);
6954 return CommitmentSigned_clone(&*owner->contents.result);
6956 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
6957 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6958 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6959 uint32_t ret_ref = 0;
6960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6963 ret_ref = (uintptr_t)ret_var.inner;
6964 if (ret_var.is_owned) {
6970 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6971 CHECK(!owner->result_ok);
6972 return DecodeError_clone(&*owner->contents.err);
6974 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
6975 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6976 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6977 uint32_t ret_ref = 0;
6978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6981 ret_ref = (uintptr_t)ret_var.inner;
6982 if (ret_var.is_owned) {
6988 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6989 CHECK(owner->result_ok);
6990 return FundingCreated_clone(&*owner->contents.result);
6992 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
6993 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6994 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6995 uint32_t ret_ref = 0;
6996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6999 ret_ref = (uintptr_t)ret_var.inner;
7000 if (ret_var.is_owned) {
7006 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7007 CHECK(!owner->result_ok);
7008 return DecodeError_clone(&*owner->contents.err);
7010 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
7011 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7012 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7013 uint32_t ret_ref = 0;
7014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7017 ret_ref = (uintptr_t)ret_var.inner;
7018 if (ret_var.is_owned) {
7024 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7025 CHECK(owner->result_ok);
7026 return FundingSigned_clone(&*owner->contents.result);
7028 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
7029 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7030 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7031 uint32_t ret_ref = 0;
7032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7035 ret_ref = (uintptr_t)ret_var.inner;
7036 if (ret_var.is_owned) {
7042 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7043 CHECK(!owner->result_ok);
7044 return DecodeError_clone(&*owner->contents.err);
7046 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
7047 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7048 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7049 uint32_t ret_ref = 0;
7050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7053 ret_ref = (uintptr_t)ret_var.inner;
7054 if (ret_var.is_owned) {
7060 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7061 CHECK(owner->result_ok);
7062 return ChannelReady_clone(&*owner->contents.result);
7064 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint32_t owner) {
7065 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7066 LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7067 uint32_t ret_ref = 0;
7068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7071 ret_ref = (uintptr_t)ret_var.inner;
7072 if (ret_var.is_owned) {
7078 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7079 CHECK(!owner->result_ok);
7080 return DecodeError_clone(&*owner->contents.err);
7082 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint32_t owner) {
7083 LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(owner & ~1);
7084 LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7085 uint32_t ret_ref = 0;
7086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7089 ret_ref = (uintptr_t)ret_var.inner;
7090 if (ret_var.is_owned) {
7096 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7097 CHECK(owner->result_ok);
7098 return Init_clone(&*owner->contents.result);
7100 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
7101 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7102 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7103 uint32_t ret_ref = 0;
7104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7107 ret_ref = (uintptr_t)ret_var.inner;
7108 if (ret_var.is_owned) {
7114 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7115 CHECK(!owner->result_ok);
7116 return DecodeError_clone(&*owner->contents.err);
7118 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
7119 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7120 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7121 uint32_t ret_ref = 0;
7122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7125 ret_ref = (uintptr_t)ret_var.inner;
7126 if (ret_var.is_owned) {
7132 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7133 CHECK(owner->result_ok);
7134 return OpenChannel_clone(&*owner->contents.result);
7136 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
7137 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7138 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7139 uint32_t ret_ref = 0;
7140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7143 ret_ref = (uintptr_t)ret_var.inner;
7144 if (ret_var.is_owned) {
7150 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7151 CHECK(!owner->result_ok);
7152 return DecodeError_clone(&*owner->contents.err);
7154 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
7155 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
7156 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7157 uint32_t ret_ref = 0;
7158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7161 ret_ref = (uintptr_t)ret_var.inner;
7162 if (ret_var.is_owned) {
7168 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7169 CHECK(owner->result_ok);
7170 return RevokeAndACK_clone(&*owner->contents.result);
7172 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
7173 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7174 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7175 uint32_t ret_ref = 0;
7176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7179 ret_ref = (uintptr_t)ret_var.inner;
7180 if (ret_var.is_owned) {
7186 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7187 CHECK(!owner->result_ok);
7188 return DecodeError_clone(&*owner->contents.err);
7190 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
7191 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
7192 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7193 uint32_t ret_ref = 0;
7194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7197 ret_ref = (uintptr_t)ret_var.inner;
7198 if (ret_var.is_owned) {
7204 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7205 CHECK(owner->result_ok);
7206 return Shutdown_clone(&*owner->contents.result);
7208 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
7209 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7210 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7211 uint32_t ret_ref = 0;
7212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7215 ret_ref = (uintptr_t)ret_var.inner;
7216 if (ret_var.is_owned) {
7222 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7223 CHECK(!owner->result_ok);
7224 return DecodeError_clone(&*owner->contents.err);
7226 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
7227 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
7228 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7229 uint32_t ret_ref = 0;
7230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7233 ret_ref = (uintptr_t)ret_var.inner;
7234 if (ret_var.is_owned) {
7240 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7241 CHECK(owner->result_ok);
7242 return UpdateFailHTLC_clone(&*owner->contents.result);
7244 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7245 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7246 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7247 uint32_t ret_ref = 0;
7248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7251 ret_ref = (uintptr_t)ret_var.inner;
7252 if (ret_var.is_owned) {
7258 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7259 CHECK(!owner->result_ok);
7260 return DecodeError_clone(&*owner->contents.err);
7262 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
7263 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7264 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7265 uint32_t ret_ref = 0;
7266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7269 ret_ref = (uintptr_t)ret_var.inner;
7270 if (ret_var.is_owned) {
7276 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7277 CHECK(owner->result_ok);
7278 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
7280 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7281 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7282 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7283 uint32_t ret_ref = 0;
7284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7287 ret_ref = (uintptr_t)ret_var.inner;
7288 if (ret_var.is_owned) {
7294 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7295 CHECK(!owner->result_ok);
7296 return DecodeError_clone(&*owner->contents.err);
7298 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
7299 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7300 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7301 uint32_t ret_ref = 0;
7302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7305 ret_ref = (uintptr_t)ret_var.inner;
7306 if (ret_var.is_owned) {
7312 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7313 CHECK(owner->result_ok);
7314 return UpdateFee_clone(&*owner->contents.result);
7316 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7317 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7318 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7319 uint32_t ret_ref = 0;
7320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7323 ret_ref = (uintptr_t)ret_var.inner;
7324 if (ret_var.is_owned) {
7330 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7331 CHECK(!owner->result_ok);
7332 return DecodeError_clone(&*owner->contents.err);
7334 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7335 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7336 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7337 uint32_t ret_ref = 0;
7338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7341 ret_ref = (uintptr_t)ret_var.inner;
7342 if (ret_var.is_owned) {
7348 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7349 CHECK(owner->result_ok);
7350 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7352 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7353 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7354 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7355 uint32_t ret_ref = 0;
7356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7359 ret_ref = (uintptr_t)ret_var.inner;
7360 if (ret_var.is_owned) {
7366 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7367 CHECK(!owner->result_ok);
7368 return DecodeError_clone(&*owner->contents.err);
7370 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7371 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7372 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7373 uint32_t ret_ref = 0;
7374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7377 ret_ref = (uintptr_t)ret_var.inner;
7378 if (ret_var.is_owned) {
7384 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7385 CHECK(owner->result_ok);
7386 return UpdateAddHTLC_clone(&*owner->contents.result);
7388 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7389 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7390 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7391 uint32_t ret_ref = 0;
7392 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7393 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7395 ret_ref = (uintptr_t)ret_var.inner;
7396 if (ret_var.is_owned) {
7402 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7403 CHECK(!owner->result_ok);
7404 return DecodeError_clone(&*owner->contents.err);
7406 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7407 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7408 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7409 uint32_t ret_ref = 0;
7410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7413 ret_ref = (uintptr_t)ret_var.inner;
7414 if (ret_var.is_owned) {
7420 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7421 CHECK(owner->result_ok);
7422 return Ping_clone(&*owner->contents.result);
7424 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7425 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7426 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7427 uint32_t ret_ref = 0;
7428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7431 ret_ref = (uintptr_t)ret_var.inner;
7432 if (ret_var.is_owned) {
7438 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7439 CHECK(!owner->result_ok);
7440 return DecodeError_clone(&*owner->contents.err);
7442 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7443 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7444 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7445 uint32_t ret_ref = 0;
7446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7449 ret_ref = (uintptr_t)ret_var.inner;
7450 if (ret_var.is_owned) {
7456 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7457 CHECK(owner->result_ok);
7458 return Pong_clone(&*owner->contents.result);
7460 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7461 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7462 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7463 uint32_t ret_ref = 0;
7464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7467 ret_ref = (uintptr_t)ret_var.inner;
7468 if (ret_var.is_owned) {
7474 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7475 CHECK(!owner->result_ok);
7476 return DecodeError_clone(&*owner->contents.err);
7478 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7479 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7480 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7481 uint32_t ret_ref = 0;
7482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7485 ret_ref = (uintptr_t)ret_var.inner;
7486 if (ret_var.is_owned) {
7492 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7493 CHECK(owner->result_ok);
7494 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7496 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7497 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7498 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7499 uint32_t ret_ref = 0;
7500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7503 ret_ref = (uintptr_t)ret_var.inner;
7504 if (ret_var.is_owned) {
7510 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7511 CHECK(!owner->result_ok);
7512 return DecodeError_clone(&*owner->contents.err);
7514 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7515 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7516 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7517 uint32_t ret_ref = 0;
7518 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7519 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7521 ret_ref = (uintptr_t)ret_var.inner;
7522 if (ret_var.is_owned) {
7528 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7529 CHECK(owner->result_ok);
7530 return ChannelAnnouncement_clone(&*owner->contents.result);
7532 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7533 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7534 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7535 uint32_t ret_ref = 0;
7536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7539 ret_ref = (uintptr_t)ret_var.inner;
7540 if (ret_var.is_owned) {
7546 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7547 CHECK(!owner->result_ok);
7548 return DecodeError_clone(&*owner->contents.err);
7550 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7551 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7552 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7553 uint32_t ret_ref = 0;
7554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7557 ret_ref = (uintptr_t)ret_var.inner;
7558 if (ret_var.is_owned) {
7564 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7565 CHECK(owner->result_ok);
7566 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7568 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7569 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7570 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7571 uint32_t ret_ref = 0;
7572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7575 ret_ref = (uintptr_t)ret_var.inner;
7576 if (ret_var.is_owned) {
7582 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7583 CHECK(!owner->result_ok);
7584 return DecodeError_clone(&*owner->contents.err);
7586 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7587 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7588 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7589 uint32_t ret_ref = 0;
7590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7593 ret_ref = (uintptr_t)ret_var.inner;
7594 if (ret_var.is_owned) {
7600 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7601 CHECK(owner->result_ok);
7602 return ChannelUpdate_clone(&*owner->contents.result);
7604 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7605 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7606 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7607 uint32_t ret_ref = 0;
7608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7611 ret_ref = (uintptr_t)ret_var.inner;
7612 if (ret_var.is_owned) {
7618 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7619 CHECK(!owner->result_ok);
7620 return DecodeError_clone(&*owner->contents.err);
7622 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7623 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7624 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7625 uint32_t ret_ref = 0;
7626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7629 ret_ref = (uintptr_t)ret_var.inner;
7630 if (ret_var.is_owned) {
7636 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7637 CHECK(owner->result_ok);
7638 return ErrorMessage_clone(&*owner->contents.result);
7640 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7641 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7642 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7643 uint32_t ret_ref = 0;
7644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7647 ret_ref = (uintptr_t)ret_var.inner;
7648 if (ret_var.is_owned) {
7654 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7655 CHECK(!owner->result_ok);
7656 return DecodeError_clone(&*owner->contents.err);
7658 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7659 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7660 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7661 uint32_t ret_ref = 0;
7662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7665 ret_ref = (uintptr_t)ret_var.inner;
7666 if (ret_var.is_owned) {
7672 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7673 CHECK(owner->result_ok);
7674 return WarningMessage_clone(&*owner->contents.result);
7676 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7677 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7678 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7679 uint32_t ret_ref = 0;
7680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7683 ret_ref = (uintptr_t)ret_var.inner;
7684 if (ret_var.is_owned) {
7690 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7691 CHECK(!owner->result_ok);
7692 return DecodeError_clone(&*owner->contents.err);
7694 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7695 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7696 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7697 uint32_t ret_ref = 0;
7698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7701 ret_ref = (uintptr_t)ret_var.inner;
7702 if (ret_var.is_owned) {
7708 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7709 CHECK(owner->result_ok);
7710 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7712 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7713 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7714 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7715 uint32_t ret_ref = 0;
7716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7719 ret_ref = (uintptr_t)ret_var.inner;
7720 if (ret_var.is_owned) {
7726 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7727 CHECK(!owner->result_ok);
7728 return DecodeError_clone(&*owner->contents.err);
7730 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7731 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7732 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7733 uint32_t ret_ref = 0;
7734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7737 ret_ref = (uintptr_t)ret_var.inner;
7738 if (ret_var.is_owned) {
7744 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7745 CHECK(owner->result_ok);
7746 return NodeAnnouncement_clone(&*owner->contents.result);
7748 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7749 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7750 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7751 uint32_t ret_ref = 0;
7752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7755 ret_ref = (uintptr_t)ret_var.inner;
7756 if (ret_var.is_owned) {
7762 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7763 CHECK(!owner->result_ok);
7764 return DecodeError_clone(&*owner->contents.err);
7766 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7767 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7768 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7769 uint32_t ret_ref = 0;
7770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7773 ret_ref = (uintptr_t)ret_var.inner;
7774 if (ret_var.is_owned) {
7780 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7781 CHECK(owner->result_ok);
7782 return QueryShortChannelIds_clone(&*owner->contents.result);
7784 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
7785 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7786 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7787 uint32_t ret_ref = 0;
7788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7791 ret_ref = (uintptr_t)ret_var.inner;
7792 if (ret_var.is_owned) {
7798 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7799 CHECK(!owner->result_ok);
7800 return DecodeError_clone(&*owner->contents.err);
7802 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
7803 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7804 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7805 uint32_t ret_ref = 0;
7806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7809 ret_ref = (uintptr_t)ret_var.inner;
7810 if (ret_var.is_owned) {
7816 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7817 CHECK(owner->result_ok);
7818 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7820 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
7821 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7822 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7823 uint32_t ret_ref = 0;
7824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7827 ret_ref = (uintptr_t)ret_var.inner;
7828 if (ret_var.is_owned) {
7834 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7835 CHECK(!owner->result_ok);
7836 return DecodeError_clone(&*owner->contents.err);
7838 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
7839 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7840 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7841 uint32_t ret_ref = 0;
7842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7845 ret_ref = (uintptr_t)ret_var.inner;
7846 if (ret_var.is_owned) {
7852 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7853 CHECK(owner->result_ok);
7854 return QueryChannelRange_clone(&*owner->contents.result);
7856 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7857 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7858 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7859 uint32_t ret_ref = 0;
7860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7863 ret_ref = (uintptr_t)ret_var.inner;
7864 if (ret_var.is_owned) {
7870 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7871 CHECK(!owner->result_ok);
7872 return DecodeError_clone(&*owner->contents.err);
7874 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7875 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7876 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7877 uint32_t ret_ref = 0;
7878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7881 ret_ref = (uintptr_t)ret_var.inner;
7882 if (ret_var.is_owned) {
7888 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7889 CHECK(owner->result_ok);
7890 return ReplyChannelRange_clone(&*owner->contents.result);
7892 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7893 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7894 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7895 uint32_t ret_ref = 0;
7896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7899 ret_ref = (uintptr_t)ret_var.inner;
7900 if (ret_var.is_owned) {
7906 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7907 CHECK(!owner->result_ok);
7908 return DecodeError_clone(&*owner->contents.err);
7910 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7911 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7912 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7913 uint32_t ret_ref = 0;
7914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7917 ret_ref = (uintptr_t)ret_var.inner;
7918 if (ret_var.is_owned) {
7924 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7925 CHECK(owner->result_ok);
7926 return GossipTimestampFilter_clone(&*owner->contents.result);
7928 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
7929 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7930 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7931 uint32_t ret_ref = 0;
7932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7935 ret_ref = (uintptr_t)ret_var.inner;
7936 if (ret_var.is_owned) {
7942 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7943 CHECK(!owner->result_ok);
7944 return DecodeError_clone(&*owner->contents.err);
7946 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
7947 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7948 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7949 uint32_t ret_ref = 0;
7950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7953 ret_ref = (uintptr_t)ret_var.inner;
7954 if (ret_var.is_owned) {
7960 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
7961 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7963 case LDKSignOrCreationError_SignError: return 0;
7964 case LDKSignOrCreationError_CreationError: return 1;
7968 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
7969 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7970 assert(obj->tag == LDKSignOrCreationError_CreationError);
7971 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7972 return creation_error_conv;
7974 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7975 CHECK(owner->result_ok);
7976 return Invoice_clone(&*owner->contents.result);
7978 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
7979 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7980 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7981 uint32_t ret_ref = 0;
7982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7985 ret_ref = (uintptr_t)ret_var.inner;
7986 if (ret_var.is_owned) {
7992 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7993 CHECK(!owner->result_ok);
7994 return SignOrCreationError_clone(&*owner->contents.err);
7996 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
7997 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7998 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7999 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8000 uint32_t ret_ref = (uintptr_t)ret_copy;
8004 typedef struct LDKFilter_JCalls {
8005 atomic_size_t refcnt;
8006 uint32_t instance_ptr;
8008 static void LDKFilter_JCalls_free(void* this_arg) {
8009 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8010 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8014 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8015 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8016 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8017 memcpy(txid_arr->elems, *txid, 32);
8018 LDKu8slice script_pubkey_var = script_pubkey;
8019 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8020 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8021 js_invoke_function_u_uu(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
8023 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8024 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8025 LDKWatchedOutput output_var = output;
8026 uint32_t output_ref = 0;
8027 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8028 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8029 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8030 output_ref = (uintptr_t)output_var.inner;
8031 if (output_var.is_owned) {
8034 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 33, (uint32_t)output_ref);
8035 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8036 CHECK_ACCESS(ret_ptr);
8037 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
8041 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8042 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8043 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8045 static inline LDKFilter LDKFilter_init (JSValue o) {
8046 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8047 atomic_init(&calls->refcnt, 1);
8048 calls->instance_ptr = o;
8051 .this_arg = (void*) calls,
8052 .register_tx = register_tx_LDKFilter_jcall,
8053 .register_output = register_output_LDKFilter_jcall,
8054 .free = LDKFilter_JCalls_free,
8058 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8059 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8060 *res_ptr = LDKFilter_init(o);
8061 return (long)res_ptr;
8063 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8064 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8065 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8066 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8067 unsigned char txid_arr[32];
8068 CHECK(txid->arr_len == 32);
8069 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8070 unsigned char (*txid_ref)[32] = &txid_arr;
8071 LDKu8slice script_pubkey_ref;
8072 script_pubkey_ref.datalen = script_pubkey->arr_len;
8073 script_pubkey_ref.data = script_pubkey->elems;
8074 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8075 FREE(script_pubkey);
8078 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
8079 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8080 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8081 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8082 LDKWatchedOutput output_conv;
8083 output_conv.inner = (void*)(output & (~1));
8084 output_conv.is_owned = (output & 1) || (output == 0);
8085 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8086 output_conv = WatchedOutput_clone(&output_conv);
8087 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8088 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8089 uint32_t ret_ref = (uintptr_t)ret_copy;
8093 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
8094 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8096 case LDKCOption_FilterZ_Some: return 0;
8097 case LDKCOption_FilterZ_None: return 1;
8101 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
8102 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
8103 assert(obj->tag == LDKCOption_FilterZ_Some);
8104 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8105 *some_ret = obj->some;
8106 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8107 if ((*some_ret).free == LDKFilter_JCalls_free) {
8108 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8109 LDKFilter_JCalls_cloned(&(*some_ret));
8111 return (uint32_t)some_ret;
8113 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8114 CHECK(owner->result_ok);
8115 return &*owner->contents.result;
8117 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
8118 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8119 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8120 uint32_t ret_ref = 0;
8121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8124 ret_ref = (uintptr_t)ret_var.inner & ~1;
8128 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8129 CHECK(!owner->result_ok);
8130 return *owner->contents.err;
8132 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
8133 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
8134 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8137 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8138 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8139 for (size_t i = 0; i < ret.datalen; i++) {
8140 ret.data[i] = OutPoint_clone(&orig->data[i]);
8144 typedef struct LDKMessageSendEventsProvider_JCalls {
8145 atomic_size_t refcnt;
8146 uint32_t instance_ptr;
8147 } LDKMessageSendEventsProvider_JCalls;
8148 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8149 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8150 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8154 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8155 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8156 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 34);
8157 LDKCVec_MessageSendEventZ ret_constr;
8158 ret_constr.datalen = ret->arr_len;
8159 if (ret_constr.datalen > 0)
8160 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8162 ret_constr.data = NULL;
8163 uint32_t* ret_vals = ret->elems;
8164 for (size_t s = 0; s < ret_constr.datalen; s++) {
8165 uint32_t ret_conv_18 = ret_vals[s];
8166 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
8167 CHECK_ACCESS(ret_conv_18_ptr);
8168 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8169 FREE((void*)ret_conv_18);
8170 ret_constr.data[s] = ret_conv_18_conv;
8175 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8176 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8177 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8179 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8180 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8181 atomic_init(&calls->refcnt, 1);
8182 calls->instance_ptr = o;
8184 LDKMessageSendEventsProvider ret = {
8185 .this_arg = (void*) calls,
8186 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8187 .free = LDKMessageSendEventsProvider_JCalls_free,
8191 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8192 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8193 *res_ptr = LDKMessageSendEventsProvider_init(o);
8194 return (long)res_ptr;
8196 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) {
8197 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8198 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8199 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8200 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8201 uint32_tArray ret_arr = NULL;
8202 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
8203 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
8204 for (size_t s = 0; s < ret_var.datalen; s++) {
8205 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8206 *ret_conv_18_copy = ret_var.data[s];
8207 uint32_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
8208 ret_arr_ptr[s] = ret_conv_18_ref;
8215 typedef struct LDKEventHandler_JCalls {
8216 atomic_size_t refcnt;
8217 uint32_t instance_ptr;
8218 } LDKEventHandler_JCalls;
8219 static void LDKEventHandler_JCalls_free(void* this_arg) {
8220 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8221 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8225 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8226 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8227 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8228 *ret_event = Event_clone(event);
8229 js_invoke_function_u_u(j_calls->instance_ptr, 35, (uint32_t)(uint32_t)ret_event);
8231 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8232 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8233 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8235 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8236 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8237 atomic_init(&calls->refcnt, 1);
8238 calls->instance_ptr = o;
8240 LDKEventHandler ret = {
8241 .this_arg = (void*) calls,
8242 .handle_event = handle_event_LDKEventHandler_jcall,
8243 .free = LDKEventHandler_JCalls_free,
8247 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8248 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8249 *res_ptr = LDKEventHandler_init(o);
8250 return (long)res_ptr;
8252 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
8253 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8254 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8255 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8256 LDKEvent* event_conv = (LDKEvent*)event;
8257 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8260 typedef struct LDKEventsProvider_JCalls {
8261 atomic_size_t refcnt;
8262 uint32_t instance_ptr;
8263 } LDKEventsProvider_JCalls;
8264 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8265 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8266 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8270 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8271 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8272 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8273 *handler_ret = handler;
8274 js_invoke_function_u_u(j_calls->instance_ptr, 36, (uint32_t)(uint32_t)handler_ret);
8276 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8277 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8278 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8280 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8281 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8282 atomic_init(&calls->refcnt, 1);
8283 calls->instance_ptr = o;
8285 LDKEventsProvider ret = {
8286 .this_arg = (void*) calls,
8287 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8288 .free = LDKEventsProvider_JCalls_free,
8292 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8293 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8294 *res_ptr = LDKEventsProvider_init(o);
8295 return (long)res_ptr;
8297 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
8298 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8299 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8300 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8301 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
8302 CHECK_ACCESS(handler_ptr);
8303 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8304 if (handler_conv.free == LDKEventHandler_JCalls_free) {
8305 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8306 LDKEventHandler_JCalls_cloned(&handler_conv);
8308 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8311 typedef struct LDKScore_JCalls {
8312 atomic_size_t refcnt;
8313 uint32_t instance_ptr;
8315 static void LDKScore_JCalls_free(void* this_arg) {
8316 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8317 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8321 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8322 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8323 int64_t short_channel_id_conv = short_channel_id;
8324 LDKNodeId source_var = *source;
8325 uint32_t source_ref = 0;
8326 source_var = NodeId_clone(&source_var);
8327 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8328 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8329 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8330 source_ref = (uintptr_t)source_var.inner;
8331 if (source_var.is_owned) {
8334 LDKNodeId target_var = *target;
8335 uint32_t target_ref = 0;
8336 target_var = NodeId_clone(&target_var);
8337 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8338 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8339 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8340 target_ref = (uintptr_t)target_var.inner;
8341 if (target_var.is_owned) {
8344 LDKChannelUsage usage_var = usage;
8345 uint32_t usage_ref = 0;
8346 CHECK((((uintptr_t)usage_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8347 CHECK((((uintptr_t)&usage_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8348 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8349 usage_ref = (uintptr_t)usage_var.inner;
8350 if (usage_var.is_owned) {
8353 return js_invoke_function_b_uuuu(j_calls->instance_ptr, 37, (uint32_t)short_channel_id_conv, (uint32_t)source_ref, (uint32_t)target_ref, (uint32_t)usage_ref);
8355 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8356 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8357 LDKCVec_RouteHopZ path_var = path;
8358 uint32_tArray path_arr = NULL;
8359 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8360 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8361 for (size_t k = 0; k < path_var.datalen; k++) {
8362 LDKRouteHop path_conv_10_var = path_var.data[k];
8363 uint32_t path_conv_10_ref = 0;
8364 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8365 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8366 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8367 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8368 if (path_conv_10_var.is_owned) {
8369 path_conv_10_ref |= 1;
8371 path_arr_ptr[k] = path_conv_10_ref;
8374 FREE(path_var.data);
8375 int64_t short_channel_id_conv = short_channel_id;
8376 js_invoke_function_u_bb(j_calls->instance_ptr, 38, (uint32_t)path_arr, (uint32_t)short_channel_id_conv);
8378 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8379 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8380 LDKCVec_RouteHopZ path_var = path;
8381 uint32_tArray path_arr = NULL;
8382 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
8383 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
8384 for (size_t k = 0; k < path_var.datalen; k++) {
8385 LDKRouteHop path_conv_10_var = path_var.data[k];
8386 uint32_t path_conv_10_ref = 0;
8387 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8388 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8389 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8390 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
8391 if (path_conv_10_var.is_owned) {
8392 path_conv_10_ref |= 1;
8394 path_arr_ptr[k] = path_conv_10_ref;
8397 FREE(path_var.data);
8398 js_invoke_function_u_u(j_calls->instance_ptr, 39, (uint32_t)path_arr);
8400 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8401 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8402 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 40);
8403 LDKCVec_u8Z ret_ref;
8404 ret_ref.datalen = ret->arr_len;
8405 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8406 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8409 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8410 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8411 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8413 static inline LDKScore LDKScore_init (JSValue o) {
8414 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8415 atomic_init(&calls->refcnt, 1);
8416 calls->instance_ptr = o;
8419 .this_arg = (void*) calls,
8420 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8421 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8422 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8423 .write = write_LDKScore_jcall,
8424 .free = LDKScore_JCalls_free,
8428 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8429 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8430 *res_ptr = LDKScore_init(o);
8431 return (long)res_ptr;
8433 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) {
8434 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8435 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8436 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8437 LDKNodeId source_conv;
8438 source_conv.inner = (void*)(source & (~1));
8439 source_conv.is_owned = false;
8440 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8441 LDKNodeId target_conv;
8442 target_conv.inner = (void*)(target & (~1));
8443 target_conv.is_owned = false;
8444 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8445 LDKChannelUsage usage_conv;
8446 usage_conv.inner = (void*)(usage & (~1));
8447 usage_conv.is_owned = (usage & 1) || (usage == 0);
8448 CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8449 usage_conv = ChannelUsage_clone(&usage_conv);
8450 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8454 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) {
8455 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8457 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8458 LDKCVec_RouteHopZ path_constr;
8459 path_constr.datalen = path->arr_len;
8460 if (path_constr.datalen > 0)
8461 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8463 path_constr.data = NULL;
8464 uint32_t* path_vals = path->elems;
8465 for (size_t k = 0; k < path_constr.datalen; k++) {
8466 uint32_t path_conv_10 = path_vals[k];
8467 LDKRouteHop path_conv_10_conv;
8468 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8469 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8470 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8471 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8472 path_constr.data[k] = path_conv_10_conv;
8475 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8478 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8479 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8480 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8481 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8482 LDKCVec_RouteHopZ path_constr;
8483 path_constr.datalen = path->arr_len;
8484 if (path_constr.datalen > 0)
8485 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8487 path_constr.data = NULL;
8488 uint32_t* path_vals = path->elems;
8489 for (size_t k = 0; k < path_constr.datalen; k++) {
8490 uint32_t path_conv_10 = path_vals[k];
8491 LDKRouteHop path_conv_10_conv;
8492 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8493 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8494 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8495 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8496 path_constr.data[k] = path_conv_10_conv;
8499 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8502 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
8503 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8504 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8505 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8506 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8507 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8508 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8509 CVec_u8Z_free(ret_var);
8513 typedef struct LDKPersister_JCalls {
8514 atomic_size_t refcnt;
8515 uint32_t instance_ptr;
8516 } LDKPersister_JCalls;
8517 static void LDKPersister_JCalls_free(void* this_arg) {
8518 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8519 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8523 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8524 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8525 LDKChannelManager channel_manager_var = *channel_manager;
8526 uint32_t channel_manager_ref = 0;
8527 // WARNING: we may need a move here but no clone is available for LDKChannelManager
8528 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8529 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8530 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8531 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
8532 if (channel_manager_var.is_owned) {
8533 channel_manager_ref |= 1;
8535 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 41, (uint32_t)channel_manager_ref);
8536 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8537 CHECK_ACCESS(ret_ptr);
8538 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8542 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8543 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8544 LDKNetworkGraph network_graph_var = *network_graph;
8545 uint32_t network_graph_ref = 0;
8546 // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8547 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8548 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8549 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8550 network_graph_ref = (uintptr_t)network_graph_var.inner;
8551 if (network_graph_var.is_owned) {
8552 network_graph_ref |= 1;
8554 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 42, (uint32_t)network_graph_ref);
8555 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8556 CHECK_ACCESS(ret_ptr);
8557 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8561 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
8562 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8563 LDKMultiThreadedLockableScore scorer_var = *scorer;
8564 uint32_t scorer_ref = 0;
8565 // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
8566 CHECK((((uintptr_t)scorer_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8567 CHECK((((uintptr_t)&scorer_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8568 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
8569 scorer_ref = (uintptr_t)scorer_var.inner;
8570 if (scorer_var.is_owned) {
8573 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 43, (uint32_t)scorer_ref);
8574 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8575 CHECK_ACCESS(ret_ptr);
8576 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8580 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8581 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8582 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8584 static inline LDKPersister LDKPersister_init (JSValue o) {
8585 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8586 atomic_init(&calls->refcnt, 1);
8587 calls->instance_ptr = o;
8589 LDKPersister ret = {
8590 .this_arg = (void*) calls,
8591 .persist_manager = persist_manager_LDKPersister_jcall,
8592 .persist_graph = persist_graph_LDKPersister_jcall,
8593 .persist_scorer = persist_scorer_LDKPersister_jcall,
8594 .free = LDKPersister_JCalls_free,
8598 long __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8599 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8600 *res_ptr = LDKPersister_init(o);
8601 return (long)res_ptr;
8603 uint32_t __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint32_t this_arg, uint32_t channel_manager) {
8604 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8606 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8607 LDKChannelManager channel_manager_conv;
8608 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8609 channel_manager_conv.is_owned = false;
8610 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8611 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8612 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8613 return (uint32_t)ret_conv;
8616 uint32_t __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint32_t this_arg, uint32_t network_graph) {
8617 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8618 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8619 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8620 LDKNetworkGraph network_graph_conv;
8621 network_graph_conv.inner = (void*)(network_graph & (~1));
8622 network_graph_conv.is_owned = false;
8623 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8624 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8625 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8626 return (uint32_t)ret_conv;
8629 uint32_t __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint32_t this_arg, uint32_t scorer) {
8630 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8631 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8632 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8633 LDKMultiThreadedLockableScore scorer_conv;
8634 scorer_conv.inner = (void*)(scorer & (~1));
8635 scorer_conv.is_owned = false;
8636 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
8637 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8638 *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
8639 return (uint32_t)ret_conv;
8642 typedef struct LDKListen_JCalls {
8643 atomic_size_t refcnt;
8644 uint32_t instance_ptr;
8646 static void LDKListen_JCalls_free(void* this_arg) {
8647 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8648 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8652 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8653 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8654 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8655 memcpy(header_arr->elems, *header, 80);
8656 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8657 uint32_tArray txdata_arr = NULL;
8658 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8659 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8660 for (size_t c = 0; c < txdata_var.datalen; c++) {
8661 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8662 *txdata_conv_28_conv = txdata_var.data[c];
8663 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8666 FREE(txdata_var.data);
8667 int32_t height_conv = height;
8668 js_invoke_function_u_uuu(j_calls->instance_ptr, 44, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8670 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8671 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8672 LDKu8slice block_var = block;
8673 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8674 memcpy(block_arr->elems, block_var.data, block_var.datalen);
8675 int32_t height_conv = height;
8676 js_invoke_function_u_uu(j_calls->instance_ptr, 45, (uint32_t)block_arr, (uint32_t)height_conv);
8678 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8679 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8680 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8681 memcpy(header_arr->elems, *header, 80);
8682 int32_t height_conv = height;
8683 js_invoke_function_u_uu(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)height_conv);
8685 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8686 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8687 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8689 static inline LDKListen LDKListen_init (JSValue o) {
8690 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8691 atomic_init(&calls->refcnt, 1);
8692 calls->instance_ptr = o;
8695 .this_arg = (void*) calls,
8696 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8697 .block_connected = block_connected_LDKListen_jcall,
8698 .block_disconnected = block_disconnected_LDKListen_jcall,
8699 .free = LDKListen_JCalls_free,
8703 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8704 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8705 *res_ptr = LDKListen_init(o);
8706 return (long)res_ptr;
8708 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) {
8709 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8710 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8711 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8712 unsigned char header_arr[80];
8713 CHECK(header->arr_len == 80);
8714 memcpy(header_arr, header->elems, 80); FREE(header);
8715 unsigned char (*header_ref)[80] = &header_arr;
8716 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8717 txdata_constr.datalen = txdata->arr_len;
8718 if (txdata_constr.datalen > 0)
8719 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8721 txdata_constr.data = NULL;
8722 uint32_t* txdata_vals = txdata->elems;
8723 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8724 uint32_t txdata_conv_28 = txdata_vals[c];
8725 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8726 CHECK_ACCESS(txdata_conv_28_ptr);
8727 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8728 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8729 txdata_constr.data[c] = txdata_conv_28_conv;
8732 (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8735 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
8736 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8737 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8738 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8739 LDKu8slice block_ref;
8740 block_ref.datalen = block->arr_len;
8741 block_ref.data = block->elems;
8742 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8746 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
8747 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8748 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8749 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8750 unsigned char header_arr[80];
8751 CHECK(header->arr_len == 80);
8752 memcpy(header_arr, header->elems, 80); FREE(header);
8753 unsigned char (*header_ref)[80] = &header_arr;
8754 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8757 typedef struct LDKConfirm_JCalls {
8758 atomic_size_t refcnt;
8759 uint32_t instance_ptr;
8760 } LDKConfirm_JCalls;
8761 static void LDKConfirm_JCalls_free(void* this_arg) {
8762 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8763 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8767 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8768 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8769 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8770 memcpy(header_arr->elems, *header, 80);
8771 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8772 uint32_tArray txdata_arr = NULL;
8773 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8774 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8775 for (size_t c = 0; c < txdata_var.datalen; c++) {
8776 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8777 *txdata_conv_28_conv = txdata_var.data[c];
8778 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8781 FREE(txdata_var.data);
8782 int32_t height_conv = height;
8783 js_invoke_function_u_uuu(j_calls->instance_ptr, 47, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height_conv);
8785 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8786 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8787 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8788 memcpy(txid_arr->elems, *txid, 32);
8789 js_invoke_function_u_u(j_calls->instance_ptr, 48, (uint32_t)txid_arr);
8791 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8792 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8793 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8794 memcpy(header_arr->elems, *header, 80);
8795 int32_t height_conv = height;
8796 js_invoke_function_u_uu(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)height_conv);
8798 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8799 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8800 ptrArray ret = (ptrArray)js_invoke_function_u_(j_calls->instance_ptr, 50);
8801 LDKCVec_TxidZ ret_constr;
8802 ret_constr.datalen = ret->arr_len;
8803 if (ret_constr.datalen > 0)
8804 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8806 ret_constr.data = NULL;
8807 int8_tArray* ret_vals = (void*) ret->elems;
8808 for (size_t m = 0; m < ret_constr.datalen; m++) {
8809 int8_tArray ret_conv_12 = ret_vals[m];
8810 LDKThirtyTwoBytes ret_conv_12_ref;
8811 CHECK(ret_conv_12->arr_len == 32);
8812 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8813 ret_constr.data[m] = ret_conv_12_ref;
8818 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8819 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8820 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8822 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8823 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8824 atomic_init(&calls->refcnt, 1);
8825 calls->instance_ptr = o;
8828 .this_arg = (void*) calls,
8829 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8830 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8831 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8832 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8833 .free = LDKConfirm_JCalls_free,
8837 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8838 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8839 *res_ptr = LDKConfirm_init(o);
8840 return (long)res_ptr;
8842 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) {
8843 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8844 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8845 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8846 unsigned char header_arr[80];
8847 CHECK(header->arr_len == 80);
8848 memcpy(header_arr, header->elems, 80); FREE(header);
8849 unsigned char (*header_ref)[80] = &header_arr;
8850 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8851 txdata_constr.datalen = txdata->arr_len;
8852 if (txdata_constr.datalen > 0)
8853 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8855 txdata_constr.data = NULL;
8856 uint32_t* txdata_vals = txdata->elems;
8857 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8858 uint32_t txdata_conv_28 = txdata_vals[c];
8859 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8860 CHECK_ACCESS(txdata_conv_28_ptr);
8861 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8862 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8863 txdata_constr.data[c] = txdata_conv_28_conv;
8866 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8869 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
8870 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8871 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8872 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8873 unsigned char txid_arr[32];
8874 CHECK(txid->arr_len == 32);
8875 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8876 unsigned char (*txid_ref)[32] = &txid_arr;
8877 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8880 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
8881 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8882 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8883 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8884 unsigned char header_arr[80];
8885 CHECK(header->arr_len == 80);
8886 memcpy(header_arr, header->elems, 80); FREE(header);
8887 unsigned char (*header_ref)[80] = &header_arr;
8888 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8891 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
8892 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8893 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8894 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8895 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8896 ptrArray ret_arr = NULL;
8897 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8898 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
8899 for (size_t m = 0; m < ret_var.datalen; m++) {
8900 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8901 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8902 ret_arr_ptr[m] = ret_conv_12_arr;
8909 typedef struct LDKPersist_JCalls {
8910 atomic_size_t refcnt;
8911 uint32_t instance_ptr;
8912 } LDKPersist_JCalls;
8913 static void LDKPersist_JCalls_free(void* this_arg) {
8914 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8915 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8919 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8920 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8921 LDKOutPoint channel_id_var = channel_id;
8922 uint32_t channel_id_ref = 0;
8923 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8924 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8925 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8926 channel_id_ref = (uintptr_t)channel_id_var.inner;
8927 if (channel_id_var.is_owned) {
8928 channel_id_ref |= 1;
8930 LDKChannelMonitor data_var = *data;
8931 uint32_t data_ref = 0;
8932 data_var = ChannelMonitor_clone(&data_var);
8933 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8934 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8935 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8936 data_ref = (uintptr_t)data_var.inner;
8937 if (data_var.is_owned) {
8940 LDKMonitorUpdateId update_id_var = update_id;
8941 uint32_t update_id_ref = 0;
8942 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8943 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8944 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8945 update_id_ref = (uintptr_t)update_id_var.inner;
8946 if (update_id_var.is_owned) {
8949 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 51, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8950 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8951 CHECK_ACCESS(ret_ptr);
8952 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8956 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8957 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8958 LDKOutPoint channel_id_var = channel_id;
8959 uint32_t channel_id_ref = 0;
8960 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8961 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8962 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8963 channel_id_ref = (uintptr_t)channel_id_var.inner;
8964 if (channel_id_var.is_owned) {
8965 channel_id_ref |= 1;
8967 LDKChannelMonitorUpdate update_var = *update;
8968 uint32_t update_ref = 0;
8969 if ((uintptr_t)update_var.inner > 4096) {
8970 update_var = ChannelMonitorUpdate_clone(&update_var);
8971 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8972 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8973 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8974 update_ref = (uintptr_t)update_var.inner;
8975 if (update_var.is_owned) {
8979 LDKChannelMonitor data_var = *data;
8980 uint32_t data_ref = 0;
8981 data_var = ChannelMonitor_clone(&data_var);
8982 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8983 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8984 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8985 data_ref = (uintptr_t)data_var.inner;
8986 if (data_var.is_owned) {
8989 LDKMonitorUpdateId update_id_var = update_id;
8990 uint32_t update_id_ref = 0;
8991 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8992 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8993 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8994 update_id_ref = (uintptr_t)update_id_var.inner;
8995 if (update_id_var.is_owned) {
8998 uint32_t ret = js_invoke_function_u_uuuu(j_calls->instance_ptr, 52, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8999 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9000 CHECK_ACCESS(ret_ptr);
9001 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9005 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9006 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9007 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9009 static inline LDKPersist LDKPersist_init (JSValue o) {
9010 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9011 atomic_init(&calls->refcnt, 1);
9012 calls->instance_ptr = o;
9015 .this_arg = (void*) calls,
9016 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9017 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9018 .free = LDKPersist_JCalls_free,
9022 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9023 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9024 *res_ptr = LDKPersist_init(o);
9025 return (long)res_ptr;
9027 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) {
9028 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9030 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9031 LDKOutPoint channel_id_conv;
9032 channel_id_conv.inner = (void*)(channel_id & (~1));
9033 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9034 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9035 channel_id_conv = OutPoint_clone(&channel_id_conv);
9036 LDKChannelMonitor data_conv;
9037 data_conv.inner = (void*)(data & (~1));
9038 data_conv.is_owned = false;
9039 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9040 LDKMonitorUpdateId update_id_conv;
9041 update_id_conv.inner = (void*)(update_id & (~1));
9042 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9043 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9044 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9045 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9046 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9047 return (uint32_t)ret_conv;
9050 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) {
9051 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9052 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9053 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9054 LDKOutPoint channel_id_conv;
9055 channel_id_conv.inner = (void*)(channel_id & (~1));
9056 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9057 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9058 channel_id_conv = OutPoint_clone(&channel_id_conv);
9059 LDKChannelMonitorUpdate update_conv;
9060 update_conv.inner = (void*)(update & (~1));
9061 update_conv.is_owned = false;
9062 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9063 LDKChannelMonitor data_conv;
9064 data_conv.inner = (void*)(data & (~1));
9065 data_conv.is_owned = false;
9066 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9067 LDKMonitorUpdateId update_id_conv;
9068 update_id_conv.inner = (void*)(update_id & (~1));
9069 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9070 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9071 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9072 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9073 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9074 return (uint32_t)ret_conv;
9077 typedef struct LDKChannelMessageHandler_JCalls {
9078 atomic_size_t refcnt;
9079 uint32_t instance_ptr;
9080 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9081 } LDKChannelMessageHandler_JCalls;
9082 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9083 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9084 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9088 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9089 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9090 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9091 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9092 LDKInitFeatures their_features_var = their_features;
9093 uint32_t their_features_ref = 0;
9094 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9095 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9096 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9097 their_features_ref = (uintptr_t)their_features_var.inner;
9098 if (their_features_var.is_owned) {
9099 their_features_ref |= 1;
9101 LDKOpenChannel msg_var = *msg;
9102 uint32_t msg_ref = 0;
9103 msg_var = OpenChannel_clone(&msg_var);
9104 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9105 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9106 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9107 msg_ref = (uintptr_t)msg_var.inner;
9108 if (msg_var.is_owned) {
9111 js_invoke_function_u_uuu(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9113 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9114 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9115 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9116 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9117 LDKInitFeatures their_features_var = their_features;
9118 uint32_t their_features_ref = 0;
9119 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9120 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9121 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9122 their_features_ref = (uintptr_t)their_features_var.inner;
9123 if (their_features_var.is_owned) {
9124 their_features_ref |= 1;
9126 LDKAcceptChannel msg_var = *msg;
9127 uint32_t msg_ref = 0;
9128 msg_var = AcceptChannel_clone(&msg_var);
9129 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9130 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9131 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9132 msg_ref = (uintptr_t)msg_var.inner;
9133 if (msg_var.is_owned) {
9136 js_invoke_function_u_uuu(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9138 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9139 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9140 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9141 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9142 LDKFundingCreated msg_var = *msg;
9143 uint32_t msg_ref = 0;
9144 msg_var = FundingCreated_clone(&msg_var);
9145 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9146 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9147 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9148 msg_ref = (uintptr_t)msg_var.inner;
9149 if (msg_var.is_owned) {
9152 js_invoke_function_u_uu(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9154 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9156 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9157 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9158 LDKFundingSigned msg_var = *msg;
9159 uint32_t msg_ref = 0;
9160 msg_var = FundingSigned_clone(&msg_var);
9161 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9162 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9163 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9164 msg_ref = (uintptr_t)msg_var.inner;
9165 if (msg_var.is_owned) {
9168 js_invoke_function_u_uu(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9170 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9171 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9172 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9173 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9174 LDKChannelReady msg_var = *msg;
9175 uint32_t msg_ref = 0;
9176 msg_var = ChannelReady_clone(&msg_var);
9177 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9178 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9180 msg_ref = (uintptr_t)msg_var.inner;
9181 if (msg_var.is_owned) {
9184 js_invoke_function_u_uu(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9186 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9188 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9189 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9190 LDKInitFeatures their_features_var = *their_features;
9191 uint32_t their_features_ref = 0;
9192 their_features_var = InitFeatures_clone(&their_features_var);
9193 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9194 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9195 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9196 their_features_ref = (uintptr_t)their_features_var.inner;
9197 if (their_features_var.is_owned) {
9198 their_features_ref |= 1;
9200 LDKShutdown msg_var = *msg;
9201 uint32_t msg_ref = 0;
9202 msg_var = Shutdown_clone(&msg_var);
9203 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9204 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9205 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9206 msg_ref = (uintptr_t)msg_var.inner;
9207 if (msg_var.is_owned) {
9210 js_invoke_function_u_uuu(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
9212 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9213 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9214 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9215 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9216 LDKClosingSigned msg_var = *msg;
9217 uint32_t msg_ref = 0;
9218 msg_var = ClosingSigned_clone(&msg_var);
9219 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9220 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9221 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9222 msg_ref = (uintptr_t)msg_var.inner;
9223 if (msg_var.is_owned) {
9226 js_invoke_function_u_uu(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9228 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9229 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9230 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9231 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9232 LDKUpdateAddHTLC msg_var = *msg;
9233 uint32_t msg_ref = 0;
9234 msg_var = UpdateAddHTLC_clone(&msg_var);
9235 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9236 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9237 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9238 msg_ref = (uintptr_t)msg_var.inner;
9239 if (msg_var.is_owned) {
9242 js_invoke_function_u_uu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9244 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9245 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9246 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9247 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9248 LDKUpdateFulfillHTLC msg_var = *msg;
9249 uint32_t msg_ref = 0;
9250 msg_var = UpdateFulfillHTLC_clone(&msg_var);
9251 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9252 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9253 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9254 msg_ref = (uintptr_t)msg_var.inner;
9255 if (msg_var.is_owned) {
9258 js_invoke_function_u_uu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9260 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9261 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9262 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9263 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9264 LDKUpdateFailHTLC msg_var = *msg;
9265 uint32_t msg_ref = 0;
9266 msg_var = UpdateFailHTLC_clone(&msg_var);
9267 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9268 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9269 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9270 msg_ref = (uintptr_t)msg_var.inner;
9271 if (msg_var.is_owned) {
9274 js_invoke_function_u_uu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9276 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9277 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9278 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9279 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9280 LDKUpdateFailMalformedHTLC msg_var = *msg;
9281 uint32_t msg_ref = 0;
9282 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9283 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9284 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9285 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9286 msg_ref = (uintptr_t)msg_var.inner;
9287 if (msg_var.is_owned) {
9290 js_invoke_function_u_uu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9292 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9293 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9294 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9295 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9296 LDKCommitmentSigned msg_var = *msg;
9297 uint32_t msg_ref = 0;
9298 msg_var = CommitmentSigned_clone(&msg_var);
9299 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9300 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9301 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9302 msg_ref = (uintptr_t)msg_var.inner;
9303 if (msg_var.is_owned) {
9306 js_invoke_function_u_uu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9308 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9309 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9310 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9311 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9312 LDKRevokeAndACK msg_var = *msg;
9313 uint32_t msg_ref = 0;
9314 msg_var = RevokeAndACK_clone(&msg_var);
9315 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9316 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9317 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9318 msg_ref = (uintptr_t)msg_var.inner;
9319 if (msg_var.is_owned) {
9322 js_invoke_function_u_uu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9324 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9325 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9326 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9327 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9328 LDKUpdateFee msg_var = *msg;
9329 uint32_t msg_ref = 0;
9330 msg_var = UpdateFee_clone(&msg_var);
9331 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9332 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9333 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9334 msg_ref = (uintptr_t)msg_var.inner;
9335 if (msg_var.is_owned) {
9338 js_invoke_function_u_uu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9340 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9341 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9342 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9343 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9344 LDKAnnouncementSignatures msg_var = *msg;
9345 uint32_t msg_ref = 0;
9346 msg_var = AnnouncementSignatures_clone(&msg_var);
9347 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9348 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9349 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9350 msg_ref = (uintptr_t)msg_var.inner;
9351 if (msg_var.is_owned) {
9354 js_invoke_function_u_uu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9356 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9357 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9358 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9359 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9360 jboolean no_connection_possible_conv = no_connection_possible;
9361 js_invoke_function_u_uu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible_conv);
9363 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9364 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9365 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9366 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9367 LDKInit msg_var = *msg;
9368 uint32_t msg_ref = 0;
9369 msg_var = Init_clone(&msg_var);
9370 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9371 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9372 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9373 msg_ref = (uintptr_t)msg_var.inner;
9374 if (msg_var.is_owned) {
9377 js_invoke_function_u_uu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9379 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9380 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9381 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9382 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9383 LDKChannelReestablish msg_var = *msg;
9384 uint32_t msg_ref = 0;
9385 msg_var = ChannelReestablish_clone(&msg_var);
9386 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9387 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9388 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9389 msg_ref = (uintptr_t)msg_var.inner;
9390 if (msg_var.is_owned) {
9393 js_invoke_function_u_uu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9395 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9396 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9397 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9398 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9399 LDKChannelUpdate msg_var = *msg;
9400 uint32_t msg_ref = 0;
9401 msg_var = ChannelUpdate_clone(&msg_var);
9402 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9403 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9405 msg_ref = (uintptr_t)msg_var.inner;
9406 if (msg_var.is_owned) {
9409 js_invoke_function_u_uu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9411 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9412 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9413 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9414 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9415 LDKErrorMessage msg_var = *msg;
9416 uint32_t msg_ref = 0;
9417 msg_var = ErrorMessage_clone(&msg_var);
9418 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9419 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9420 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9421 msg_ref = (uintptr_t)msg_var.inner;
9422 if (msg_var.is_owned) {
9425 js_invoke_function_u_uu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9427 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9428 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9429 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9430 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9432 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9433 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9434 atomic_init(&calls->refcnt, 1);
9435 calls->instance_ptr = o;
9437 LDKChannelMessageHandler ret = {
9438 .this_arg = (void*) calls,
9439 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9440 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9441 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9442 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9443 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9444 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9445 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9446 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9447 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9448 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9449 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9450 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9451 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9452 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9453 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9454 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9455 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9456 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9457 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9458 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9459 .free = LDKChannelMessageHandler_JCalls_free,
9460 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9462 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9465 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9466 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9467 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9468 return (long)res_ptr;
9470 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) {
9471 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9472 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9473 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9474 LDKPublicKey their_node_id_ref;
9475 CHECK(their_node_id->arr_len == 33);
9476 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9477 LDKInitFeatures their_features_conv;
9478 their_features_conv.inner = (void*)(their_features & (~1));
9479 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9480 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9481 their_features_conv = InitFeatures_clone(&their_features_conv);
9482 LDKOpenChannel msg_conv;
9483 msg_conv.inner = (void*)(msg & (~1));
9484 msg_conv.is_owned = false;
9485 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9486 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9489 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) {
9490 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9491 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9492 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9493 LDKPublicKey their_node_id_ref;
9494 CHECK(their_node_id->arr_len == 33);
9495 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9496 LDKInitFeatures their_features_conv;
9497 their_features_conv.inner = (void*)(their_features & (~1));
9498 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9499 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9500 their_features_conv = InitFeatures_clone(&their_features_conv);
9501 LDKAcceptChannel msg_conv;
9502 msg_conv.inner = (void*)(msg & (~1));
9503 msg_conv.is_owned = false;
9504 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9505 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9508 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) {
9509 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9510 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9511 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9512 LDKPublicKey their_node_id_ref;
9513 CHECK(their_node_id->arr_len == 33);
9514 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9515 LDKFundingCreated msg_conv;
9516 msg_conv.inner = (void*)(msg & (~1));
9517 msg_conv.is_owned = false;
9518 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9519 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9522 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) {
9523 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9524 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9525 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9526 LDKPublicKey their_node_id_ref;
9527 CHECK(their_node_id->arr_len == 33);
9528 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9529 LDKFundingSigned msg_conv;
9530 msg_conv.inner = (void*)(msg & (~1));
9531 msg_conv.is_owned = false;
9532 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9533 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9536 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) {
9537 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9538 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9539 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9540 LDKPublicKey their_node_id_ref;
9541 CHECK(their_node_id->arr_len == 33);
9542 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9543 LDKChannelReady msg_conv;
9544 msg_conv.inner = (void*)(msg & (~1));
9545 msg_conv.is_owned = false;
9546 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9547 (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9550 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) {
9551 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9552 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9553 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9554 LDKPublicKey their_node_id_ref;
9555 CHECK(their_node_id->arr_len == 33);
9556 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9557 LDKInitFeatures their_features_conv;
9558 their_features_conv.inner = (void*)(their_features & (~1));
9559 their_features_conv.is_owned = false;
9560 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9561 LDKShutdown msg_conv;
9562 msg_conv.inner = (void*)(msg & (~1));
9563 msg_conv.is_owned = false;
9564 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9565 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9568 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) {
9569 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9570 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9571 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9572 LDKPublicKey their_node_id_ref;
9573 CHECK(their_node_id->arr_len == 33);
9574 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9575 LDKClosingSigned msg_conv;
9576 msg_conv.inner = (void*)(msg & (~1));
9577 msg_conv.is_owned = false;
9578 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9579 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9582 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) {
9583 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9584 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9585 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9586 LDKPublicKey their_node_id_ref;
9587 CHECK(their_node_id->arr_len == 33);
9588 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9589 LDKUpdateAddHTLC msg_conv;
9590 msg_conv.inner = (void*)(msg & (~1));
9591 msg_conv.is_owned = false;
9592 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9593 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9596 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) {
9597 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9598 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9599 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9600 LDKPublicKey their_node_id_ref;
9601 CHECK(their_node_id->arr_len == 33);
9602 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9603 LDKUpdateFulfillHTLC msg_conv;
9604 msg_conv.inner = (void*)(msg & (~1));
9605 msg_conv.is_owned = false;
9606 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9607 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9610 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) {
9611 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9612 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9613 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9614 LDKPublicKey their_node_id_ref;
9615 CHECK(their_node_id->arr_len == 33);
9616 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9617 LDKUpdateFailHTLC msg_conv;
9618 msg_conv.inner = (void*)(msg & (~1));
9619 msg_conv.is_owned = false;
9620 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9621 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9624 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) {
9625 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9626 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9628 LDKPublicKey their_node_id_ref;
9629 CHECK(their_node_id->arr_len == 33);
9630 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9631 LDKUpdateFailMalformedHTLC msg_conv;
9632 msg_conv.inner = (void*)(msg & (~1));
9633 msg_conv.is_owned = false;
9634 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9635 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9638 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) {
9639 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9640 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9641 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9642 LDKPublicKey their_node_id_ref;
9643 CHECK(their_node_id->arr_len == 33);
9644 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9645 LDKCommitmentSigned msg_conv;
9646 msg_conv.inner = (void*)(msg & (~1));
9647 msg_conv.is_owned = false;
9648 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9649 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9652 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) {
9653 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9654 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9655 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9656 LDKPublicKey their_node_id_ref;
9657 CHECK(their_node_id->arr_len == 33);
9658 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9659 LDKRevokeAndACK msg_conv;
9660 msg_conv.inner = (void*)(msg & (~1));
9661 msg_conv.is_owned = false;
9662 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9663 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9666 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) {
9667 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9668 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9669 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9670 LDKPublicKey their_node_id_ref;
9671 CHECK(their_node_id->arr_len == 33);
9672 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9673 LDKUpdateFee msg_conv;
9674 msg_conv.inner = (void*)(msg & (~1));
9675 msg_conv.is_owned = false;
9676 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9677 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9680 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) {
9681 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9682 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9683 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9684 LDKPublicKey their_node_id_ref;
9685 CHECK(their_node_id->arr_len == 33);
9686 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9687 LDKAnnouncementSignatures msg_conv;
9688 msg_conv.inner = (void*)(msg & (~1));
9689 msg_conv.is_owned = false;
9690 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9691 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9694 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) {
9695 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9696 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9697 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9698 LDKPublicKey their_node_id_ref;
9699 CHECK(their_node_id->arr_len == 33);
9700 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9701 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9704 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9705 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9706 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9707 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9708 LDKPublicKey their_node_id_ref;
9709 CHECK(their_node_id->arr_len == 33);
9710 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9712 msg_conv.inner = (void*)(msg & (~1));
9713 msg_conv.is_owned = false;
9714 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9715 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9718 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) {
9719 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9720 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9721 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9722 LDKPublicKey their_node_id_ref;
9723 CHECK(their_node_id->arr_len == 33);
9724 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9725 LDKChannelReestablish msg_conv;
9726 msg_conv.inner = (void*)(msg & (~1));
9727 msg_conv.is_owned = false;
9728 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9729 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9732 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) {
9733 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9734 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9735 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9736 LDKPublicKey their_node_id_ref;
9737 CHECK(their_node_id->arr_len == 33);
9738 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9739 LDKChannelUpdate msg_conv;
9740 msg_conv.inner = (void*)(msg & (~1));
9741 msg_conv.is_owned = false;
9742 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9743 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9746 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9747 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9748 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9749 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9750 LDKPublicKey their_node_id_ref;
9751 CHECK(their_node_id->arr_len == 33);
9752 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9753 LDKErrorMessage msg_conv;
9754 msg_conv.inner = (void*)(msg & (~1));
9755 msg_conv.is_owned = false;
9756 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9757 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9760 typedef struct LDKRoutingMessageHandler_JCalls {
9761 atomic_size_t refcnt;
9762 uint32_t instance_ptr;
9763 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9764 } LDKRoutingMessageHandler_JCalls;
9765 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9766 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9767 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9771 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9772 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9773 LDKNodeAnnouncement msg_var = *msg;
9774 uint32_t msg_ref = 0;
9775 msg_var = NodeAnnouncement_clone(&msg_var);
9776 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9777 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9778 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9779 msg_ref = (uintptr_t)msg_var.inner;
9780 if (msg_var.is_owned) {
9783 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 73, (uint32_t)msg_ref);
9784 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9785 CHECK_ACCESS(ret_ptr);
9786 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9790 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9791 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9792 LDKChannelAnnouncement msg_var = *msg;
9793 uint32_t msg_ref = 0;
9794 msg_var = ChannelAnnouncement_clone(&msg_var);
9795 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9796 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9797 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9798 msg_ref = (uintptr_t)msg_var.inner;
9799 if (msg_var.is_owned) {
9802 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 74, (uint32_t)msg_ref);
9803 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9804 CHECK_ACCESS(ret_ptr);
9805 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9809 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9810 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9811 LDKChannelUpdate msg_var = *msg;
9812 uint32_t msg_ref = 0;
9813 msg_var = ChannelUpdate_clone(&msg_var);
9814 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9815 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9816 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9817 msg_ref = (uintptr_t)msg_var.inner;
9818 if (msg_var.is_owned) {
9821 uint32_t ret = js_invoke_function_u_u(j_calls->instance_ptr, 75, (uint32_t)msg_ref);
9822 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9823 CHECK_ACCESS(ret_ptr);
9824 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9828 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9829 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9830 int64_t starting_point_conv = starting_point;
9831 int8_t batch_amount_conv = batch_amount;
9832 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 76, (uint32_t)starting_point_conv, (uint32_t)batch_amount_conv);
9833 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9834 ret_constr.datalen = ret->arr_len;
9835 if (ret_constr.datalen > 0)
9836 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9838 ret_constr.data = NULL;
9839 uint32_t* ret_vals = ret->elems;
9840 for (size_t h = 0; h < ret_constr.datalen; h++) {
9841 uint32_t ret_conv_59 = ret_vals[h];
9842 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
9843 CHECK_ACCESS(ret_conv_59_ptr);
9844 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9845 FREE((void*)ret_conv_59);
9846 ret_constr.data[h] = ret_conv_59_conv;
9851 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9852 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9853 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9854 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9855 int8_t batch_amount_conv = batch_amount;
9856 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_uu(j_calls->instance_ptr, 77, (uint32_t)starting_point_arr, (uint32_t)batch_amount_conv);
9857 LDKCVec_NodeAnnouncementZ ret_constr;
9858 ret_constr.datalen = ret->arr_len;
9859 if (ret_constr.datalen > 0)
9860 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9862 ret_constr.data = NULL;
9863 uint32_t* ret_vals = ret->elems;
9864 for (size_t s = 0; s < ret_constr.datalen; s++) {
9865 uint32_t ret_conv_18 = ret_vals[s];
9866 LDKNodeAnnouncement ret_conv_18_conv;
9867 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9868 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9870 ret_constr.data[s] = ret_conv_18_conv;
9875 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9876 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9877 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9878 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9879 LDKInit init_var = *init;
9880 uint32_t init_ref = 0;
9881 init_var = Init_clone(&init_var);
9882 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9883 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9884 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9885 init_ref = (uintptr_t)init_var.inner;
9886 if (init_var.is_owned) {
9889 js_invoke_function_u_uu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
9891 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9892 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9893 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9894 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9895 LDKReplyChannelRange msg_var = msg;
9896 uint32_t msg_ref = 0;
9897 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9898 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9899 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9900 msg_ref = (uintptr_t)msg_var.inner;
9901 if (msg_var.is_owned) {
9904 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9905 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9906 CHECK_ACCESS(ret_ptr);
9907 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9911 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9912 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9913 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9914 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9915 LDKReplyShortChannelIdsEnd msg_var = msg;
9916 uint32_t msg_ref = 0;
9917 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9918 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9919 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9920 msg_ref = (uintptr_t)msg_var.inner;
9921 if (msg_var.is_owned) {
9924 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9925 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9926 CHECK_ACCESS(ret_ptr);
9927 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9931 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9932 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9933 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9934 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9935 LDKQueryChannelRange msg_var = msg;
9936 uint32_t msg_ref = 0;
9937 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9938 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9939 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9940 msg_ref = (uintptr_t)msg_var.inner;
9941 if (msg_var.is_owned) {
9944 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9945 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9946 CHECK_ACCESS(ret_ptr);
9947 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9951 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9952 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9953 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9954 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9955 LDKQueryShortChannelIds msg_var = msg;
9956 uint32_t msg_ref = 0;
9957 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9958 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9959 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9960 msg_ref = (uintptr_t)msg_var.inner;
9961 if (msg_var.is_owned) {
9964 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9965 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9966 CHECK_ACCESS(ret_ptr);
9967 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9971 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9972 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9973 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9974 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9976 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9977 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9978 atomic_init(&calls->refcnt, 1);
9979 calls->instance_ptr = o;
9981 LDKRoutingMessageHandler ret = {
9982 .this_arg = (void*) calls,
9983 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9984 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9985 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9986 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9987 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9988 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9989 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9990 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9991 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9992 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9993 .free = LDKRoutingMessageHandler_JCalls_free,
9994 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9996 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9999 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10000 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10001 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10002 return (long)res_ptr;
10004 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
10005 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10006 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10007 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10008 LDKNodeAnnouncement msg_conv;
10009 msg_conv.inner = (void*)(msg & (~1));
10010 msg_conv.is_owned = false;
10011 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10012 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10013 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10014 return (uint32_t)ret_conv;
10017 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
10018 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10019 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10020 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10021 LDKChannelAnnouncement msg_conv;
10022 msg_conv.inner = (void*)(msg & (~1));
10023 msg_conv.is_owned = false;
10024 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10025 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10026 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10027 return (uint32_t)ret_conv;
10030 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
10031 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10032 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10033 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10034 LDKChannelUpdate msg_conv;
10035 msg_conv.inner = (void*)(msg & (~1));
10036 msg_conv.is_owned = false;
10037 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10038 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10039 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10040 return (uint32_t)ret_conv;
10043 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) {
10044 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10045 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10046 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10047 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
10048 uint32_tArray ret_arr = NULL;
10049 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10050 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10051 for (size_t h = 0; h < ret_var.datalen; h++) {
10052 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10053 *ret_conv_59_conv = ret_var.data[h];
10054 ret_arr_ptr[h] = ((uint32_t)ret_conv_59_conv);
10057 FREE(ret_var.data);
10061 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) {
10062 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10063 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10064 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10065 LDKPublicKey starting_point_ref;
10066 CHECK(starting_point->arr_len == 33);
10067 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10068 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
10069 uint32_tArray ret_arr = NULL;
10070 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10071 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10072 for (size_t s = 0; s < ret_var.datalen; s++) {
10073 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
10074 uint32_t ret_conv_18_ref = 0;
10075 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10076 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
10078 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
10079 if (ret_conv_18_var.is_owned) {
10080 ret_conv_18_ref |= 1;
10082 ret_arr_ptr[s] = ret_conv_18_ref;
10085 FREE(ret_var.data);
10089 void __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
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);
10097 init_conv.inner = (void*)(init & (~1));
10098 init_conv.is_owned = false;
10099 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10100 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10103 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) {
10104 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10105 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10106 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10107 LDKPublicKey their_node_id_ref;
10108 CHECK(their_node_id->arr_len == 33);
10109 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10110 LDKReplyChannelRange msg_conv;
10111 msg_conv.inner = (void*)(msg & (~1));
10112 msg_conv.is_owned = (msg & 1) || (msg == 0);
10113 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10114 msg_conv = ReplyChannelRange_clone(&msg_conv);
10115 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10116 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10117 return (uint32_t)ret_conv;
10120 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) {
10121 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10122 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10123 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10124 LDKPublicKey their_node_id_ref;
10125 CHECK(their_node_id->arr_len == 33);
10126 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10127 LDKReplyShortChannelIdsEnd msg_conv;
10128 msg_conv.inner = (void*)(msg & (~1));
10129 msg_conv.is_owned = (msg & 1) || (msg == 0);
10130 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10131 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10132 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10133 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10134 return (uint32_t)ret_conv;
10137 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) {
10138 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10139 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10140 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10141 LDKPublicKey their_node_id_ref;
10142 CHECK(their_node_id->arr_len == 33);
10143 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10144 LDKQueryChannelRange msg_conv;
10145 msg_conv.inner = (void*)(msg & (~1));
10146 msg_conv.is_owned = (msg & 1) || (msg == 0);
10147 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10148 msg_conv = QueryChannelRange_clone(&msg_conv);
10149 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10150 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10151 return (uint32_t)ret_conv;
10154 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) {
10155 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10156 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10157 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10158 LDKPublicKey their_node_id_ref;
10159 CHECK(their_node_id->arr_len == 33);
10160 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10161 LDKQueryShortChannelIds msg_conv;
10162 msg_conv.inner = (void*)(msg & (~1));
10163 msg_conv.is_owned = (msg & 1) || (msg == 0);
10164 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10165 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10166 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10167 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10168 return (uint32_t)ret_conv;
10171 typedef struct LDKCustomMessageReader_JCalls {
10172 atomic_size_t refcnt;
10173 uint32_t instance_ptr;
10174 } LDKCustomMessageReader_JCalls;
10175 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10176 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10177 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10181 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10182 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10183 int16_t message_type_conv = message_type;
10184 LDKu8slice buffer_var = buffer;
10185 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10186 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10187 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 83, (uint32_t)message_type_conv, (uint32_t)buffer_arr);
10188 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10189 CHECK_ACCESS(ret_ptr);
10190 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10194 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10195 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10196 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10198 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10199 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10200 atomic_init(&calls->refcnt, 1);
10201 calls->instance_ptr = o;
10203 LDKCustomMessageReader ret = {
10204 .this_arg = (void*) calls,
10205 .read = read_LDKCustomMessageReader_jcall,
10206 .free = LDKCustomMessageReader_JCalls_free,
10210 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10211 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10212 *res_ptr = LDKCustomMessageReader_init(o);
10213 return (long)res_ptr;
10215 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
10216 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10217 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10218 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10219 LDKu8slice buffer_ref;
10220 buffer_ref.datalen = buffer->arr_len;
10221 buffer_ref.data = buffer->elems;
10222 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10223 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10225 return (uint32_t)ret_conv;
10228 typedef struct LDKCustomMessageHandler_JCalls {
10229 atomic_size_t refcnt;
10230 uint32_t instance_ptr;
10231 LDKCustomMessageReader_JCalls* CustomMessageReader;
10232 } LDKCustomMessageHandler_JCalls;
10233 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10234 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10235 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10239 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10240 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10241 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10243 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10244 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10245 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 84, (uint32_t)(uint32_t)msg_ret, (uint32_t)sender_node_id_arr);
10246 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10247 CHECK_ACCESS(ret_ptr);
10248 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10252 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10253 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10254 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 85);
10255 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10256 ret_constr.datalen = ret->arr_len;
10257 if (ret_constr.datalen > 0)
10258 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10260 ret_constr.data = NULL;
10261 uint32_t* ret_vals = ret->elems;
10262 for (size_t z = 0; z < ret_constr.datalen; z++) {
10263 uint32_t ret_conv_25 = ret_vals[z];
10264 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
10265 CHECK_ACCESS(ret_conv_25_ptr);
10266 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10267 FREE((void*)ret_conv_25);
10268 ret_constr.data[z] = ret_conv_25_conv;
10273 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10274 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10275 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10276 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10278 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10279 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10280 atomic_init(&calls->refcnt, 1);
10281 calls->instance_ptr = o;
10283 LDKCustomMessageHandler ret = {
10284 .this_arg = (void*) calls,
10285 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10286 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10287 .free = LDKCustomMessageHandler_JCalls_free,
10288 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10290 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10293 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10294 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10295 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10296 return (long)res_ptr;
10298 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) {
10299 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10300 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10301 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10302 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
10303 CHECK_ACCESS(msg_ptr);
10304 LDKType msg_conv = *(LDKType*)(msg_ptr);
10305 if (msg_conv.free == LDKType_JCalls_free) {
10306 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10307 LDKType_JCalls_cloned(&msg_conv);
10309 LDKPublicKey sender_node_id_ref;
10310 CHECK(sender_node_id->arr_len == 33);
10311 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10312 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10313 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10314 return (uint32_t)ret_conv;
10317 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
10318 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10319 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10320 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10321 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10322 uint32_tArray ret_arr = NULL;
10323 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10324 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10325 for (size_t z = 0; z < ret_var.datalen; z++) {
10326 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10327 *ret_conv_25_conv = ret_var.data[z];
10328 ret_arr_ptr[z] = ((uint32_t)ret_conv_25_conv);
10331 FREE(ret_var.data);
10335 typedef struct LDKSocketDescriptor_JCalls {
10336 atomic_size_t refcnt;
10337 uint32_t instance_ptr;
10338 } LDKSocketDescriptor_JCalls;
10339 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10340 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10341 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10345 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10346 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10347 LDKu8slice data_var = data;
10348 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10349 memcpy(data_arr->elems, data_var.data, data_var.datalen);
10350 jboolean resume_read_conv = resume_read;
10351 return js_invoke_function_u_uu(j_calls->instance_ptr, 86, (uint32_t)data_arr, (uint32_t)resume_read_conv);
10353 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10354 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10355 js_invoke_function_u_(j_calls->instance_ptr, 87);
10357 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10358 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10359 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10360 *other_arg_clone = SocketDescriptor_clone(other_arg);
10361 return js_invoke_function_u_u(j_calls->instance_ptr, 88, (uint32_t)(uint32_t)other_arg_clone);
10363 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10364 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10365 return js_invoke_function_b_(j_calls->instance_ptr, 89);
10367 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10368 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10369 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10371 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10372 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10373 atomic_init(&calls->refcnt, 1);
10374 calls->instance_ptr = o;
10376 LDKSocketDescriptor ret = {
10377 .this_arg = (void*) calls,
10378 .send_data = send_data_LDKSocketDescriptor_jcall,
10379 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10380 .eq = eq_LDKSocketDescriptor_jcall,
10381 .hash = hash_LDKSocketDescriptor_jcall,
10382 .cloned = LDKSocketDescriptor_JCalls_cloned,
10383 .free = LDKSocketDescriptor_JCalls_free,
10387 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10388 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10389 *res_ptr = LDKSocketDescriptor_init(o);
10390 return (long)res_ptr;
10392 uint32_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
10393 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10394 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10395 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10396 LDKu8slice data_ref;
10397 data_ref.datalen = data->arr_len;
10398 data_ref.data = data->elems;
10399 uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10404 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
10405 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10406 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10407 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10408 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10411 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
10412 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10413 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10414 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10415 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10419 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
10420 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10422 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10423 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10424 case LDKEffectiveCapacity_Total: return 2;
10425 case LDKEffectiveCapacity_Infinite: return 3;
10426 case LDKEffectiveCapacity_Unknown: return 4;
10430 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
10431 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10432 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10433 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10434 return liquidity_msat_conv;
10436 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
10437 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10438 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10439 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10440 return amount_msat_conv;
10442 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
10443 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
10444 assert(obj->tag == LDKEffectiveCapacity_Total);
10445 int64_t capacity_msat_conv = obj->total.capacity_msat;
10446 return capacity_msat_conv;
10448 typedef struct LDKLockableScore_JCalls {
10449 atomic_size_t refcnt;
10450 uint32_t instance_ptr;
10451 } LDKLockableScore_JCalls;
10452 static void LDKLockableScore_JCalls_free(void* this_arg) {
10453 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10454 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10458 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10459 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10460 uint32_t ret = js_invoke_function_u_(j_calls->instance_ptr, 90);
10461 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10462 CHECK_ACCESS(ret_ptr);
10463 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10464 if (ret_conv.free == LDKScore_JCalls_free) {
10465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10466 LDKScore_JCalls_cloned(&ret_conv);
10467 }// WARNING: we may need a move here but no clone is available for LDKScore
10471 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10472 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10473 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10475 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10476 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10477 atomic_init(&calls->refcnt, 1);
10478 calls->instance_ptr = o;
10480 LDKLockableScore ret = {
10481 .this_arg = (void*) calls,
10482 .lock = lock_LDKLockableScore_jcall,
10483 .free = LDKLockableScore_JCalls_free,
10487 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10488 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10489 *res_ptr = LDKLockableScore_init(o);
10490 return (long)res_ptr;
10492 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
10493 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10494 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10495 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10496 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10497 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10498 return (uint32_t)ret_ret;
10501 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
10502 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10504 case LDKFallback_SegWitProgram: return 0;
10505 case LDKFallback_PubKeyHash: return 1;
10506 case LDKFallback_ScriptHash: return 2;
10510 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
10511 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10512 assert(obj->tag == LDKFallback_SegWitProgram);
10513 uint8_t version_val = obj->seg_wit_program.version._0;
10514 return version_val;
10516 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
10517 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10518 assert(obj->tag == LDKFallback_SegWitProgram);
10519 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10520 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10521 memcpy(program_arr->elems, program_var.data, program_var.datalen);
10522 return program_arr;
10524 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
10525 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10526 assert(obj->tag == LDKFallback_PubKeyHash);
10527 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10528 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10529 return pub_key_hash_arr;
10531 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
10532 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10533 assert(obj->tag == LDKFallback_ScriptHash);
10534 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10535 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10536 return script_hash_arr;
10538 typedef struct LDKPayer_JCalls {
10539 atomic_size_t refcnt;
10540 uint32_t instance_ptr;
10542 static void LDKPayer_JCalls_free(void* this_arg) {
10543 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10544 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10548 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10549 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10550 int8_tArray ret = (int8_tArray)js_invoke_function_u_(j_calls->instance_ptr, 91);
10551 LDKPublicKey ret_ref;
10552 CHECK(ret->arr_len == 33);
10553 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10556 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10557 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10558 uint32_tArray ret = (uint32_tArray)js_invoke_function_u_(j_calls->instance_ptr, 92);
10559 LDKCVec_ChannelDetailsZ ret_constr;
10560 ret_constr.datalen = ret->arr_len;
10561 if (ret_constr.datalen > 0)
10562 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10564 ret_constr.data = NULL;
10565 uint32_t* ret_vals = ret->elems;
10566 for (size_t q = 0; q < ret_constr.datalen; q++) {
10567 uint32_t ret_conv_16 = ret_vals[q];
10568 LDKChannelDetails ret_conv_16_conv;
10569 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10570 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10572 ret_constr.data[q] = ret_conv_16_conv;
10577 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10578 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10579 LDKRoute route_var = *route;
10580 uint32_t route_ref = 0;
10581 route_var = Route_clone(&route_var);
10582 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10583 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10584 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10585 route_ref = (uintptr_t)route_var.inner;
10586 if (route_var.is_owned) {
10589 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10590 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10591 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10592 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10593 uint32_t ret = js_invoke_function_u_uuu(j_calls->instance_ptr, 93, (uint32_t)route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr);
10594 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10595 CHECK_ACCESS(ret_ptr);
10596 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10600 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10601 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10602 LDKRoute route_var = *route;
10603 uint32_t route_ref = 0;
10604 route_var = Route_clone(&route_var);
10605 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10606 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10607 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10608 route_ref = (uintptr_t)route_var.inner;
10609 if (route_var.is_owned) {
10612 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10613 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10614 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 94, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10615 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10616 CHECK_ACCESS(ret_ptr);
10617 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10621 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10622 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10623 LDKRoute route_var = *route;
10624 uint32_t route_ref = 0;
10625 route_var = Route_clone(&route_var);
10626 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10627 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10628 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10629 route_ref = (uintptr_t)route_var.inner;
10630 if (route_var.is_owned) {
10633 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10634 memcpy(payment_id_arr->elems, payment_id.data, 32);
10635 uint32_t ret = js_invoke_function_u_uu(j_calls->instance_ptr, 95, (uint32_t)route_ref, (uint32_t)payment_id_arr);
10636 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10637 CHECK_ACCESS(ret_ptr);
10638 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10642 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10643 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10644 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10645 memcpy(payment_id_arr->elems, payment_id.data, 32);
10646 js_invoke_function_u_u(j_calls->instance_ptr, 96, (uint32_t)payment_id_arr);
10648 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10649 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10650 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10652 static inline LDKPayer LDKPayer_init (JSValue o) {
10653 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10654 atomic_init(&calls->refcnt, 1);
10655 calls->instance_ptr = o;
10658 .this_arg = (void*) calls,
10659 .node_id = node_id_LDKPayer_jcall,
10660 .first_hops = first_hops_LDKPayer_jcall,
10661 .send_payment = send_payment_LDKPayer_jcall,
10662 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10663 .retry_payment = retry_payment_LDKPayer_jcall,
10664 .abandon_payment = abandon_payment_LDKPayer_jcall,
10665 .free = LDKPayer_JCalls_free,
10669 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10670 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10671 *res_ptr = LDKPayer_init(o);
10672 return (long)res_ptr;
10674 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
10675 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10676 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10677 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10678 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10679 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10683 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
10684 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10685 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10686 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10687 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10688 uint32_tArray ret_arr = NULL;
10689 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10690 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10691 for (size_t q = 0; q < ret_var.datalen; q++) {
10692 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10693 uint32_t ret_conv_16_ref = 0;
10694 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10695 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10697 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
10698 if (ret_conv_16_var.is_owned) {
10699 ret_conv_16_ref |= 1;
10701 ret_arr_ptr[q] = ret_conv_16_ref;
10704 FREE(ret_var.data);
10708 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) {
10709 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10710 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10711 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10712 LDKRoute route_conv;
10713 route_conv.inner = (void*)(route & (~1));
10714 route_conv.is_owned = false;
10715 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10716 LDKThirtyTwoBytes payment_hash_ref;
10717 CHECK(payment_hash->arr_len == 32);
10718 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10719 LDKThirtyTwoBytes payment_secret_ref;
10720 CHECK(payment_secret->arr_len == 32);
10721 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10722 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10723 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10724 return (uint32_t)ret_conv;
10727 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) {
10728 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10729 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10730 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10731 LDKRoute route_conv;
10732 route_conv.inner = (void*)(route & (~1));
10733 route_conv.is_owned = false;
10734 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10735 LDKThirtyTwoBytes payment_preimage_ref;
10736 CHECK(payment_preimage->arr_len == 32);
10737 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10738 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10739 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10740 return (uint32_t)ret_conv;
10743 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
10744 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10745 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10746 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10747 LDKRoute route_conv;
10748 route_conv.inner = (void*)(route & (~1));
10749 route_conv.is_owned = false;
10750 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10751 LDKThirtyTwoBytes payment_id_ref;
10752 CHECK(payment_id->arr_len == 32);
10753 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10754 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10755 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10756 return (uint32_t)ret_conv;
10759 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
10760 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10761 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10762 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10763 LDKThirtyTwoBytes payment_id_ref;
10764 CHECK(payment_id->arr_len == 32);
10765 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10766 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10769 typedef struct LDKRouter_JCalls {
10770 atomic_size_t refcnt;
10771 uint32_t instance_ptr;
10772 } LDKRouter_JCalls;
10773 static void LDKRouter_JCalls_free(void* this_arg) {
10774 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10775 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10779 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) {
10780 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10781 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10782 memcpy(payer_arr->elems, payer.compressed_form, 33);
10783 LDKRouteParameters route_params_var = *route_params;
10784 uint32_t route_params_ref = 0;
10785 route_params_var = RouteParameters_clone(&route_params_var);
10786 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10787 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10788 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10789 route_params_ref = (uintptr_t)route_params_var.inner;
10790 if (route_params_var.is_owned) {
10791 route_params_ref |= 1;
10793 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10794 memcpy(payment_hash_arr->elems, *payment_hash, 32);
10795 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10796 uint32_tArray first_hops_arr = NULL;
10797 if (first_hops != NULL) {
10798 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10799 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
10800 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
10801 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10802 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10803 uint32_t first_hops_conv_16_ref = 0;
10804 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10805 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10806 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10807 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
10808 if (first_hops_conv_16_var.is_owned) {
10809 first_hops_conv_16_ref |= 1;
10811 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10815 // WARNING: This object doesn't live past this scope, needs clone!
10816 uint32_t ret_scorer = ((uintptr_t)scorer) | 1;
10817 uint32_t ret = js_invoke_function_u_uuuuu(j_calls->instance_ptr, 97, (uint32_t)payer_arr, (uint32_t)route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, (uint32_t)ret_scorer);
10818 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10819 CHECK_ACCESS(ret_ptr);
10820 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10824 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10825 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10826 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10828 static inline LDKRouter LDKRouter_init (JSValue o) {
10829 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10830 atomic_init(&calls->refcnt, 1);
10831 calls->instance_ptr = o;
10834 .this_arg = (void*) calls,
10835 .find_route = find_route_LDKRouter_jcall,
10836 .free = LDKRouter_JCalls_free,
10840 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10841 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10842 *res_ptr = LDKRouter_init(o);
10843 return (long)res_ptr;
10845 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) {
10846 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10847 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10848 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10849 LDKPublicKey payer_ref;
10850 CHECK(payer->arr_len == 33);
10851 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10852 LDKRouteParameters route_params_conv;
10853 route_params_conv.inner = (void*)(route_params & (~1));
10854 route_params_conv.is_owned = false;
10855 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10856 unsigned char payment_hash_arr[32];
10857 CHECK(payment_hash->arr_len == 32);
10858 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10859 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10860 LDKCVec_ChannelDetailsZ first_hops_constr;
10861 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10862 if (first_hops != 0) {
10863 first_hops_constr.datalen = first_hops->arr_len;
10864 if (first_hops_constr.datalen > 0)
10865 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10867 first_hops_constr.data = NULL;
10868 uint32_t* first_hops_vals = first_hops->elems;
10869 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10870 uint32_t first_hops_conv_16 = first_hops_vals[q];
10871 LDKChannelDetails first_hops_conv_16_conv;
10872 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
10873 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
10874 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10875 first_hops_constr.data[q] = first_hops_conv_16_conv;
10878 first_hops_ptr = &first_hops_constr;
10880 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
10881 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
10882 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10883 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10884 *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);
10885 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10886 return (uint32_t)ret_conv;
10889 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint32_t ptr) {
10890 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10892 case LDKRetry_Attempts: return 0;
10896 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint32_t ptr) {
10897 LDKRetry *obj = (LDKRetry*)(ptr & ~1);
10898 assert(obj->tag == LDKRetry_Attempts);
10899 uint32_t attempts_conv = obj->attempts;
10900 return attempts_conv;
10902 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10903 LDKStr ret_str = _ldk_get_compiled_version();
10904 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10909 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10910 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10911 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10916 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
10917 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10918 *ret_copy = Bech32Error_clone(arg);
10919 uint32_t ret_ref = (uintptr_t)ret_copy;
10922 uint32_t __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint32_t arg) {
10923 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
10924 uint32_t ret_conv = Bech32Error_clone_ptr(arg_conv);
10928 uint32_t __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint32_t orig) {
10929 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
10930 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10931 *ret_copy = Bech32Error_clone(orig_conv);
10932 uint32_t ret_ref = (uintptr_t)ret_copy;
10936 void __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint32_t o) {
10937 if ((o & 1) != 0) return;
10938 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
10939 CHECK_ACCESS(o_ptr);
10940 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
10942 Bech32Error_free(o_conv);
10945 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10946 LDKTransaction _res_ref;
10947 _res_ref.datalen = _res->arr_len;
10948 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10949 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10950 _res_ref.data_is_owned = true;
10951 Transaction_free(_res_ref);
10954 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10955 LDKCVec_u8Z script_pubkey_ref;
10956 script_pubkey_ref.datalen = script_pubkey->arr_len;
10957 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10958 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10959 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10960 *ret_ref = TxOut_new(script_pubkey_ref, value);
10961 return (uint32_t)ret_ref;
10964 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
10965 if ((_res & 1) != 0) return;
10966 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10967 CHECK_ACCESS(_res_ptr);
10968 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10970 TxOut_free(_res_conv);
10973 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10974 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10975 *ret_ref = TxOut_clone(arg);
10976 return (uint32_t)ret_ref;
10978 uint32_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
10979 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
10980 uint32_t ret_conv = TxOut_clone_ptr(arg_conv);
10984 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
10985 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10986 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10987 *ret_ref = TxOut_clone(orig_conv);
10988 return (uint32_t)ret_ref;
10991 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10992 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10996 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10997 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10998 *ret_conv = CResult_NoneNoneZ_ok();
10999 return (uint32_t)ret_conv;
11002 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11003 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11004 *ret_conv = CResult_NoneNoneZ_err();
11005 return (uint32_t)ret_conv;
11008 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
11009 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
11010 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11014 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
11015 if ((_res & 1) != 0) return;
11016 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11017 CHECK_ACCESS(_res_ptr);
11018 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11020 CResult_NoneNoneZ_free(_res_conv);
11023 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11024 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11025 *ret_conv = CResult_NoneNoneZ_clone(arg);
11026 return (uint32_t)ret_conv;
11028 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
11029 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
11030 uint32_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11034 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
11035 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11036 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11037 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11038 return (uint32_t)ret_conv;
11041 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
11042 LDKCounterpartyCommitmentSecrets o_conv;
11043 o_conv.inner = (void*)(o & (~1));
11044 o_conv.is_owned = (o & 1) || (o == 0);
11045 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11046 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11047 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11048 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11049 return (uint32_t)ret_conv;
11052 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
11053 LDKDecodeError e_conv;
11054 e_conv.inner = (void*)(e & (~1));
11055 e_conv.is_owned = (e & 1) || (e == 0);
11056 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11057 e_conv = DecodeError_clone(&e_conv);
11058 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11059 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11060 return (uint32_t)ret_conv;
11063 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
11064 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
11065 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11069 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
11070 if ((_res & 1) != 0) return;
11071 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11072 CHECK_ACCESS(_res_ptr);
11073 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11075 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11078 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11079 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11080 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11081 return (uint32_t)ret_conv;
11083 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
11084 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
11085 uint32_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11089 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
11090 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
11091 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11092 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11093 return (uint32_t)ret_conv;
11096 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11097 LDKSecretKey o_ref;
11098 CHECK(o->arr_len == 32);
11099 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11100 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11101 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11102 return (uint32_t)ret_conv;
11105 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11106 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11107 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11108 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11109 return (uint32_t)ret_conv;
11112 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
11113 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
11114 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11118 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
11119 if ((_res & 1) != 0) return;
11120 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11121 CHECK_ACCESS(_res_ptr);
11122 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11124 CResult_SecretKeyErrorZ_free(_res_conv);
11127 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11128 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11129 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11130 return (uint32_t)ret_conv;
11132 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
11133 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
11134 uint32_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11138 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
11139 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
11140 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11141 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11142 return (uint32_t)ret_conv;
11145 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11146 LDKPublicKey o_ref;
11147 CHECK(o->arr_len == 33);
11148 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11149 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11150 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11151 return (uint32_t)ret_conv;
11154 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11155 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11156 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11157 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11158 return (uint32_t)ret_conv;
11161 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
11162 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
11163 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11167 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
11168 if ((_res & 1) != 0) return;
11169 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11170 CHECK_ACCESS(_res_ptr);
11171 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11173 CResult_PublicKeyErrorZ_free(_res_conv);
11176 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11177 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11178 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11179 return (uint32_t)ret_conv;
11181 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
11182 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
11183 uint32_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11187 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
11188 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11189 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11190 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11191 return (uint32_t)ret_conv;
11194 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
11195 LDKTxCreationKeys o_conv;
11196 o_conv.inner = (void*)(o & (~1));
11197 o_conv.is_owned = (o & 1) || (o == 0);
11198 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11199 o_conv = TxCreationKeys_clone(&o_conv);
11200 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11201 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11202 return (uint32_t)ret_conv;
11205 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
11206 LDKDecodeError e_conv;
11207 e_conv.inner = (void*)(e & (~1));
11208 e_conv.is_owned = (e & 1) || (e == 0);
11209 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11210 e_conv = DecodeError_clone(&e_conv);
11211 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11212 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11213 return (uint32_t)ret_conv;
11216 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
11217 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
11218 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11222 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
11223 if ((_res & 1) != 0) return;
11224 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11225 CHECK_ACCESS(_res_ptr);
11226 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11228 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11231 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11232 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11233 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11234 return (uint32_t)ret_conv;
11236 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11237 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
11238 uint32_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11242 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
11243 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11244 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11245 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11246 return (uint32_t)ret_conv;
11249 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
11250 LDKChannelPublicKeys o_conv;
11251 o_conv.inner = (void*)(o & (~1));
11252 o_conv.is_owned = (o & 1) || (o == 0);
11253 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11254 o_conv = ChannelPublicKeys_clone(&o_conv);
11255 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11256 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11257 return (uint32_t)ret_conv;
11260 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
11261 LDKDecodeError e_conv;
11262 e_conv.inner = (void*)(e & (~1));
11263 e_conv.is_owned = (e & 1) || (e == 0);
11264 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11265 e_conv = DecodeError_clone(&e_conv);
11266 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11267 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11268 return (uint32_t)ret_conv;
11271 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
11272 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
11273 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11277 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
11278 if ((_res & 1) != 0) return;
11279 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11280 CHECK_ACCESS(_res_ptr);
11281 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11283 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11286 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11287 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11288 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11289 return (uint32_t)ret_conv;
11291 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
11292 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
11293 uint32_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11297 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
11298 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11299 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11300 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11301 return (uint32_t)ret_conv;
11304 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
11305 LDKTxCreationKeys o_conv;
11306 o_conv.inner = (void*)(o & (~1));
11307 o_conv.is_owned = (o & 1) || (o == 0);
11308 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11309 o_conv = TxCreationKeys_clone(&o_conv);
11310 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11311 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11312 return (uint32_t)ret_conv;
11315 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11316 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11317 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11318 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11319 return (uint32_t)ret_conv;
11322 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
11323 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
11324 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11328 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
11329 if ((_res & 1) != 0) return;
11330 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11331 CHECK_ACCESS(_res_ptr);
11332 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11334 CResult_TxCreationKeysErrorZ_free(_res_conv);
11337 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11338 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11339 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11340 return (uint32_t)ret_conv;
11342 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
11343 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
11344 uint32_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11348 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
11349 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11350 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11351 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11352 return (uint32_t)ret_conv;
11355 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11356 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11357 *ret_copy = COption_u32Z_some(o);
11358 uint32_t ret_ref = (uintptr_t)ret_copy;
11362 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11363 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11364 *ret_copy = COption_u32Z_none();
11365 uint32_t ret_ref = (uintptr_t)ret_copy;
11369 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
11370 if ((_res & 1) != 0) return;
11371 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11372 CHECK_ACCESS(_res_ptr);
11373 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11375 COption_u32Z_free(_res_conv);
11378 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11379 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11380 *ret_copy = COption_u32Z_clone(arg);
11381 uint32_t ret_ref = (uintptr_t)ret_copy;
11384 uint32_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
11385 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
11386 uint32_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11390 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
11391 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11392 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11393 *ret_copy = COption_u32Z_clone(orig_conv);
11394 uint32_t ret_ref = (uintptr_t)ret_copy;
11398 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
11399 LDKHTLCOutputInCommitment o_conv;
11400 o_conv.inner = (void*)(o & (~1));
11401 o_conv.is_owned = (o & 1) || (o == 0);
11402 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11403 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11404 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11405 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11406 return (uint32_t)ret_conv;
11409 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
11410 LDKDecodeError e_conv;
11411 e_conv.inner = (void*)(e & (~1));
11412 e_conv.is_owned = (e & 1) || (e == 0);
11413 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11414 e_conv = DecodeError_clone(&e_conv);
11415 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11416 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11417 return (uint32_t)ret_conv;
11420 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
11421 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
11422 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11426 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
11427 if ((_res & 1) != 0) return;
11428 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11429 CHECK_ACCESS(_res_ptr);
11430 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11432 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11435 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11436 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11437 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11438 return (uint32_t)ret_conv;
11440 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
11441 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
11442 uint32_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11446 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
11447 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11448 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11449 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11450 return (uint32_t)ret_conv;
11453 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11454 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11458 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11459 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11463 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11464 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11465 COption_NoneZ_free(_res_conv);
11468 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11469 LDKCounterpartyChannelTransactionParameters o_conv;
11470 o_conv.inner = (void*)(o & (~1));
11471 o_conv.is_owned = (o & 1) || (o == 0);
11472 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11473 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11474 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11475 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11476 return (uint32_t)ret_conv;
11479 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11480 LDKDecodeError e_conv;
11481 e_conv.inner = (void*)(e & (~1));
11482 e_conv.is_owned = (e & 1) || (e == 0);
11483 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11484 e_conv = DecodeError_clone(&e_conv);
11485 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11486 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11487 return (uint32_t)ret_conv;
11490 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11491 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11492 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11496 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11497 if ((_res & 1) != 0) return;
11498 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11499 CHECK_ACCESS(_res_ptr);
11500 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11502 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11505 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11506 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11507 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11508 return (uint32_t)ret_conv;
11510 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11511 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11512 uint32_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11516 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11517 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11518 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11519 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11520 return (uint32_t)ret_conv;
11523 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11524 LDKChannelTransactionParameters o_conv;
11525 o_conv.inner = (void*)(o & (~1));
11526 o_conv.is_owned = (o & 1) || (o == 0);
11527 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11528 o_conv = ChannelTransactionParameters_clone(&o_conv);
11529 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11530 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11531 return (uint32_t)ret_conv;
11534 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11535 LDKDecodeError e_conv;
11536 e_conv.inner = (void*)(e & (~1));
11537 e_conv.is_owned = (e & 1) || (e == 0);
11538 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11539 e_conv = DecodeError_clone(&e_conv);
11540 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11541 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11542 return (uint32_t)ret_conv;
11545 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11546 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11547 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11551 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11552 if ((_res & 1) != 0) return;
11553 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11554 CHECK_ACCESS(_res_ptr);
11555 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11557 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11560 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11561 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11562 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11563 return (uint32_t)ret_conv;
11565 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11566 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11567 uint32_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11571 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11572 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11573 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11574 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11575 return (uint32_t)ret_conv;
11578 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11579 LDKCVec_SignatureZ _res_constr;
11580 _res_constr.datalen = _res->arr_len;
11581 if (_res_constr.datalen > 0)
11582 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11584 _res_constr.data = NULL;
11585 int8_tArray* _res_vals = (void*) _res->elems;
11586 for (size_t m = 0; m < _res_constr.datalen; m++) {
11587 int8_tArray _res_conv_12 = _res_vals[m];
11588 LDKSignature _res_conv_12_ref;
11589 CHECK(_res_conv_12->arr_len == 64);
11590 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11591 _res_constr.data[m] = _res_conv_12_ref;
11594 CVec_SignatureZ_free(_res_constr);
11597 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11598 LDKHolderCommitmentTransaction o_conv;
11599 o_conv.inner = (void*)(o & (~1));
11600 o_conv.is_owned = (o & 1) || (o == 0);
11601 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11602 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11603 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11604 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11605 return (uint32_t)ret_conv;
11608 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11609 LDKDecodeError e_conv;
11610 e_conv.inner = (void*)(e & (~1));
11611 e_conv.is_owned = (e & 1) || (e == 0);
11612 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11613 e_conv = DecodeError_clone(&e_conv);
11614 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11615 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11616 return (uint32_t)ret_conv;
11619 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11620 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
11621 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11625 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11626 if ((_res & 1) != 0) return;
11627 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11628 CHECK_ACCESS(_res_ptr);
11629 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11631 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11634 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11635 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11636 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11637 return (uint32_t)ret_conv;
11639 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11640 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11641 uint32_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11645 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11646 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11647 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11648 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11649 return (uint32_t)ret_conv;
11652 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11653 LDKBuiltCommitmentTransaction o_conv;
11654 o_conv.inner = (void*)(o & (~1));
11655 o_conv.is_owned = (o & 1) || (o == 0);
11656 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11657 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11658 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11659 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11660 return (uint32_t)ret_conv;
11663 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11664 LDKDecodeError e_conv;
11665 e_conv.inner = (void*)(e & (~1));
11666 e_conv.is_owned = (e & 1) || (e == 0);
11667 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11668 e_conv = DecodeError_clone(&e_conv);
11669 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11670 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11671 return (uint32_t)ret_conv;
11674 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11675 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
11676 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11680 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11681 if ((_res & 1) != 0) return;
11682 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11683 CHECK_ACCESS(_res_ptr);
11684 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11686 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11689 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11690 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11691 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
11692 return (uint32_t)ret_conv;
11694 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11695 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11696 uint32_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11700 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11701 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11702 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11703 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11704 return (uint32_t)ret_conv;
11707 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
11708 LDKTrustedClosingTransaction o_conv;
11709 o_conv.inner = (void*)(o & (~1));
11710 o_conv.is_owned = (o & 1) || (o == 0);
11711 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11712 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11713 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11714 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11715 return (uint32_t)ret_conv;
11718 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11719 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11720 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11721 return (uint32_t)ret_conv;
11724 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
11725 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
11726 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11730 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
11731 if ((_res & 1) != 0) return;
11732 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11733 CHECK_ACCESS(_res_ptr);
11734 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11736 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11739 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11740 LDKCommitmentTransaction o_conv;
11741 o_conv.inner = (void*)(o & (~1));
11742 o_conv.is_owned = (o & 1) || (o == 0);
11743 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11744 o_conv = CommitmentTransaction_clone(&o_conv);
11745 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11746 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11747 return (uint32_t)ret_conv;
11750 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11751 LDKDecodeError e_conv;
11752 e_conv.inner = (void*)(e & (~1));
11753 e_conv.is_owned = (e & 1) || (e == 0);
11754 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11755 e_conv = DecodeError_clone(&e_conv);
11756 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11757 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11758 return (uint32_t)ret_conv;
11761 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11762 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
11763 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11767 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11768 if ((_res & 1) != 0) return;
11769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11770 CHECK_ACCESS(_res_ptr);
11771 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11773 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11776 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11777 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11778 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11779 return (uint32_t)ret_conv;
11781 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11782 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
11783 uint32_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11787 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11788 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11789 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11790 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11791 return (uint32_t)ret_conv;
11794 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
11795 LDKTrustedCommitmentTransaction o_conv;
11796 o_conv.inner = (void*)(o & (~1));
11797 o_conv.is_owned = (o & 1) || (o == 0);
11798 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11799 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11800 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11801 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11802 return (uint32_t)ret_conv;
11805 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11806 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11807 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11808 return (uint32_t)ret_conv;
11811 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
11812 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
11813 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11817 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
11818 if ((_res & 1) != 0) return;
11819 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11820 CHECK_ACCESS(_res_ptr);
11821 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11823 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11826 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11827 LDKCVec_SignatureZ o_constr;
11828 o_constr.datalen = o->arr_len;
11829 if (o_constr.datalen > 0)
11830 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11832 o_constr.data = NULL;
11833 int8_tArray* o_vals = (void*) o->elems;
11834 for (size_t m = 0; m < o_constr.datalen; m++) {
11835 int8_tArray o_conv_12 = o_vals[m];
11836 LDKSignature o_conv_12_ref;
11837 CHECK(o_conv_12->arr_len == 64);
11838 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11839 o_constr.data[m] = o_conv_12_ref;
11842 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11843 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11844 return (uint32_t)ret_conv;
11847 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11848 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11849 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11850 return (uint32_t)ret_conv;
11853 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
11854 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
11855 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11859 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
11860 if ((_res & 1) != 0) return;
11861 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11862 CHECK_ACCESS(_res_ptr);
11863 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11865 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11868 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11869 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11870 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11871 return (uint32_t)ret_conv;
11873 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
11874 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
11875 uint32_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11879 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
11880 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11881 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11882 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11883 return (uint32_t)ret_conv;
11886 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
11887 LDKShutdownScript o_conv;
11888 o_conv.inner = (void*)(o & (~1));
11889 o_conv.is_owned = (o & 1) || (o == 0);
11890 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11891 o_conv = ShutdownScript_clone(&o_conv);
11892 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11893 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11894 return (uint32_t)ret_conv;
11897 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
11898 LDKDecodeError e_conv;
11899 e_conv.inner = (void*)(e & (~1));
11900 e_conv.is_owned = (e & 1) || (e == 0);
11901 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11902 e_conv = DecodeError_clone(&e_conv);
11903 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11904 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11905 return (uint32_t)ret_conv;
11908 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
11909 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
11910 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11914 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
11915 if ((_res & 1) != 0) return;
11916 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11917 CHECK_ACCESS(_res_ptr);
11918 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11920 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11923 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11924 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11925 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11926 return (uint32_t)ret_conv;
11928 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
11929 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
11930 uint32_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11934 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
11935 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11936 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11937 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11938 return (uint32_t)ret_conv;
11941 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
11942 LDKShutdownScript o_conv;
11943 o_conv.inner = (void*)(o & (~1));
11944 o_conv.is_owned = (o & 1) || (o == 0);
11945 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11946 o_conv = ShutdownScript_clone(&o_conv);
11947 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11948 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11949 return (uint32_t)ret_conv;
11952 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
11953 LDKInvalidShutdownScript e_conv;
11954 e_conv.inner = (void*)(e & (~1));
11955 e_conv.is_owned = (e & 1) || (e == 0);
11956 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11957 e_conv = InvalidShutdownScript_clone(&e_conv);
11958 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11959 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11960 return (uint32_t)ret_conv;
11963 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
11964 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
11965 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11969 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
11970 if ((_res & 1) != 0) return;
11971 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11972 CHECK_ACCESS(_res_ptr);
11973 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11975 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11978 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11979 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11980 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11981 return (uint32_t)ret_conv;
11983 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
11984 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
11985 uint32_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11989 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
11990 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11991 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11992 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11993 return (uint32_t)ret_conv;
11996 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
11997 LDKRouteHop o_conv;
11998 o_conv.inner = (void*)(o & (~1));
11999 o_conv.is_owned = (o & 1) || (o == 0);
12000 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12001 o_conv = RouteHop_clone(&o_conv);
12002 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12003 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12004 return (uint32_t)ret_conv;
12007 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
12008 LDKDecodeError e_conv;
12009 e_conv.inner = (void*)(e & (~1));
12010 e_conv.is_owned = (e & 1) || (e == 0);
12011 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12012 e_conv = DecodeError_clone(&e_conv);
12013 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12014 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12015 return (uint32_t)ret_conv;
12018 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
12019 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
12020 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12024 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
12025 if ((_res & 1) != 0) return;
12026 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12027 CHECK_ACCESS(_res_ptr);
12028 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12030 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12033 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12034 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12035 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12036 return (uint32_t)ret_conv;
12038 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12039 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
12040 uint32_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12044 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
12045 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12046 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12047 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12048 return (uint32_t)ret_conv;
12051 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
12052 LDKCVec_RouteHopZ _res_constr;
12053 _res_constr.datalen = _res->arr_len;
12054 if (_res_constr.datalen > 0)
12055 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12057 _res_constr.data = NULL;
12058 uint32_t* _res_vals = _res->elems;
12059 for (size_t k = 0; k < _res_constr.datalen; k++) {
12060 uint32_t _res_conv_10 = _res_vals[k];
12061 LDKRouteHop _res_conv_10_conv;
12062 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12063 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12064 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12065 _res_constr.data[k] = _res_conv_10_conv;
12068 CVec_RouteHopZ_free(_res_constr);
12071 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12072 LDKCVec_CVec_RouteHopZZ _res_constr;
12073 _res_constr.datalen = _res->arr_len;
12074 if (_res_constr.datalen > 0)
12075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12077 _res_constr.data = NULL;
12078 uint32_tArray* _res_vals = (void*) _res->elems;
12079 for (size_t m = 0; m < _res_constr.datalen; m++) {
12080 uint32_tArray _res_conv_12 = _res_vals[m];
12081 LDKCVec_RouteHopZ _res_conv_12_constr;
12082 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12083 if (_res_conv_12_constr.datalen > 0)
12084 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12086 _res_conv_12_constr.data = NULL;
12087 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
12088 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12089 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12090 LDKRouteHop _res_conv_12_conv_10_conv;
12091 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12092 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12093 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12094 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12096 FREE(_res_conv_12);
12097 _res_constr.data[m] = _res_conv_12_constr;
12100 CVec_CVec_RouteHopZZ_free(_res_constr);
12103 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
12105 o_conv.inner = (void*)(o & (~1));
12106 o_conv.is_owned = (o & 1) || (o == 0);
12107 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12108 o_conv = Route_clone(&o_conv);
12109 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12110 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12111 return (uint32_t)ret_conv;
12114 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
12115 LDKDecodeError e_conv;
12116 e_conv.inner = (void*)(e & (~1));
12117 e_conv.is_owned = (e & 1) || (e == 0);
12118 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12119 e_conv = DecodeError_clone(&e_conv);
12120 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12121 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12122 return (uint32_t)ret_conv;
12125 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
12126 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
12127 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12131 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
12132 if ((_res & 1) != 0) return;
12133 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12134 CHECK_ACCESS(_res_ptr);
12135 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12137 CResult_RouteDecodeErrorZ_free(_res_conv);
12140 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12141 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12142 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12143 return (uint32_t)ret_conv;
12145 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
12146 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
12147 uint32_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12151 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
12152 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12153 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12154 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12155 return (uint32_t)ret_conv;
12158 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
12159 LDKRouteParameters o_conv;
12160 o_conv.inner = (void*)(o & (~1));
12161 o_conv.is_owned = (o & 1) || (o == 0);
12162 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12163 o_conv = RouteParameters_clone(&o_conv);
12164 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12165 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12166 return (uint32_t)ret_conv;
12169 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
12170 LDKDecodeError e_conv;
12171 e_conv.inner = (void*)(e & (~1));
12172 e_conv.is_owned = (e & 1) || (e == 0);
12173 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12174 e_conv = DecodeError_clone(&e_conv);
12175 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12176 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12177 return (uint32_t)ret_conv;
12180 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
12181 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
12182 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12186 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
12187 if ((_res & 1) != 0) return;
12188 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12189 CHECK_ACCESS(_res_ptr);
12190 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12192 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12195 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12196 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12197 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12198 return (uint32_t)ret_conv;
12200 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12201 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
12202 uint32_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12206 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
12207 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12208 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12209 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12210 return (uint32_t)ret_conv;
12213 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
12214 LDKCVec_RouteHintZ _res_constr;
12215 _res_constr.datalen = _res->arr_len;
12216 if (_res_constr.datalen > 0)
12217 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12219 _res_constr.data = NULL;
12220 uint32_t* _res_vals = _res->elems;
12221 for (size_t l = 0; l < _res_constr.datalen; l++) {
12222 uint32_t _res_conv_11 = _res_vals[l];
12223 LDKRouteHint _res_conv_11_conv;
12224 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12225 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12226 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12227 _res_constr.data[l] = _res_conv_11_conv;
12230 CVec_RouteHintZ_free(_res_constr);
12233 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12234 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12235 *ret_copy = COption_u64Z_some(o);
12236 uint32_t ret_ref = (uintptr_t)ret_copy;
12240 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12241 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12242 *ret_copy = COption_u64Z_none();
12243 uint32_t ret_ref = (uintptr_t)ret_copy;
12247 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
12248 if ((_res & 1) != 0) return;
12249 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12250 CHECK_ACCESS(_res_ptr);
12251 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12253 COption_u64Z_free(_res_conv);
12256 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12257 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12258 *ret_copy = COption_u64Z_clone(arg);
12259 uint32_t ret_ref = (uintptr_t)ret_copy;
12262 uint32_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
12263 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
12264 uint32_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12268 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
12269 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12270 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12271 *ret_copy = COption_u64Z_clone(orig_conv);
12272 uint32_t ret_ref = (uintptr_t)ret_copy;
12276 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
12277 LDKPaymentParameters o_conv;
12278 o_conv.inner = (void*)(o & (~1));
12279 o_conv.is_owned = (o & 1) || (o == 0);
12280 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12281 o_conv = PaymentParameters_clone(&o_conv);
12282 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12283 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12284 return (uint32_t)ret_conv;
12287 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
12288 LDKDecodeError e_conv;
12289 e_conv.inner = (void*)(e & (~1));
12290 e_conv.is_owned = (e & 1) || (e == 0);
12291 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12292 e_conv = DecodeError_clone(&e_conv);
12293 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12294 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12295 return (uint32_t)ret_conv;
12298 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
12299 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
12300 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12304 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
12305 if ((_res & 1) != 0) return;
12306 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12307 CHECK_ACCESS(_res_ptr);
12308 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12310 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12313 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12314 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12315 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12316 return (uint32_t)ret_conv;
12318 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12319 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
12320 uint32_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12324 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
12325 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
12326 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12327 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12328 return (uint32_t)ret_conv;
12331 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
12332 LDKCVec_RouteHintHopZ _res_constr;
12333 _res_constr.datalen = _res->arr_len;
12334 if (_res_constr.datalen > 0)
12335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12337 _res_constr.data = NULL;
12338 uint32_t* _res_vals = _res->elems;
12339 for (size_t o = 0; o < _res_constr.datalen; o++) {
12340 uint32_t _res_conv_14 = _res_vals[o];
12341 LDKRouteHintHop _res_conv_14_conv;
12342 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12343 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12344 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12345 _res_constr.data[o] = _res_conv_14_conv;
12348 CVec_RouteHintHopZ_free(_res_constr);
12351 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
12352 LDKRouteHint o_conv;
12353 o_conv.inner = (void*)(o & (~1));
12354 o_conv.is_owned = (o & 1) || (o == 0);
12355 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12356 o_conv = RouteHint_clone(&o_conv);
12357 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12358 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12359 return (uint32_t)ret_conv;
12362 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
12363 LDKDecodeError e_conv;
12364 e_conv.inner = (void*)(e & (~1));
12365 e_conv.is_owned = (e & 1) || (e == 0);
12366 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12367 e_conv = DecodeError_clone(&e_conv);
12368 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12369 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12370 return (uint32_t)ret_conv;
12373 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
12374 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
12375 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12379 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
12380 if ((_res & 1) != 0) return;
12381 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12382 CHECK_ACCESS(_res_ptr);
12383 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12385 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12388 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12389 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12390 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12391 return (uint32_t)ret_conv;
12393 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
12394 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
12395 uint32_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12399 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
12400 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12401 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12402 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12403 return (uint32_t)ret_conv;
12406 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
12407 LDKRouteHintHop o_conv;
12408 o_conv.inner = (void*)(o & (~1));
12409 o_conv.is_owned = (o & 1) || (o == 0);
12410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12411 o_conv = RouteHintHop_clone(&o_conv);
12412 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12413 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12414 return (uint32_t)ret_conv;
12417 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
12418 LDKDecodeError e_conv;
12419 e_conv.inner = (void*)(e & (~1));
12420 e_conv.is_owned = (e & 1) || (e == 0);
12421 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12422 e_conv = DecodeError_clone(&e_conv);
12423 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12424 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12425 return (uint32_t)ret_conv;
12428 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
12429 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
12430 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12434 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
12435 if ((_res & 1) != 0) return;
12436 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12437 CHECK_ACCESS(_res_ptr);
12438 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12440 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12443 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12444 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12445 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12446 return (uint32_t)ret_conv;
12448 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
12449 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
12450 uint32_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12454 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
12455 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12456 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12457 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12458 return (uint32_t)ret_conv;
12461 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
12462 LDKCVec_ChannelDetailsZ _res_constr;
12463 _res_constr.datalen = _res->arr_len;
12464 if (_res_constr.datalen > 0)
12465 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12467 _res_constr.data = NULL;
12468 uint32_t* _res_vals = _res->elems;
12469 for (size_t q = 0; q < _res_constr.datalen; q++) {
12470 uint32_t _res_conv_16 = _res_vals[q];
12471 LDKChannelDetails _res_conv_16_conv;
12472 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12473 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12474 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12475 _res_constr.data[q] = _res_conv_16_conv;
12478 CVec_ChannelDetailsZ_free(_res_constr);
12481 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
12483 o_conv.inner = (void*)(o & (~1));
12484 o_conv.is_owned = (o & 1) || (o == 0);
12485 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12486 o_conv = Route_clone(&o_conv);
12487 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12488 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12489 return (uint32_t)ret_conv;
12492 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
12493 LDKLightningError e_conv;
12494 e_conv.inner = (void*)(e & (~1));
12495 e_conv.is_owned = (e & 1) || (e == 0);
12496 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12497 e_conv = LightningError_clone(&e_conv);
12498 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12499 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12500 return (uint32_t)ret_conv;
12503 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
12504 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
12505 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12509 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
12510 if ((_res & 1) != 0) return;
12511 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12512 CHECK_ACCESS(_res_ptr);
12513 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12515 CResult_RouteLightningErrorZ_free(_res_conv);
12518 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12519 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12520 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12521 return (uint32_t)ret_conv;
12523 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
12524 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
12525 uint32_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12529 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
12530 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12531 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12532 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12533 return (uint32_t)ret_conv;
12536 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12537 LDKCVec_PublicKeyZ _res_constr;
12538 _res_constr.datalen = _res->arr_len;
12539 if (_res_constr.datalen > 0)
12540 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12542 _res_constr.data = NULL;
12543 int8_tArray* _res_vals = (void*) _res->elems;
12544 for (size_t m = 0; m < _res_constr.datalen; m++) {
12545 int8_tArray _res_conv_12 = _res_vals[m];
12546 LDKPublicKey _res_conv_12_ref;
12547 CHECK(_res_conv_12->arr_len == 33);
12548 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12549 _res_constr.data[m] = _res_conv_12_ref;
12552 CVec_PublicKeyZ_free(_res_constr);
12555 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint32_t o) {
12556 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12557 CHECK_ACCESS(o_ptr);
12558 LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12559 o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)o) & ~1));
12560 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12561 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12562 return (uint32_t)ret_conv;
12565 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint32_t e) {
12566 LDKDecodeError e_conv;
12567 e_conv.inner = (void*)(e & (~1));
12568 e_conv.is_owned = (e & 1) || (e == 0);
12569 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12570 e_conv = DecodeError_clone(&e_conv);
12571 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12572 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12573 return (uint32_t)ret_conv;
12576 jboolean __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint32_t o) {
12577 LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(o & ~1);
12578 jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12582 void __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint32_t _res) {
12583 if ((_res & 1) != 0) return;
12584 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12585 CHECK_ACCESS(_res_ptr);
12586 LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12588 CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12591 static inline uintptr_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12592 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12593 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12594 return (uint32_t)ret_conv;
12596 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint32_t arg) {
12597 LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(arg & ~1);
12598 uint32_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12602 uint32_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint32_t orig) {
12603 LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)(orig & ~1);
12604 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12605 *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12606 return (uint32_t)ret_conv;
12609 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
12610 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12611 CHECK_ACCESS(o_ptr);
12612 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12613 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
12614 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12615 *ret_copy = COption_ClosureReasonZ_some(o_conv);
12616 uint32_t ret_ref = (uintptr_t)ret_copy;
12620 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12621 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12622 *ret_copy = COption_ClosureReasonZ_none();
12623 uint32_t ret_ref = (uintptr_t)ret_copy;
12627 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
12628 if ((_res & 1) != 0) return;
12629 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12630 CHECK_ACCESS(_res_ptr);
12631 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12633 COption_ClosureReasonZ_free(_res_conv);
12636 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12637 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12638 *ret_copy = COption_ClosureReasonZ_clone(arg);
12639 uint32_t ret_ref = (uintptr_t)ret_copy;
12642 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
12643 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
12644 uint32_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
12648 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12649 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12650 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12651 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12652 uint32_t ret_ref = (uintptr_t)ret_copy;
12656 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12657 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12658 CHECK_ACCESS(o_ptr);
12659 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12660 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
12661 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12662 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12663 return (uint32_t)ret_conv;
12666 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12667 LDKDecodeError e_conv;
12668 e_conv.inner = (void*)(e & (~1));
12669 e_conv.is_owned = (e & 1) || (e == 0);
12670 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12671 e_conv = DecodeError_clone(&e_conv);
12672 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12673 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12674 return (uint32_t)ret_conv;
12677 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12678 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12679 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12683 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12684 if ((_res & 1) != 0) return;
12685 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12686 CHECK_ACCESS(_res_ptr);
12687 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12689 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12692 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12693 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12694 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12695 return (uint32_t)ret_conv;
12697 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12698 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12699 uint32_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12703 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12704 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12705 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12706 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12707 return (uint32_t)ret_conv;
12710 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12711 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12712 CHECK_ACCESS(o_ptr);
12713 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12714 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
12715 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12716 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12717 uint32_t ret_ref = (uintptr_t)ret_copy;
12721 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12722 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12723 *ret_copy = COption_NetworkUpdateZ_none();
12724 uint32_t ret_ref = (uintptr_t)ret_copy;
12728 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12729 if ((_res & 1) != 0) return;
12730 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12731 CHECK_ACCESS(_res_ptr);
12732 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12734 COption_NetworkUpdateZ_free(_res_conv);
12737 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12738 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12739 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12740 uint32_t ret_ref = (uintptr_t)ret_copy;
12743 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12744 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12745 uint32_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12749 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12750 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12751 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12752 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12753 uint32_t ret_ref = (uintptr_t)ret_copy;
12757 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12758 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12759 _res_constr.datalen = _res->arr_len;
12760 if (_res_constr.datalen > 0)
12761 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12763 _res_constr.data = NULL;
12764 uint32_t* _res_vals = _res->elems;
12765 for (size_t b = 0; b < _res_constr.datalen; b++) {
12766 uint32_t _res_conv_27 = _res_vals[b];
12767 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
12768 CHECK_ACCESS(_res_conv_27_ptr);
12769 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12770 FREE((void*)_res_conv_27);
12771 _res_constr.data[b] = _res_conv_27_conv;
12774 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12777 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12778 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12779 CHECK_ACCESS(o_ptr);
12780 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12781 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
12782 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12783 *ret_copy = COption_EventZ_some(o_conv);
12784 uint32_t ret_ref = (uintptr_t)ret_copy;
12788 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12789 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12790 *ret_copy = COption_EventZ_none();
12791 uint32_t ret_ref = (uintptr_t)ret_copy;
12795 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12796 if ((_res & 1) != 0) return;
12797 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12798 CHECK_ACCESS(_res_ptr);
12799 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12801 COption_EventZ_free(_res_conv);
12804 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12805 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12806 *ret_copy = COption_EventZ_clone(arg);
12807 uint32_t ret_ref = (uintptr_t)ret_copy;
12810 uint32_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12811 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12812 uint32_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
12816 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12817 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12818 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12819 *ret_copy = COption_EventZ_clone(orig_conv);
12820 uint32_t ret_ref = (uintptr_t)ret_copy;
12824 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12825 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12826 CHECK_ACCESS(o_ptr);
12827 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12828 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
12829 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12830 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12831 return (uint32_t)ret_conv;
12834 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12835 LDKDecodeError e_conv;
12836 e_conv.inner = (void*)(e & (~1));
12837 e_conv.is_owned = (e & 1) || (e == 0);
12838 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12839 e_conv = DecodeError_clone(&e_conv);
12840 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12841 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12842 return (uint32_t)ret_conv;
12845 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12846 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12847 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12851 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12852 if ((_res & 1) != 0) return;
12853 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12854 CHECK_ACCESS(_res_ptr);
12855 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12857 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12860 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12861 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12862 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12863 return (uint32_t)ret_conv;
12865 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12866 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12867 uint32_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12871 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12872 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12873 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12874 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12875 return (uint32_t)ret_conv;
12878 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
12879 LDKCVec_MessageSendEventZ _res_constr;
12880 _res_constr.datalen = _res->arr_len;
12881 if (_res_constr.datalen > 0)
12882 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12884 _res_constr.data = NULL;
12885 uint32_t* _res_vals = _res->elems;
12886 for (size_t s = 0; s < _res_constr.datalen; s++) {
12887 uint32_t _res_conv_18 = _res_vals[s];
12888 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
12889 CHECK_ACCESS(_res_conv_18_ptr);
12890 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12891 FREE((void*)_res_conv_18);
12892 _res_constr.data[s] = _res_conv_18_conv;
12895 CVec_MessageSendEventZ_free(_res_constr);
12898 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
12899 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12900 CHECK_ACCESS(o_ptr);
12901 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12902 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
12903 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12904 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12905 return (uint32_t)ret_conv;
12908 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12909 LDKAccessError e_conv = LDKAccessError_from_js(e);
12910 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12911 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12912 return (uint32_t)ret_conv;
12915 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
12916 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
12917 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12921 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
12922 if ((_res & 1) != 0) return;
12923 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12924 CHECK_ACCESS(_res_ptr);
12925 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12927 CResult_TxOutAccessErrorZ_free(_res_conv);
12930 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12931 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12932 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12933 return (uint32_t)ret_conv;
12935 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
12936 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
12937 uint32_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12941 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
12942 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
12943 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12944 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12945 return (uint32_t)ret_conv;
12948 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12949 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12950 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12951 return ((uint32_t)ret_conv);
12953 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
12954 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
12955 uint32_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12959 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
12960 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12961 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12962 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12963 return ((uint32_t)ret_conv);
12966 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12967 LDKTransaction b_ref;
12968 b_ref.datalen = b->arr_len;
12969 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12970 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12971 b_ref.data_is_owned = true;
12972 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12973 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12974 return ((uint32_t)ret_conv);
12977 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
12978 if ((_res & 1) != 0) return;
12979 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12980 CHECK_ACCESS(_res_ptr);
12981 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12983 C2Tuple_usizeTransactionZ_free(_res_conv);
12986 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
12987 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12988 _res_constr.datalen = _res->arr_len;
12989 if (_res_constr.datalen > 0)
12990 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12992 _res_constr.data = NULL;
12993 uint32_t* _res_vals = _res->elems;
12994 for (size_t c = 0; c < _res_constr.datalen; c++) {
12995 uint32_t _res_conv_28 = _res_vals[c];
12996 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
12997 CHECK_ACCESS(_res_conv_28_ptr);
12998 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12999 FREE((void*)_res_conv_28);
13000 _res_constr.data[c] = _res_conv_28_conv;
13003 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13006 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13007 LDKCVec_TxidZ _res_constr;
13008 _res_constr.datalen = _res->arr_len;
13009 if (_res_constr.datalen > 0)
13010 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13012 _res_constr.data = NULL;
13013 int8_tArray* _res_vals = (void*) _res->elems;
13014 for (size_t m = 0; m < _res_constr.datalen; m++) {
13015 int8_tArray _res_conv_12 = _res_vals[m];
13016 LDKThirtyTwoBytes _res_conv_12_ref;
13017 CHECK(_res_conv_12->arr_len == 32);
13018 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13019 _res_constr.data[m] = _res_conv_12_ref;
13022 CVec_TxidZ_free(_res_constr);
13025 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
13026 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13027 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13028 return (uint32_t)ret_conv;
13031 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13032 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13033 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13034 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13035 return (uint32_t)ret_conv;
13038 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
13039 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
13040 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13044 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
13045 if ((_res & 1) != 0) return;
13046 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13047 CHECK_ACCESS(_res_ptr);
13048 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13050 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13053 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13054 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13055 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13056 return (uint32_t)ret_conv;
13058 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
13059 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
13060 uint32_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13064 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
13065 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
13066 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13067 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13068 return (uint32_t)ret_conv;
13071 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
13072 LDKCVec_MonitorEventZ _res_constr;
13073 _res_constr.datalen = _res->arr_len;
13074 if (_res_constr.datalen > 0)
13075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13077 _res_constr.data = NULL;
13078 uint32_t* _res_vals = _res->elems;
13079 for (size_t o = 0; o < _res_constr.datalen; o++) {
13080 uint32_t _res_conv_14 = _res_vals[o];
13081 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
13082 CHECK_ACCESS(_res_conv_14_ptr);
13083 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13084 FREE((void*)_res_conv_14);
13085 _res_constr.data[o] = _res_conv_14_conv;
13088 CVec_MonitorEventZ_free(_res_constr);
13091 static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) {
13092 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13093 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg);
13094 return ((uint32_t)ret_conv);
13096 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(uint32_t arg) {
13097 LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1);
13098 uint32_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv);
13102 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_clone(uint32_t orig) {
13103 LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1);
13104 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13105 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv);
13106 return ((uint32_t)ret_conv);
13109 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_new(uint32_t a, uint32_tArray b) {
13110 LDKOutPoint a_conv;
13111 a_conv.inner = (void*)(a & (~1));
13112 a_conv.is_owned = (a & 1) || (a == 0);
13113 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13114 a_conv = OutPoint_clone(&a_conv);
13115 LDKCVec_MonitorEventZ b_constr;
13116 b_constr.datalen = b->arr_len;
13117 if (b_constr.datalen > 0)
13118 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13120 b_constr.data = NULL;
13121 uint32_t* b_vals = b->elems;
13122 for (size_t o = 0; o < b_constr.datalen; o++) {
13123 uint32_t b_conv_14 = b_vals[o];
13124 void* b_conv_14_ptr = (void*)(((uintptr_t)b_conv_14) & ~1);
13125 CHECK_ACCESS(b_conv_14_ptr);
13126 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13127 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)b_conv_14) & ~1));
13128 b_constr.data[o] = b_conv_14_conv;
13131 LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ");
13132 *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr);
13133 return ((uint32_t)ret_conv);
13136 void __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorEventZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorEventZZ_free(uint32_t _res) {
13137 if ((_res & 1) != 0) return;
13138 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13139 CHECK_ACCESS(_res_ptr);
13140 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr);
13142 C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv);
13145 void __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(uint32_tArray _res) {
13146 LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr;
13147 _res_constr.datalen = _res->arr_len;
13148 if (_res_constr.datalen > 0)
13149 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements");
13151 _res_constr.data = NULL;
13152 uint32_t* _res_vals = _res->elems;
13153 for (size_t m = 0; m < _res_constr.datalen; m++) {
13154 uint32_t _res_conv_38 = _res_vals[m];
13155 void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1);
13156 CHECK_ACCESS(_res_conv_38_ptr);
13157 LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr);
13158 FREE((void*)_res_conv_38);
13159 _res_constr.data[m] = _res_conv_38_conv;
13162 CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr);
13165 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
13166 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13167 CHECK_ACCESS(o_ptr);
13168 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
13169 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
13170 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13171 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
13172 uint32_t ret_ref = (uintptr_t)ret_copy;
13176 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
13177 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13178 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
13179 uint32_t ret_ref = (uintptr_t)ret_copy;
13183 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
13184 if ((_res & 1) != 0) return;
13185 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13186 CHECK_ACCESS(_res_ptr);
13187 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
13189 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
13192 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
13193 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13194 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
13195 uint32_t ret_ref = (uintptr_t)ret_copy;
13198 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
13199 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
13200 uint32_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
13204 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
13205 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
13206 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
13207 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
13208 uint32_t ret_ref = (uintptr_t)ret_copy;
13212 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
13213 LDKFixedPenaltyScorer o_conv;
13214 o_conv.inner = (void*)(o & (~1));
13215 o_conv.is_owned = (o & 1) || (o == 0);
13216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13217 o_conv = FixedPenaltyScorer_clone(&o_conv);
13218 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13219 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13220 return (uint32_t)ret_conv;
13223 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
13224 LDKDecodeError e_conv;
13225 e_conv.inner = (void*)(e & (~1));
13226 e_conv.is_owned = (e & 1) || (e == 0);
13227 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13228 e_conv = DecodeError_clone(&e_conv);
13229 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13230 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13231 return (uint32_t)ret_conv;
13234 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
13235 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
13236 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13240 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint32_t _res) {
13241 if ((_res & 1) != 0) return;
13242 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13243 CHECK_ACCESS(_res_ptr);
13244 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13246 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13249 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13250 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13251 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13252 return (uint32_t)ret_conv;
13254 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
13255 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
13256 uint32_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13260 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
13261 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
13262 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13263 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13264 return (uint32_t)ret_conv;
13267 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint32_t o) {
13268 LDKProbabilisticScorer o_conv;
13269 o_conv.inner = (void*)(o & (~1));
13270 o_conv.is_owned = (o & 1) || (o == 0);
13271 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13272 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13273 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13274 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13275 return (uint32_t)ret_conv;
13278 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint32_t e) {
13279 LDKDecodeError e_conv;
13280 e_conv.inner = (void*)(e & (~1));
13281 e_conv.is_owned = (e & 1) || (e == 0);
13282 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13283 e_conv = DecodeError_clone(&e_conv);
13284 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13285 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13286 return (uint32_t)ret_conv;
13289 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint32_t o) {
13290 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
13291 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13295 void __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint32_t _res) {
13296 if ((_res & 1) != 0) return;
13297 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13298 CHECK_ACCESS(_res_ptr);
13299 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13301 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13304 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
13305 LDKInitFeatures o_conv;
13306 o_conv.inner = (void*)(o & (~1));
13307 o_conv.is_owned = (o & 1) || (o == 0);
13308 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13309 o_conv = InitFeatures_clone(&o_conv);
13310 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13311 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13312 return (uint32_t)ret_conv;
13315 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
13316 LDKDecodeError e_conv;
13317 e_conv.inner = (void*)(e & (~1));
13318 e_conv.is_owned = (e & 1) || (e == 0);
13319 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13320 e_conv = DecodeError_clone(&e_conv);
13321 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13322 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13323 return (uint32_t)ret_conv;
13326 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13327 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
13328 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13332 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
13333 if ((_res & 1) != 0) return;
13334 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13335 CHECK_ACCESS(_res_ptr);
13336 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13338 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13341 static inline uintptr_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13342 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13343 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13344 return (uint32_t)ret_conv;
13346 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13347 LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
13348 uint32_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13352 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint32_t orig) {
13353 LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(orig & ~1);
13354 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13355 *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13356 return (uint32_t)ret_conv;
13359 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
13360 LDKChannelFeatures o_conv;
13361 o_conv.inner = (void*)(o & (~1));
13362 o_conv.is_owned = (o & 1) || (o == 0);
13363 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13364 o_conv = ChannelFeatures_clone(&o_conv);
13365 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13366 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13367 return (uint32_t)ret_conv;
13370 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
13371 LDKDecodeError e_conv;
13372 e_conv.inner = (void*)(e & (~1));
13373 e_conv.is_owned = (e & 1) || (e == 0);
13374 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13375 e_conv = DecodeError_clone(&e_conv);
13376 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13377 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13378 return (uint32_t)ret_conv;
13381 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13382 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
13383 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13387 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
13388 if ((_res & 1) != 0) return;
13389 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13390 CHECK_ACCESS(_res_ptr);
13391 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13393 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13396 static inline uintptr_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13397 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13398 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13399 return (uint32_t)ret_conv;
13401 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13402 LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
13403 uint32_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13407 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint32_t orig) {
13408 LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(orig & ~1);
13409 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13410 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13411 return (uint32_t)ret_conv;
13414 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
13415 LDKNodeFeatures o_conv;
13416 o_conv.inner = (void*)(o & (~1));
13417 o_conv.is_owned = (o & 1) || (o == 0);
13418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13419 o_conv = NodeFeatures_clone(&o_conv);
13420 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13421 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13422 return (uint32_t)ret_conv;
13425 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
13426 LDKDecodeError e_conv;
13427 e_conv.inner = (void*)(e & (~1));
13428 e_conv.is_owned = (e & 1) || (e == 0);
13429 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13430 e_conv = DecodeError_clone(&e_conv);
13431 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13432 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13433 return (uint32_t)ret_conv;
13436 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13437 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
13438 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13442 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
13443 if ((_res & 1) != 0) return;
13444 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13445 CHECK_ACCESS(_res_ptr);
13446 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13448 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13451 static inline uintptr_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13452 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13453 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13454 return (uint32_t)ret_conv;
13456 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13457 LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
13458 uint32_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13462 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13463 LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(orig & ~1);
13464 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13465 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13466 return (uint32_t)ret_conv;
13469 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
13470 LDKInvoiceFeatures o_conv;
13471 o_conv.inner = (void*)(o & (~1));
13472 o_conv.is_owned = (o & 1) || (o == 0);
13473 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13474 o_conv = InvoiceFeatures_clone(&o_conv);
13475 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13476 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13477 return (uint32_t)ret_conv;
13480 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
13481 LDKDecodeError e_conv;
13482 e_conv.inner = (void*)(e & (~1));
13483 e_conv.is_owned = (e & 1) || (e == 0);
13484 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13485 e_conv = DecodeError_clone(&e_conv);
13486 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13487 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13488 return (uint32_t)ret_conv;
13491 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13492 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
13493 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13497 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
13498 if ((_res & 1) != 0) return;
13499 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13500 CHECK_ACCESS(_res_ptr);
13501 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13503 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13506 static inline uintptr_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13507 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13508 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13509 return (uint32_t)ret_conv;
13511 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13512 LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
13513 uint32_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13517 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint32_t orig) {
13518 LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(orig & ~1);
13519 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13520 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13521 return (uint32_t)ret_conv;
13524 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
13525 LDKChannelTypeFeatures o_conv;
13526 o_conv.inner = (void*)(o & (~1));
13527 o_conv.is_owned = (o & 1) || (o == 0);
13528 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13529 o_conv = ChannelTypeFeatures_clone(&o_conv);
13530 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13531 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
13532 return (uint32_t)ret_conv;
13535 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
13536 LDKDecodeError e_conv;
13537 e_conv.inner = (void*)(e & (~1));
13538 e_conv.is_owned = (e & 1) || (e == 0);
13539 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13540 e_conv = DecodeError_clone(&e_conv);
13541 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13542 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
13543 return (uint32_t)ret_conv;
13546 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
13547 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
13548 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13552 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
13553 if ((_res & 1) != 0) return;
13554 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13555 CHECK_ACCESS(_res_ptr);
13556 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13558 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13561 static inline uintptr_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13562 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13563 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
13564 return (uint32_t)ret_conv;
13566 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
13567 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1);
13568 uint32_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13572 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint32_t orig) {
13573 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(orig & ~1);
13574 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13575 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
13576 return (uint32_t)ret_conv;
13579 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
13581 o_conv.inner = (void*)(o & (~1));
13582 o_conv.is_owned = (o & 1) || (o == 0);
13583 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13584 o_conv = NodeId_clone(&o_conv);
13585 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13586 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13587 return (uint32_t)ret_conv;
13590 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
13591 LDKDecodeError e_conv;
13592 e_conv.inner = (void*)(e & (~1));
13593 e_conv.is_owned = (e & 1) || (e == 0);
13594 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13595 e_conv = DecodeError_clone(&e_conv);
13596 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13597 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13598 return (uint32_t)ret_conv;
13601 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
13602 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
13603 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13607 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
13608 if ((_res & 1) != 0) return;
13609 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13610 CHECK_ACCESS(_res_ptr);
13611 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13613 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13616 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13617 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13618 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13619 return (uint32_t)ret_conv;
13621 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
13622 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
13623 uint32_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13627 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
13628 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13629 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13630 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13631 return (uint32_t)ret_conv;
13634 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
13635 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13636 CHECK_ACCESS(o_ptr);
13637 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13638 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
13639 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13640 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13641 return (uint32_t)ret_conv;
13644 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
13645 LDKDecodeError e_conv;
13646 e_conv.inner = (void*)(e & (~1));
13647 e_conv.is_owned = (e & 1) || (e == 0);
13648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13649 e_conv = DecodeError_clone(&e_conv);
13650 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13651 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13652 return (uint32_t)ret_conv;
13655 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
13656 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
13657 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13661 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
13662 if ((_res & 1) != 0) return;
13663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13664 CHECK_ACCESS(_res_ptr);
13665 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13667 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13670 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13671 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13672 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13673 return (uint32_t)ret_conv;
13675 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
13676 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
13677 uint32_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13681 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
13682 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
13683 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13684 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13685 return (uint32_t)ret_conv;
13688 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
13689 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13690 CHECK_ACCESS(o_ptr);
13691 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13692 if (o_conv.free == LDKAccess_JCalls_free) {
13693 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13694 LDKAccess_JCalls_cloned(&o_conv);
13696 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13697 *ret_copy = COption_AccessZ_some(o_conv);
13698 uint32_t ret_ref = (uintptr_t)ret_copy;
13702 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
13703 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13704 *ret_copy = COption_AccessZ_none();
13705 uint32_t ret_ref = (uintptr_t)ret_copy;
13709 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
13710 if ((_res & 1) != 0) return;
13711 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13712 CHECK_ACCESS(_res_ptr);
13713 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13715 COption_AccessZ_free(_res_conv);
13718 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13719 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13720 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13721 return (uint32_t)ret_conv;
13724 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
13725 LDKLightningError e_conv;
13726 e_conv.inner = (void*)(e & (~1));
13727 e_conv.is_owned = (e & 1) || (e == 0);
13728 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13729 e_conv = LightningError_clone(&e_conv);
13730 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13731 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13732 return (uint32_t)ret_conv;
13735 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
13736 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
13737 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
13741 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
13742 if ((_res & 1) != 0) return;
13743 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13744 CHECK_ACCESS(_res_ptr);
13745 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13747 CResult_boolLightningErrorZ_free(_res_conv);
13750 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13751 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13752 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13753 return (uint32_t)ret_conv;
13755 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
13756 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
13757 uint32_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13761 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
13762 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13763 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13764 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13765 return (uint32_t)ret_conv;
13768 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13769 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13770 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13771 return ((uint32_t)ret_conv);
13773 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
13774 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
13775 uint32_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13779 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
13780 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13781 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13782 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13783 return ((uint32_t)ret_conv);
13786 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
13787 LDKChannelAnnouncement a_conv;
13788 a_conv.inner = (void*)(a & (~1));
13789 a_conv.is_owned = (a & 1) || (a == 0);
13790 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13791 a_conv = ChannelAnnouncement_clone(&a_conv);
13792 LDKChannelUpdate b_conv;
13793 b_conv.inner = (void*)(b & (~1));
13794 b_conv.is_owned = (b & 1) || (b == 0);
13795 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13796 b_conv = ChannelUpdate_clone(&b_conv);
13797 LDKChannelUpdate c_conv;
13798 c_conv.inner = (void*)(c & (~1));
13799 c_conv.is_owned = (c & 1) || (c == 0);
13800 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13801 c_conv = ChannelUpdate_clone(&c_conv);
13802 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13803 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13804 return ((uint32_t)ret_conv);
13807 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
13808 if ((_res & 1) != 0) return;
13809 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13810 CHECK_ACCESS(_res_ptr);
13811 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13813 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13816 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
13817 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13818 _res_constr.datalen = _res->arr_len;
13819 if (_res_constr.datalen > 0)
13820 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13822 _res_constr.data = NULL;
13823 uint32_t* _res_vals = _res->elems;
13824 for (size_t h = 0; h < _res_constr.datalen; h++) {
13825 uint32_t _res_conv_59 = _res_vals[h];
13826 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
13827 CHECK_ACCESS(_res_conv_59_ptr);
13828 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13829 FREE((void*)_res_conv_59);
13830 _res_constr.data[h] = _res_conv_59_conv;
13833 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13836 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
13837 LDKCVec_NodeAnnouncementZ _res_constr;
13838 _res_constr.datalen = _res->arr_len;
13839 if (_res_constr.datalen > 0)
13840 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13842 _res_constr.data = NULL;
13843 uint32_t* _res_vals = _res->elems;
13844 for (size_t s = 0; s < _res_constr.datalen; s++) {
13845 uint32_t _res_conv_18 = _res_vals[s];
13846 LDKNodeAnnouncement _res_conv_18_conv;
13847 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13848 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13849 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13850 _res_constr.data[s] = _res_conv_18_conv;
13853 CVec_NodeAnnouncementZ_free(_res_constr);
13856 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
13857 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13858 *ret_conv = CResult_NoneLightningErrorZ_ok();
13859 return (uint32_t)ret_conv;
13862 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
13863 LDKLightningError e_conv;
13864 e_conv.inner = (void*)(e & (~1));
13865 e_conv.is_owned = (e & 1) || (e == 0);
13866 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13867 e_conv = LightningError_clone(&e_conv);
13868 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13869 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13870 return (uint32_t)ret_conv;
13873 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
13874 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
13875 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
13879 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
13880 if ((_res & 1) != 0) return;
13881 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13882 CHECK_ACCESS(_res_ptr);
13883 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13885 CResult_NoneLightningErrorZ_free(_res_conv);
13888 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13889 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13890 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13891 return (uint32_t)ret_conv;
13893 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
13894 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
13895 uint32_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13899 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
13900 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13901 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13902 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13903 return (uint32_t)ret_conv;
13906 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
13907 LDKChannelUpdateInfo o_conv;
13908 o_conv.inner = (void*)(o & (~1));
13909 o_conv.is_owned = (o & 1) || (o == 0);
13910 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13911 o_conv = ChannelUpdateInfo_clone(&o_conv);
13912 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13913 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
13914 return (uint32_t)ret_conv;
13917 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
13918 LDKDecodeError e_conv;
13919 e_conv.inner = (void*)(e & (~1));
13920 e_conv.is_owned = (e & 1) || (e == 0);
13921 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13922 e_conv = DecodeError_clone(&e_conv);
13923 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13924 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
13925 return (uint32_t)ret_conv;
13928 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
13929 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
13930 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
13934 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
13935 if ((_res & 1) != 0) return;
13936 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13937 CHECK_ACCESS(_res_ptr);
13938 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
13940 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
13943 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
13944 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13945 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
13946 return (uint32_t)ret_conv;
13948 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
13949 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
13950 uint32_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
13954 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
13955 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
13956 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13957 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
13958 return (uint32_t)ret_conv;
13961 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
13962 LDKChannelInfo o_conv;
13963 o_conv.inner = (void*)(o & (~1));
13964 o_conv.is_owned = (o & 1) || (o == 0);
13965 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13966 o_conv = ChannelInfo_clone(&o_conv);
13967 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13968 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13969 return (uint32_t)ret_conv;
13972 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
13973 LDKDecodeError e_conv;
13974 e_conv.inner = (void*)(e & (~1));
13975 e_conv.is_owned = (e & 1) || (e == 0);
13976 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13977 e_conv = DecodeError_clone(&e_conv);
13978 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13979 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13980 return (uint32_t)ret_conv;
13983 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
13984 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
13985 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13989 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
13990 if ((_res & 1) != 0) return;
13991 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13992 CHECK_ACCESS(_res_ptr);
13993 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13995 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13998 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13999 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14000 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14001 return (uint32_t)ret_conv;
14003 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14004 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
14005 uint32_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14009 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
14010 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
14011 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14012 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14013 return (uint32_t)ret_conv;
14016 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
14017 LDKRoutingFees o_conv;
14018 o_conv.inner = (void*)(o & (~1));
14019 o_conv.is_owned = (o & 1) || (o == 0);
14020 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14021 o_conv = RoutingFees_clone(&o_conv);
14022 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14023 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14024 return (uint32_t)ret_conv;
14027 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
14028 LDKDecodeError e_conv;
14029 e_conv.inner = (void*)(e & (~1));
14030 e_conv.is_owned = (e & 1) || (e == 0);
14031 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14032 e_conv = DecodeError_clone(&e_conv);
14033 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14034 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14035 return (uint32_t)ret_conv;
14038 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
14039 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
14040 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14044 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
14045 if ((_res & 1) != 0) return;
14046 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14047 CHECK_ACCESS(_res_ptr);
14048 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14050 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14053 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14054 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14055 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14056 return (uint32_t)ret_conv;
14058 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
14059 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
14060 uint32_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14064 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
14065 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14066 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14067 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14068 return (uint32_t)ret_conv;
14071 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14072 LDKCVec_NetAddressZ _res_constr;
14073 _res_constr.datalen = _res->arr_len;
14074 if (_res_constr.datalen > 0)
14075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14077 _res_constr.data = NULL;
14078 uint32_t* _res_vals = _res->elems;
14079 for (size_t m = 0; m < _res_constr.datalen; m++) {
14080 uint32_t _res_conv_12 = _res_vals[m];
14081 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14082 CHECK_ACCESS(_res_conv_12_ptr);
14083 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14084 FREE((void*)_res_conv_12);
14085 _res_constr.data[m] = _res_conv_12_conv;
14088 CVec_NetAddressZ_free(_res_constr);
14091 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
14092 LDKNodeAnnouncementInfo o_conv;
14093 o_conv.inner = (void*)(o & (~1));
14094 o_conv.is_owned = (o & 1) || (o == 0);
14095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14096 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14097 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14098 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14099 return (uint32_t)ret_conv;
14102 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
14103 LDKDecodeError e_conv;
14104 e_conv.inner = (void*)(e & (~1));
14105 e_conv.is_owned = (e & 1) || (e == 0);
14106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14107 e_conv = DecodeError_clone(&e_conv);
14108 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14109 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14110 return (uint32_t)ret_conv;
14113 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
14114 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
14115 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14119 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
14120 if ((_res & 1) != 0) return;
14121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14122 CHECK_ACCESS(_res_ptr);
14123 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14125 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14128 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14129 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14130 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14131 return (uint32_t)ret_conv;
14133 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14134 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
14135 uint32_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14139 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
14140 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14141 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14142 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14143 return (uint32_t)ret_conv;
14146 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
14147 LDKCVec_u64Z _res_constr;
14148 _res_constr.datalen = _res->arr_len;
14149 if (_res_constr.datalen > 0)
14150 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14152 _res_constr.data = NULL;
14153 int64_t* _res_vals = _res->elems;
14154 for (size_t i = 0; i < _res_constr.datalen; i++) {
14155 int64_t _res_conv_8 = _res_vals[i];
14156 _res_constr.data[i] = _res_conv_8;
14159 CVec_u64Z_free(_res_constr);
14162 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
14163 LDKNodeInfo o_conv;
14164 o_conv.inner = (void*)(o & (~1));
14165 o_conv.is_owned = (o & 1) || (o == 0);
14166 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14167 o_conv = NodeInfo_clone(&o_conv);
14168 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14169 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14170 return (uint32_t)ret_conv;
14173 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
14174 LDKDecodeError e_conv;
14175 e_conv.inner = (void*)(e & (~1));
14176 e_conv.is_owned = (e & 1) || (e == 0);
14177 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14178 e_conv = DecodeError_clone(&e_conv);
14179 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14180 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14181 return (uint32_t)ret_conv;
14184 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
14185 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
14186 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14190 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
14191 if ((_res & 1) != 0) return;
14192 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14193 CHECK_ACCESS(_res_ptr);
14194 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14196 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14199 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14200 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14201 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14202 return (uint32_t)ret_conv;
14204 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14205 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
14206 uint32_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14210 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
14211 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14212 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14213 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14214 return (uint32_t)ret_conv;
14217 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
14218 LDKNetworkGraph o_conv;
14219 o_conv.inner = (void*)(o & (~1));
14220 o_conv.is_owned = (o & 1) || (o == 0);
14221 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14222 // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14223 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14224 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14225 return (uint32_t)ret_conv;
14228 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
14229 LDKDecodeError e_conv;
14230 e_conv.inner = (void*)(e & (~1));
14231 e_conv.is_owned = (e & 1) || (e == 0);
14232 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14233 e_conv = DecodeError_clone(&e_conv);
14234 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14235 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14236 return (uint32_t)ret_conv;
14239 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
14240 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
14241 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14245 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
14246 if ((_res & 1) != 0) return;
14247 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14248 CHECK_ACCESS(_res_ptr);
14249 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14251 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14254 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
14255 LDKCVec_NetAddressZ o_constr;
14256 o_constr.datalen = o->arr_len;
14257 if (o_constr.datalen > 0)
14258 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14260 o_constr.data = NULL;
14261 uint32_t* o_vals = o->elems;
14262 for (size_t m = 0; m < o_constr.datalen; m++) {
14263 uint32_t o_conv_12 = o_vals[m];
14264 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
14265 CHECK_ACCESS(o_conv_12_ptr);
14266 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14267 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
14268 o_constr.data[m] = o_conv_12_conv;
14271 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14272 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14273 uint32_t ret_ref = (uintptr_t)ret_copy;
14277 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14278 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14279 *ret_copy = COption_CVec_NetAddressZZ_none();
14280 uint32_t ret_ref = (uintptr_t)ret_copy;
14284 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
14285 if ((_res & 1) != 0) return;
14286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14287 CHECK_ACCESS(_res_ptr);
14288 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14290 COption_CVec_NetAddressZZ_free(_res_conv);
14293 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14294 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14295 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14296 uint32_t ret_ref = (uintptr_t)ret_copy;
14299 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
14300 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
14301 uint32_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14305 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
14306 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14307 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14308 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14309 uint32_t ret_ref = (uintptr_t)ret_copy;
14313 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14314 LDKDelayedPaymentOutputDescriptor o_conv;
14315 o_conv.inner = (void*)(o & (~1));
14316 o_conv.is_owned = (o & 1) || (o == 0);
14317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14318 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14319 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14320 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14321 return (uint32_t)ret_conv;
14324 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14325 LDKDecodeError e_conv;
14326 e_conv.inner = (void*)(e & (~1));
14327 e_conv.is_owned = (e & 1) || (e == 0);
14328 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14329 e_conv = DecodeError_clone(&e_conv);
14330 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14331 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14332 return (uint32_t)ret_conv;
14335 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14336 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14337 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14341 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14342 if ((_res & 1) != 0) return;
14343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14344 CHECK_ACCESS(_res_ptr);
14345 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14347 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14350 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14351 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14352 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14353 return (uint32_t)ret_conv;
14355 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14356 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14357 uint32_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14361 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14362 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14363 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14364 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14365 return (uint32_t)ret_conv;
14368 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14369 LDKStaticPaymentOutputDescriptor o_conv;
14370 o_conv.inner = (void*)(o & (~1));
14371 o_conv.is_owned = (o & 1) || (o == 0);
14372 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14373 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14374 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14375 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14376 return (uint32_t)ret_conv;
14379 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14380 LDKDecodeError e_conv;
14381 e_conv.inner = (void*)(e & (~1));
14382 e_conv.is_owned = (e & 1) || (e == 0);
14383 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14384 e_conv = DecodeError_clone(&e_conv);
14385 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14386 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14387 return (uint32_t)ret_conv;
14390 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14391 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14392 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14396 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14397 if ((_res & 1) != 0) return;
14398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14399 CHECK_ACCESS(_res_ptr);
14400 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14402 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14405 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14406 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14407 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14408 return (uint32_t)ret_conv;
14410 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14411 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14412 uint32_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14416 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14417 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14418 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14419 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14420 return (uint32_t)ret_conv;
14423 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14424 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14425 CHECK_ACCESS(o_ptr);
14426 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14427 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
14428 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14429 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14430 return (uint32_t)ret_conv;
14433 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14434 LDKDecodeError e_conv;
14435 e_conv.inner = (void*)(e & (~1));
14436 e_conv.is_owned = (e & 1) || (e == 0);
14437 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14438 e_conv = DecodeError_clone(&e_conv);
14439 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14440 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14441 return (uint32_t)ret_conv;
14444 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14445 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
14446 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14450 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14451 if ((_res & 1) != 0) return;
14452 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14453 CHECK_ACCESS(_res_ptr);
14454 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14456 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14459 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14460 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14461 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14462 return (uint32_t)ret_conv;
14464 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14465 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14466 uint32_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14470 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14471 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14472 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14473 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14474 return (uint32_t)ret_conv;
14477 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14478 LDKCVec_PaymentPreimageZ _res_constr;
14479 _res_constr.datalen = _res->arr_len;
14480 if (_res_constr.datalen > 0)
14481 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14483 _res_constr.data = NULL;
14484 int8_tArray* _res_vals = (void*) _res->elems;
14485 for (size_t m = 0; m < _res_constr.datalen; m++) {
14486 int8_tArray _res_conv_12 = _res_vals[m];
14487 LDKThirtyTwoBytes _res_conv_12_ref;
14488 CHECK(_res_conv_12->arr_len == 32);
14489 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14490 _res_constr.data[m] = _res_conv_12_ref;
14493 CVec_PaymentPreimageZ_free(_res_constr);
14496 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14497 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14498 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14499 return ((uint32_t)ret_conv);
14501 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
14502 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14503 uint32_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14507 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
14508 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14509 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14510 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14511 return ((uint32_t)ret_conv);
14514 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14515 LDKSignature a_ref;
14516 CHECK(a->arr_len == 64);
14517 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14518 LDKCVec_SignatureZ b_constr;
14519 b_constr.datalen = b->arr_len;
14520 if (b_constr.datalen > 0)
14521 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14523 b_constr.data = NULL;
14524 int8_tArray* b_vals = (void*) b->elems;
14525 for (size_t m = 0; m < b_constr.datalen; m++) {
14526 int8_tArray b_conv_12 = b_vals[m];
14527 LDKSignature b_conv_12_ref;
14528 CHECK(b_conv_12->arr_len == 64);
14529 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
14530 b_constr.data[m] = b_conv_12_ref;
14533 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14534 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14535 return ((uint32_t)ret_conv);
14538 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
14539 if ((_res & 1) != 0) return;
14540 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14541 CHECK_ACCESS(_res_ptr);
14542 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14544 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14547 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
14548 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14549 CHECK_ACCESS(o_ptr);
14550 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14551 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
14552 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14553 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14554 return (uint32_t)ret_conv;
14557 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14558 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14559 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14560 return (uint32_t)ret_conv;
14563 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
14564 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14565 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14569 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
14570 if ((_res & 1) != 0) return;
14571 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14572 CHECK_ACCESS(_res_ptr);
14573 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14575 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14578 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14579 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14580 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14581 return (uint32_t)ret_conv;
14583 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
14584 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14585 uint32_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14589 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
14590 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14591 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14592 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14593 return (uint32_t)ret_conv;
14596 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14597 LDKSignature o_ref;
14598 CHECK(o->arr_len == 64);
14599 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
14600 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14601 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14602 return (uint32_t)ret_conv;
14605 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
14606 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14607 *ret_conv = CResult_SignatureNoneZ_err();
14608 return (uint32_t)ret_conv;
14611 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
14612 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14613 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
14617 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
14618 if ((_res & 1) != 0) return;
14619 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14620 CHECK_ACCESS(_res_ptr);
14621 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14623 CResult_SignatureNoneZ_free(_res_conv);
14626 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14627 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14628 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14629 return (uint32_t)ret_conv;
14631 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
14632 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14633 uint32_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14637 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
14638 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14639 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14640 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14641 return (uint32_t)ret_conv;
14644 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
14645 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14646 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
14647 return ((uint32_t)ret_conv);
14649 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
14650 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
14651 uint32_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
14655 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
14656 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
14657 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14658 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
14659 return ((uint32_t)ret_conv);
14662 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
14663 LDKSignature a_ref;
14664 CHECK(a->arr_len == 64);
14665 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14666 LDKSignature b_ref;
14667 CHECK(b->arr_len == 64);
14668 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
14669 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14670 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
14671 return ((uint32_t)ret_conv);
14674 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
14675 if ((_res & 1) != 0) return;
14676 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14677 CHECK_ACCESS(_res_ptr);
14678 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
14680 C2Tuple_SignatureSignatureZ_free(_res_conv);
14683 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
14684 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14685 CHECK_ACCESS(o_ptr);
14686 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
14687 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
14688 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14689 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
14690 return (uint32_t)ret_conv;
14693 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
14694 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14695 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
14696 return (uint32_t)ret_conv;
14699 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
14700 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
14701 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
14705 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
14706 if ((_res & 1) != 0) return;
14707 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14708 CHECK_ACCESS(_res_ptr);
14709 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
14711 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
14714 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
14715 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14716 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
14717 return (uint32_t)ret_conv;
14719 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
14720 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
14721 uint32_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
14725 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
14726 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
14727 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14728 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
14729 return (uint32_t)ret_conv;
14732 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
14733 LDKSecretKey o_ref;
14734 CHECK(o->arr_len == 32);
14735 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
14736 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14737 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
14738 return (uint32_t)ret_conv;
14741 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
14742 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14743 *ret_conv = CResult_SecretKeyNoneZ_err();
14744 return (uint32_t)ret_conv;
14747 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
14748 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
14749 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
14753 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
14754 if ((_res & 1) != 0) return;
14755 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14756 CHECK_ACCESS(_res_ptr);
14757 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
14759 CResult_SecretKeyNoneZ_free(_res_conv);
14762 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
14763 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14764 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
14765 return (uint32_t)ret_conv;
14767 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
14768 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
14769 uint32_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
14773 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
14774 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
14775 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14776 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
14777 return (uint32_t)ret_conv;
14780 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
14781 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14782 CHECK_ACCESS(o_ptr);
14783 LDKSign o_conv = *(LDKSign*)(o_ptr);
14784 if (o_conv.free == LDKSign_JCalls_free) {
14785 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14786 LDKSign_JCalls_cloned(&o_conv);
14788 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14789 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14790 return (uint32_t)ret_conv;
14793 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
14794 LDKDecodeError e_conv;
14795 e_conv.inner = (void*)(e & (~1));
14796 e_conv.is_owned = (e & 1) || (e == 0);
14797 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14798 e_conv = DecodeError_clone(&e_conv);
14799 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14800 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14801 return (uint32_t)ret_conv;
14804 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
14805 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14806 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
14810 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
14811 if ((_res & 1) != 0) return;
14812 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14813 CHECK_ACCESS(_res_ptr);
14814 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14816 CResult_SignDecodeErrorZ_free(_res_conv);
14819 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14820 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14821 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14822 return (uint32_t)ret_conv;
14824 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
14825 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14826 uint32_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14830 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
14831 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14832 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14833 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14834 return (uint32_t)ret_conv;
14837 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
14838 LDKCVec_u5Z _res_constr;
14839 _res_constr.datalen = _res->arr_len;
14840 if (_res_constr.datalen > 0)
14841 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
14843 _res_constr.data = NULL;
14844 int8_t* _res_vals = (void*) _res->elems;
14845 for (size_t h = 0; h < _res_constr.datalen; h++) {
14846 int8_t _res_conv_7 = _res_vals[h];
14848 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
14851 CVec_u5Z_free(_res_constr);
14854 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
14855 LDKRecoverableSignature o_ref;
14856 CHECK(o->arr_len == 68);
14857 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
14858 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14859 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
14860 return (uint32_t)ret_conv;
14863 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14864 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14865 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14866 return (uint32_t)ret_conv;
14869 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
14870 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14871 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14875 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
14876 if ((_res & 1) != 0) return;
14877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14878 CHECK_ACCESS(_res_ptr);
14879 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14881 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14884 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14885 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14886 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14887 return (uint32_t)ret_conv;
14889 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
14890 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14891 uint32_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14895 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
14896 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14897 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14898 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14899 return (uint32_t)ret_conv;
14902 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14903 LDKCVec_u8Z _res_ref;
14904 _res_ref.datalen = _res->arr_len;
14905 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14906 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14907 CVec_u8Z_free(_res_ref);
14910 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
14911 LDKCVec_CVec_u8ZZ _res_constr;
14912 _res_constr.datalen = _res->arr_len;
14913 if (_res_constr.datalen > 0)
14914 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14916 _res_constr.data = NULL;
14917 int8_tArray* _res_vals = (void*) _res->elems;
14918 for (size_t m = 0; m < _res_constr.datalen; m++) {
14919 int8_tArray _res_conv_12 = _res_vals[m];
14920 LDKCVec_u8Z _res_conv_12_ref;
14921 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
14922 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14923 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
14924 _res_constr.data[m] = _res_conv_12_ref;
14927 CVec_CVec_u8ZZ_free(_res_constr);
14930 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
14931 LDKCVec_CVec_u8ZZ o_constr;
14932 o_constr.datalen = o->arr_len;
14933 if (o_constr.datalen > 0)
14934 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14936 o_constr.data = NULL;
14937 int8_tArray* o_vals = (void*) o->elems;
14938 for (size_t m = 0; m < o_constr.datalen; m++) {
14939 int8_tArray o_conv_12 = o_vals[m];
14940 LDKCVec_u8Z o_conv_12_ref;
14941 o_conv_12_ref.datalen = o_conv_12->arr_len;
14942 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14943 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
14944 o_constr.data[m] = o_conv_12_ref;
14947 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14948 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14949 return (uint32_t)ret_conv;
14952 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
14953 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14954 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14955 return (uint32_t)ret_conv;
14958 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
14959 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
14960 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14964 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
14965 if ((_res & 1) != 0) return;
14966 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14967 CHECK_ACCESS(_res_ptr);
14968 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14970 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14973 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14974 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14975 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14976 return (uint32_t)ret_conv;
14978 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
14979 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
14980 uint32_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14984 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
14985 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
14986 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14987 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14988 return (uint32_t)ret_conv;
14991 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
14992 LDKInMemorySigner o_conv;
14993 o_conv.inner = (void*)(o & (~1));
14994 o_conv.is_owned = (o & 1) || (o == 0);
14995 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14996 o_conv = InMemorySigner_clone(&o_conv);
14997 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14998 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
14999 return (uint32_t)ret_conv;
15002 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15003 LDKDecodeError e_conv;
15004 e_conv.inner = (void*)(e & (~1));
15005 e_conv.is_owned = (e & 1) || (e == 0);
15006 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15007 e_conv = DecodeError_clone(&e_conv);
15008 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15009 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15010 return (uint32_t)ret_conv;
15013 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15014 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15015 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15019 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15020 if ((_res & 1) != 0) return;
15021 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15022 CHECK_ACCESS(_res_ptr);
15023 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15025 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15028 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15029 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15030 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15031 return (uint32_t)ret_conv;
15033 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15034 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15035 uint32_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15039 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15040 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15041 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15042 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15043 return (uint32_t)ret_conv;
15046 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15047 LDKCVec_TxOutZ _res_constr;
15048 _res_constr.datalen = _res->arr_len;
15049 if (_res_constr.datalen > 0)
15050 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15052 _res_constr.data = NULL;
15053 uint32_t* _res_vals = _res->elems;
15054 for (size_t h = 0; h < _res_constr.datalen; h++) {
15055 uint32_t _res_conv_7 = _res_vals[h];
15056 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15057 CHECK_ACCESS(_res_conv_7_ptr);
15058 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15059 FREE((void*)_res_conv_7);
15060 _res_constr.data[h] = _res_conv_7_conv;
15063 CVec_TxOutZ_free(_res_constr);
15066 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15067 LDKTransaction o_ref;
15068 o_ref.datalen = o->arr_len;
15069 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15070 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15071 o_ref.data_is_owned = true;
15072 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15073 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15074 return (uint32_t)ret_conv;
15077 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15078 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15079 *ret_conv = CResult_TransactionNoneZ_err();
15080 return (uint32_t)ret_conv;
15083 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15084 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15085 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15089 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15090 if ((_res & 1) != 0) return;
15091 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15092 CHECK_ACCESS(_res_ptr);
15093 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15095 CResult_TransactionNoneZ_free(_res_conv);
15098 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15099 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15100 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15101 return (uint32_t)ret_conv;
15103 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15104 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15105 uint32_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15109 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15110 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15111 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15112 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15113 return (uint32_t)ret_conv;
15116 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15117 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15118 *ret_copy = COption_u16Z_some(o);
15119 uint32_t ret_ref = (uintptr_t)ret_copy;
15123 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15124 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15125 *ret_copy = COption_u16Z_none();
15126 uint32_t ret_ref = (uintptr_t)ret_copy;
15130 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
15131 if ((_res & 1) != 0) return;
15132 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15133 CHECK_ACCESS(_res_ptr);
15134 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15136 COption_u16Z_free(_res_conv);
15139 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15140 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15141 *ret_copy = COption_u16Z_clone(arg);
15142 uint32_t ret_ref = (uintptr_t)ret_copy;
15145 uint32_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15146 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15147 uint32_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15151 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
15152 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15153 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15154 *ret_copy = COption_u16Z_clone(orig_conv);
15155 uint32_t ret_ref = (uintptr_t)ret_copy;
15159 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15160 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15161 *ret_conv = CResult_NoneAPIErrorZ_ok();
15162 return (uint32_t)ret_conv;
15165 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15166 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15167 CHECK_ACCESS(e_ptr);
15168 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15169 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15170 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15171 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15172 return (uint32_t)ret_conv;
15175 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15176 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15177 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15181 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15182 if ((_res & 1) != 0) return;
15183 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15184 CHECK_ACCESS(_res_ptr);
15185 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15187 CResult_NoneAPIErrorZ_free(_res_conv);
15190 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15191 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15192 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15193 return (uint32_t)ret_conv;
15195 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15196 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15197 uint32_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15201 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15202 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15203 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15204 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15205 return (uint32_t)ret_conv;
15208 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15209 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15210 _res_constr.datalen = _res->arr_len;
15211 if (_res_constr.datalen > 0)
15212 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15214 _res_constr.data = NULL;
15215 uint32_t* _res_vals = _res->elems;
15216 for (size_t w = 0; w < _res_constr.datalen; w++) {
15217 uint32_t _res_conv_22 = _res_vals[w];
15218 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
15219 CHECK_ACCESS(_res_conv_22_ptr);
15220 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15221 FREE((void*)_res_conv_22);
15222 _res_constr.data[w] = _res_conv_22_conv;
15225 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15228 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15229 LDKCVec_APIErrorZ _res_constr;
15230 _res_constr.datalen = _res->arr_len;
15231 if (_res_constr.datalen > 0)
15232 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15234 _res_constr.data = NULL;
15235 uint32_t* _res_vals = _res->elems;
15236 for (size_t k = 0; k < _res_constr.datalen; k++) {
15237 uint32_t _res_conv_10 = _res_vals[k];
15238 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
15239 CHECK_ACCESS(_res_conv_10_ptr);
15240 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15241 FREE((void*)_res_conv_10);
15242 _res_constr.data[k] = _res_conv_10_conv;
15245 CVec_APIErrorZ_free(_res_constr);
15248 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15249 LDKThirtyTwoBytes o_ref;
15250 CHECK(o->arr_len == 32);
15251 memcpy(o_ref.data, o->elems, 32); FREE(o);
15252 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15253 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15254 return (uint32_t)ret_conv;
15257 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15258 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15259 CHECK_ACCESS(e_ptr);
15260 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15261 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15262 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15263 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15264 return (uint32_t)ret_conv;
15267 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15268 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15269 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15273 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15274 if ((_res & 1) != 0) return;
15275 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15276 CHECK_ACCESS(_res_ptr);
15277 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15279 CResult__u832APIErrorZ_free(_res_conv);
15282 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15283 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15284 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15285 return (uint32_t)ret_conv;
15287 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15288 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15289 uint32_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15293 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15294 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15295 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15296 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15297 return (uint32_t)ret_conv;
15300 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15301 LDKThirtyTwoBytes o_ref;
15302 CHECK(o->arr_len == 32);
15303 memcpy(o_ref.data, o->elems, 32); FREE(o);
15304 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15305 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15306 return (uint32_t)ret_conv;
15309 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15310 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15311 CHECK_ACCESS(e_ptr);
15312 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15313 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15314 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15315 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15316 return (uint32_t)ret_conv;
15319 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15320 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15321 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15325 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15326 if ((_res & 1) != 0) return;
15327 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15328 CHECK_ACCESS(_res_ptr);
15329 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15331 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15334 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15335 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15336 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15337 return (uint32_t)ret_conv;
15339 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15340 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15341 uint32_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15345 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15346 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15347 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15348 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15349 return (uint32_t)ret_conv;
15352 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15353 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15354 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15355 return (uint32_t)ret_conv;
15358 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15359 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15360 CHECK_ACCESS(e_ptr);
15361 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15362 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15363 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15364 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15365 return (uint32_t)ret_conv;
15368 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15369 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15370 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15374 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15375 if ((_res & 1) != 0) return;
15376 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15377 CHECK_ACCESS(_res_ptr);
15378 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15380 CResult_NonePaymentSendFailureZ_free(_res_conv);
15383 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15384 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15385 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15386 return (uint32_t)ret_conv;
15388 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15389 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15390 uint32_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15394 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15395 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15396 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15397 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15398 return (uint32_t)ret_conv;
15401 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15402 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15403 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15404 return ((uint32_t)ret_conv);
15406 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15407 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15408 uint32_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15412 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15413 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15414 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15415 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15416 return ((uint32_t)ret_conv);
15419 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15420 LDKThirtyTwoBytes a_ref;
15421 CHECK(a->arr_len == 32);
15422 memcpy(a_ref.data, a->elems, 32); FREE(a);
15423 LDKThirtyTwoBytes b_ref;
15424 CHECK(b->arr_len == 32);
15425 memcpy(b_ref.data, b->elems, 32); FREE(b);
15426 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15427 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15428 return ((uint32_t)ret_conv);
15431 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15432 if ((_res & 1) != 0) return;
15433 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15434 CHECK_ACCESS(_res_ptr);
15435 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15437 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15440 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15441 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15442 CHECK_ACCESS(o_ptr);
15443 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15444 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
15445 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15446 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15447 return (uint32_t)ret_conv;
15450 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15451 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15452 CHECK_ACCESS(e_ptr);
15453 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15454 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
15455 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15456 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15457 return (uint32_t)ret_conv;
15460 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15461 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15462 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15466 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15467 if ((_res & 1) != 0) return;
15468 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15469 CHECK_ACCESS(_res_ptr);
15470 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15472 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15475 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15476 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15477 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15478 return (uint32_t)ret_conv;
15480 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15481 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15482 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15486 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15487 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15488 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15489 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15490 return (uint32_t)ret_conv;
15493 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15494 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15495 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15496 return ((uint32_t)ret_conv);
15498 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15499 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15500 uint32_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15504 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15505 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15506 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15507 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15508 return ((uint32_t)ret_conv);
15511 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15512 LDKThirtyTwoBytes a_ref;
15513 CHECK(a->arr_len == 32);
15514 memcpy(a_ref.data, a->elems, 32); FREE(a);
15515 LDKThirtyTwoBytes b_ref;
15516 CHECK(b->arr_len == 32);
15517 memcpy(b_ref.data, b->elems, 32); FREE(b);
15518 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15519 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15520 return ((uint32_t)ret_conv);
15523 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15524 if ((_res & 1) != 0) return;
15525 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15526 CHECK_ACCESS(_res_ptr);
15527 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15529 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15532 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
15533 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15534 CHECK_ACCESS(o_ptr);
15535 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15536 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15537 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15538 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15539 return (uint32_t)ret_conv;
15542 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15543 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15544 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15545 return (uint32_t)ret_conv;
15548 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
15549 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15550 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15554 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
15555 if ((_res & 1) != 0) return;
15556 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15557 CHECK_ACCESS(_res_ptr);
15558 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15560 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15563 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15564 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15565 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15566 return (uint32_t)ret_conv;
15568 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
15569 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15570 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15574 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
15575 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15576 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15577 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15578 return (uint32_t)ret_conv;
15581 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
15582 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15583 CHECK_ACCESS(o_ptr);
15584 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15585 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
15586 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15587 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15588 return (uint32_t)ret_conv;
15591 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
15592 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15593 CHECK_ACCESS(e_ptr);
15594 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15595 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15596 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15597 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15598 return (uint32_t)ret_conv;
15601 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
15602 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15603 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15607 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15613 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15616 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15617 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15618 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15619 return (uint32_t)ret_conv;
15621 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
15622 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15623 uint32_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15627 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
15628 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15629 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15630 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15631 return (uint32_t)ret_conv;
15634 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_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_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15639 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15640 return (uint32_t)ret_conv;
15643 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
15644 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15645 *ret_conv = CResult_PaymentSecretNoneZ_err();
15646 return (uint32_t)ret_conv;
15649 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
15650 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15651 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15655 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
15656 if ((_res & 1) != 0) return;
15657 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15658 CHECK_ACCESS(_res_ptr);
15659 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15661 CResult_PaymentSecretNoneZ_free(_res_conv);
15664 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15665 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15666 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15667 return (uint32_t)ret_conv;
15669 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
15670 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15671 uint32_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15675 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
15676 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15677 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15678 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15679 return (uint32_t)ret_conv;
15682 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15683 LDKThirtyTwoBytes o_ref;
15684 CHECK(o->arr_len == 32);
15685 memcpy(o_ref.data, o->elems, 32); FREE(o);
15686 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15687 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15688 return (uint32_t)ret_conv;
15691 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
15692 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15693 CHECK_ACCESS(e_ptr);
15694 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15695 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15696 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15697 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15698 return (uint32_t)ret_conv;
15701 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
15702 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15703 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15707 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
15708 if ((_res & 1) != 0) return;
15709 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15710 CHECK_ACCESS(_res_ptr);
15711 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15713 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15716 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15717 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15718 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15719 return (uint32_t)ret_conv;
15721 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
15722 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15723 uint32_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15727 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
15728 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15729 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15730 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15731 return (uint32_t)ret_conv;
15734 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15735 LDKThirtyTwoBytes o_ref;
15736 CHECK(o->arr_len == 32);
15737 memcpy(o_ref.data, o->elems, 32); FREE(o);
15738 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15739 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15740 return (uint32_t)ret_conv;
15743 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
15744 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
15745 CHECK_ACCESS(e_ptr);
15746 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15747 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
15748 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15749 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15750 return (uint32_t)ret_conv;
15753 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
15754 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15755 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15759 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
15760 if ((_res & 1) != 0) return;
15761 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15762 CHECK_ACCESS(_res_ptr);
15763 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15765 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15768 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15769 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15770 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15771 return (uint32_t)ret_conv;
15773 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
15774 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15775 uint32_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15779 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
15780 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15781 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15782 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15783 return (uint32_t)ret_conv;
15786 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
15787 LDKCounterpartyForwardingInfo o_conv;
15788 o_conv.inner = (void*)(o & (~1));
15789 o_conv.is_owned = (o & 1) || (o == 0);
15790 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15791 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
15792 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15793 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
15794 return (uint32_t)ret_conv;
15797 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
15798 LDKDecodeError e_conv;
15799 e_conv.inner = (void*)(e & (~1));
15800 e_conv.is_owned = (e & 1) || (e == 0);
15801 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15802 e_conv = DecodeError_clone(&e_conv);
15803 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15804 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
15805 return (uint32_t)ret_conv;
15808 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
15809 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
15810 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
15814 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
15815 if ((_res & 1) != 0) return;
15816 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15817 CHECK_ACCESS(_res_ptr);
15818 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
15820 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
15823 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
15824 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15825 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
15826 return (uint32_t)ret_conv;
15828 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
15829 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
15830 uint32_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
15834 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
15835 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
15836 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15837 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
15838 return (uint32_t)ret_conv;
15841 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
15842 LDKChannelCounterparty o_conv;
15843 o_conv.inner = (void*)(o & (~1));
15844 o_conv.is_owned = (o & 1) || (o == 0);
15845 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15846 o_conv = ChannelCounterparty_clone(&o_conv);
15847 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15848 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
15849 return (uint32_t)ret_conv;
15852 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
15853 LDKDecodeError e_conv;
15854 e_conv.inner = (void*)(e & (~1));
15855 e_conv.is_owned = (e & 1) || (e == 0);
15856 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15857 e_conv = DecodeError_clone(&e_conv);
15858 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15859 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
15860 return (uint32_t)ret_conv;
15863 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
15864 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
15865 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
15869 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
15870 if ((_res & 1) != 0) return;
15871 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15872 CHECK_ACCESS(_res_ptr);
15873 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
15875 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
15878 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
15879 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15880 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
15881 return (uint32_t)ret_conv;
15883 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
15884 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
15885 uint32_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
15889 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
15890 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
15891 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15892 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
15893 return (uint32_t)ret_conv;
15896 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
15897 LDKChannelDetails o_conv;
15898 o_conv.inner = (void*)(o & (~1));
15899 o_conv.is_owned = (o & 1) || (o == 0);
15900 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15901 o_conv = ChannelDetails_clone(&o_conv);
15902 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15903 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
15904 return (uint32_t)ret_conv;
15907 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
15908 LDKDecodeError e_conv;
15909 e_conv.inner = (void*)(e & (~1));
15910 e_conv.is_owned = (e & 1) || (e == 0);
15911 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15912 e_conv = DecodeError_clone(&e_conv);
15913 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15914 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
15915 return (uint32_t)ret_conv;
15918 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
15919 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
15920 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
15924 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
15925 if ((_res & 1) != 0) return;
15926 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15927 CHECK_ACCESS(_res_ptr);
15928 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
15930 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
15933 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
15934 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15935 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
15936 return (uint32_t)ret_conv;
15938 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
15939 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
15940 uint32_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
15944 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
15945 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
15946 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15947 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
15948 return (uint32_t)ret_conv;
15951 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
15952 LDKPhantomRouteHints o_conv;
15953 o_conv.inner = (void*)(o & (~1));
15954 o_conv.is_owned = (o & 1) || (o == 0);
15955 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15956 o_conv = PhantomRouteHints_clone(&o_conv);
15957 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15958 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
15959 return (uint32_t)ret_conv;
15962 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
15963 LDKDecodeError e_conv;
15964 e_conv.inner = (void*)(e & (~1));
15965 e_conv.is_owned = (e & 1) || (e == 0);
15966 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15967 e_conv = DecodeError_clone(&e_conv);
15968 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15969 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
15970 return (uint32_t)ret_conv;
15973 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
15974 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
15975 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
15979 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
15980 if ((_res & 1) != 0) return;
15981 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15982 CHECK_ACCESS(_res_ptr);
15983 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
15985 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
15988 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
15989 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15990 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
15991 return (uint32_t)ret_conv;
15993 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
15994 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
15995 uint32_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
15999 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
16000 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
16001 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16002 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16003 return (uint32_t)ret_conv;
16006 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
16007 LDKCVec_ChannelMonitorZ _res_constr;
16008 _res_constr.datalen = _res->arr_len;
16009 if (_res_constr.datalen > 0)
16010 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16012 _res_constr.data = NULL;
16013 uint32_t* _res_vals = _res->elems;
16014 for (size_t q = 0; q < _res_constr.datalen; q++) {
16015 uint32_t _res_conv_16 = _res_vals[q];
16016 LDKChannelMonitor _res_conv_16_conv;
16017 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16018 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16019 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16020 _res_constr.data[q] = _res_conv_16_conv;
16023 CVec_ChannelMonitorZ_free(_res_constr);
16026 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
16027 LDKThirtyTwoBytes a_ref;
16028 CHECK(a->arr_len == 32);
16029 memcpy(a_ref.data, a->elems, 32); FREE(a);
16030 LDKChannelManager b_conv;
16031 b_conv.inner = (void*)(b & (~1));
16032 b_conv.is_owned = (b & 1) || (b == 0);
16033 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16034 // WARNING: we need a move here but no clone is available for LDKChannelManager
16035 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16036 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16037 return ((uint32_t)ret_conv);
16040 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
16041 if ((_res & 1) != 0) return;
16042 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16043 CHECK_ACCESS(_res_ptr);
16044 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16046 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16049 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
16050 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16051 CHECK_ACCESS(o_ptr);
16052 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16053 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16054 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16055 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16056 return (uint32_t)ret_conv;
16059 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16060 LDKDecodeError e_conv;
16061 e_conv.inner = (void*)(e & (~1));
16062 e_conv.is_owned = (e & 1) || (e == 0);
16063 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16064 e_conv = DecodeError_clone(&e_conv);
16065 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16066 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16067 return (uint32_t)ret_conv;
16070 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16071 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16072 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16076 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16077 if ((_res & 1) != 0) return;
16078 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16079 CHECK_ACCESS(_res_ptr);
16080 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16082 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16085 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
16086 LDKChannelConfig o_conv;
16087 o_conv.inner = (void*)(o & (~1));
16088 o_conv.is_owned = (o & 1) || (o == 0);
16089 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16090 o_conv = ChannelConfig_clone(&o_conv);
16091 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16092 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16093 return (uint32_t)ret_conv;
16096 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
16097 LDKDecodeError e_conv;
16098 e_conv.inner = (void*)(e & (~1));
16099 e_conv.is_owned = (e & 1) || (e == 0);
16100 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16101 e_conv = DecodeError_clone(&e_conv);
16102 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16103 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16104 return (uint32_t)ret_conv;
16107 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
16108 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
16109 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16113 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
16114 if ((_res & 1) != 0) return;
16115 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16116 CHECK_ACCESS(_res_ptr);
16117 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16119 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16122 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16123 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16124 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16125 return (uint32_t)ret_conv;
16127 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
16128 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
16129 uint32_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16133 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
16134 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
16135 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16136 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16137 return (uint32_t)ret_conv;
16140 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
16141 LDKOutPoint o_conv;
16142 o_conv.inner = (void*)(o & (~1));
16143 o_conv.is_owned = (o & 1) || (o == 0);
16144 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16145 o_conv = OutPoint_clone(&o_conv);
16146 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16147 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16148 return (uint32_t)ret_conv;
16151 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
16152 LDKDecodeError e_conv;
16153 e_conv.inner = (void*)(e & (~1));
16154 e_conv.is_owned = (e & 1) || (e == 0);
16155 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16156 e_conv = DecodeError_clone(&e_conv);
16157 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16158 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16159 return (uint32_t)ret_conv;
16162 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
16163 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
16164 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16168 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
16169 if ((_res & 1) != 0) return;
16170 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16171 CHECK_ACCESS(_res_ptr);
16172 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16174 CResult_OutPointDecodeErrorZ_free(_res_conv);
16177 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16178 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16179 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16180 return (uint32_t)ret_conv;
16182 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
16183 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
16184 uint32_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16188 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
16189 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
16190 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16191 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16192 return (uint32_t)ret_conv;
16195 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
16196 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16197 CHECK_ACCESS(o_ptr);
16198 LDKType o_conv = *(LDKType*)(o_ptr);
16199 if (o_conv.free == LDKType_JCalls_free) {
16200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16201 LDKType_JCalls_cloned(&o_conv);
16203 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16204 *ret_copy = COption_TypeZ_some(o_conv);
16205 uint32_t ret_ref = (uintptr_t)ret_copy;
16209 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16210 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16211 *ret_copy = COption_TypeZ_none();
16212 uint32_t ret_ref = (uintptr_t)ret_copy;
16216 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
16217 if ((_res & 1) != 0) return;
16218 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16219 CHECK_ACCESS(_res_ptr);
16220 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16222 COption_TypeZ_free(_res_conv);
16225 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16226 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16227 *ret_copy = COption_TypeZ_clone(arg);
16228 uint32_t ret_ref = (uintptr_t)ret_copy;
16231 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
16232 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
16233 uint32_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16237 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
16238 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
16239 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16240 *ret_copy = COption_TypeZ_clone(orig_conv);
16241 uint32_t ret_ref = (uintptr_t)ret_copy;
16245 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
16246 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16247 CHECK_ACCESS(o_ptr);
16248 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16249 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
16250 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16251 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16252 return (uint32_t)ret_conv;
16255 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
16256 LDKDecodeError e_conv;
16257 e_conv.inner = (void*)(e & (~1));
16258 e_conv.is_owned = (e & 1) || (e == 0);
16259 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16260 e_conv = DecodeError_clone(&e_conv);
16261 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16262 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16263 return (uint32_t)ret_conv;
16266 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
16267 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
16268 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16272 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
16273 if ((_res & 1) != 0) return;
16274 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16275 CHECK_ACCESS(_res_ptr);
16276 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16278 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16281 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16282 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16283 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16284 return (uint32_t)ret_conv;
16286 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
16287 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
16288 uint32_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16292 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
16293 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
16294 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16295 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16296 return (uint32_t)ret_conv;
16299 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16300 LDKThirtyTwoBytes o_ref;
16301 CHECK(o->arr_len == 32);
16302 memcpy(o_ref.data, o->elems, 32); FREE(o);
16303 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16304 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16305 return (uint32_t)ret_conv;
16308 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
16309 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16310 CHECK_ACCESS(e_ptr);
16311 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16312 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
16313 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16314 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16315 return (uint32_t)ret_conv;
16318 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
16319 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
16320 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16324 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
16325 if ((_res & 1) != 0) return;
16326 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16327 CHECK_ACCESS(_res_ptr);
16328 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16330 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16333 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16334 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16335 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16336 return (uint32_t)ret_conv;
16338 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
16339 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
16340 uint32_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16344 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
16345 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
16346 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16347 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16348 return (uint32_t)ret_conv;
16351 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
16352 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
16353 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16354 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
16355 return (uint32_t)ret_conv;
16358 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint32_t e) {
16359 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16360 CHECK_ACCESS(e_ptr);
16361 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16362 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16363 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16364 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
16365 return (uint32_t)ret_conv;
16368 jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint32_t o) {
16369 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
16370 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
16374 void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint32_t _res) {
16375 if ((_res & 1) != 0) return;
16376 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16377 CHECK_ACCESS(_res_ptr);
16378 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
16380 CResult_SiPrefixParseErrorZ_free(_res_conv);
16383 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
16384 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16385 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
16386 return (uint32_t)ret_conv;
16388 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint32_t arg) {
16389 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
16390 uint32_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
16394 uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint32_t orig) {
16395 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
16396 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
16397 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
16398 return (uint32_t)ret_conv;
16401 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint32_t o) {
16403 o_conv.inner = (void*)(o & (~1));
16404 o_conv.is_owned = (o & 1) || (o == 0);
16405 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16406 o_conv = Invoice_clone(&o_conv);
16407 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16408 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
16409 return (uint32_t)ret_conv;
16412 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint32_t e) {
16413 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16414 CHECK_ACCESS(e_ptr);
16415 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
16416 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
16417 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16418 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
16419 return (uint32_t)ret_conv;
16422 jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint32_t o) {
16423 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
16424 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
16428 void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint32_t _res) {
16429 if ((_res & 1) != 0) return;
16430 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16431 CHECK_ACCESS(_res_ptr);
16432 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
16434 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
16437 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
16438 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16439 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
16440 return (uint32_t)ret_conv;
16442 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint32_t arg) {
16443 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
16444 uint32_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
16448 uint32_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint32_t orig) {
16449 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
16450 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16451 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
16452 return (uint32_t)ret_conv;
16455 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint32_t o) {
16456 LDKSignedRawInvoice o_conv;
16457 o_conv.inner = (void*)(o & (~1));
16458 o_conv.is_owned = (o & 1) || (o == 0);
16459 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16460 o_conv = SignedRawInvoice_clone(&o_conv);
16461 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16462 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
16463 return (uint32_t)ret_conv;
16466 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint32_t e) {
16467 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16468 CHECK_ACCESS(e_ptr);
16469 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16470 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
16471 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16472 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
16473 return (uint32_t)ret_conv;
16476 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint32_t o) {
16477 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
16478 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
16482 void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint32_t _res) {
16483 if ((_res & 1) != 0) return;
16484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16485 CHECK_ACCESS(_res_ptr);
16486 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
16488 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
16491 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
16492 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16493 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
16494 return (uint32_t)ret_conv;
16496 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint32_t arg) {
16497 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
16498 uint32_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
16502 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint32_t orig) {
16503 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
16504 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16505 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
16506 return (uint32_t)ret_conv;
16509 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
16510 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16511 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
16512 return ((uint32_t)ret_conv);
16514 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
16515 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
16516 uint32_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
16520 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
16521 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
16522 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16523 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
16524 return ((uint32_t)ret_conv);
16527 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
16528 LDKRawInvoice a_conv;
16529 a_conv.inner = (void*)(a & (~1));
16530 a_conv.is_owned = (a & 1) || (a == 0);
16531 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16532 a_conv = RawInvoice_clone(&a_conv);
16533 LDKThirtyTwoBytes b_ref;
16534 CHECK(b->arr_len == 32);
16535 memcpy(b_ref.data, b->elems, 32); FREE(b);
16536 LDKInvoiceSignature c_conv;
16537 c_conv.inner = (void*)(c & (~1));
16538 c_conv.is_owned = (c & 1) || (c == 0);
16539 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16540 c_conv = InvoiceSignature_clone(&c_conv);
16541 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16542 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
16543 return ((uint32_t)ret_conv);
16546 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
16547 if ((_res & 1) != 0) return;
16548 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16549 CHECK_ACCESS(_res_ptr);
16550 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
16552 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
16555 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
16556 LDKPayeePubKey o_conv;
16557 o_conv.inner = (void*)(o & (~1));
16558 o_conv.is_owned = (o & 1) || (o == 0);
16559 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16560 o_conv = PayeePubKey_clone(&o_conv);
16561 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16562 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
16563 return (uint32_t)ret_conv;
16566 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
16567 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16568 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16569 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
16570 return (uint32_t)ret_conv;
16573 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
16574 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
16575 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
16579 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
16580 if ((_res & 1) != 0) return;
16581 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16582 CHECK_ACCESS(_res_ptr);
16583 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
16585 CResult_PayeePubKeyErrorZ_free(_res_conv);
16588 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
16589 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16590 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
16591 return (uint32_t)ret_conv;
16593 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
16594 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
16595 uint32_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
16599 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
16600 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
16601 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16602 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
16603 return (uint32_t)ret_conv;
16606 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
16607 LDKCVec_PrivateRouteZ _res_constr;
16608 _res_constr.datalen = _res->arr_len;
16609 if (_res_constr.datalen > 0)
16610 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
16612 _res_constr.data = NULL;
16613 uint32_t* _res_vals = _res->elems;
16614 for (size_t o = 0; o < _res_constr.datalen; o++) {
16615 uint32_t _res_conv_14 = _res_vals[o];
16616 LDKPrivateRoute _res_conv_14_conv;
16617 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
16618 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
16619 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16620 _res_constr.data[o] = _res_conv_14_conv;
16623 CVec_PrivateRouteZ_free(_res_constr);
16626 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
16627 LDKPositiveTimestamp o_conv;
16628 o_conv.inner = (void*)(o & (~1));
16629 o_conv.is_owned = (o & 1) || (o == 0);
16630 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16631 o_conv = PositiveTimestamp_clone(&o_conv);
16632 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16633 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
16634 return (uint32_t)ret_conv;
16637 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
16638 LDKCreationError e_conv = LDKCreationError_from_js(e);
16639 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16640 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
16641 return (uint32_t)ret_conv;
16644 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
16645 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
16646 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
16650 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
16651 if ((_res & 1) != 0) return;
16652 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16653 CHECK_ACCESS(_res_ptr);
16654 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
16656 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
16659 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
16660 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16661 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
16662 return (uint32_t)ret_conv;
16664 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
16665 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
16666 uint32_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
16670 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
16671 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
16672 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16673 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16674 return (uint32_t)ret_conv;
16677 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
16678 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16679 *ret_conv = CResult_NoneSemanticErrorZ_ok();
16680 return (uint32_t)ret_conv;
16683 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
16684 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16685 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16686 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16687 return (uint32_t)ret_conv;
16690 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
16691 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
16692 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16696 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
16697 if ((_res & 1) != 0) return;
16698 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16699 CHECK_ACCESS(_res_ptr);
16700 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16702 CResult_NoneSemanticErrorZ_free(_res_conv);
16705 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16706 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16707 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16708 return (uint32_t)ret_conv;
16710 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
16711 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
16712 uint32_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16716 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
16717 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
16718 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16719 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16720 return (uint32_t)ret_conv;
16723 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
16725 o_conv.inner = (void*)(o & (~1));
16726 o_conv.is_owned = (o & 1) || (o == 0);
16727 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16728 o_conv = Invoice_clone(&o_conv);
16729 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16730 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16731 return (uint32_t)ret_conv;
16734 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
16735 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16736 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16737 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16738 return (uint32_t)ret_conv;
16741 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
16742 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
16743 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16747 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
16748 if ((_res & 1) != 0) return;
16749 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16750 CHECK_ACCESS(_res_ptr);
16751 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16753 CResult_InvoiceSemanticErrorZ_free(_res_conv);
16756 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16757 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16758 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16759 return (uint32_t)ret_conv;
16761 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
16762 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
16763 uint32_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16767 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
16768 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
16769 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16770 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16771 return (uint32_t)ret_conv;
16774 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
16775 LDKDescription o_conv;
16776 o_conv.inner = (void*)(o & (~1));
16777 o_conv.is_owned = (o & 1) || (o == 0);
16778 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16779 o_conv = Description_clone(&o_conv);
16780 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16781 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16782 return (uint32_t)ret_conv;
16785 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
16786 LDKCreationError e_conv = LDKCreationError_from_js(e);
16787 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16788 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16789 return (uint32_t)ret_conv;
16792 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
16793 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
16794 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16798 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
16799 if ((_res & 1) != 0) return;
16800 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16801 CHECK_ACCESS(_res_ptr);
16802 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16804 CResult_DescriptionCreationErrorZ_free(_res_conv);
16807 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16808 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16809 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16810 return (uint32_t)ret_conv;
16812 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
16813 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
16814 uint32_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16818 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
16819 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
16820 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16821 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16822 return (uint32_t)ret_conv;
16825 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
16826 LDKPrivateRoute o_conv;
16827 o_conv.inner = (void*)(o & (~1));
16828 o_conv.is_owned = (o & 1) || (o == 0);
16829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16830 o_conv = PrivateRoute_clone(&o_conv);
16831 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16832 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16833 return (uint32_t)ret_conv;
16836 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
16837 LDKCreationError e_conv = LDKCreationError_from_js(e);
16838 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16839 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16840 return (uint32_t)ret_conv;
16843 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
16844 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
16845 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16849 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
16850 if ((_res & 1) != 0) return;
16851 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16852 CHECK_ACCESS(_res_ptr);
16853 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16855 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16858 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16859 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16860 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16861 return (uint32_t)ret_conv;
16863 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
16864 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
16865 uint32_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16869 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
16870 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
16871 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16872 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16873 return (uint32_t)ret_conv;
16876 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
16877 LDKStr o_conv = str_ref_to_owned_c(o);
16878 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16879 *ret_conv = CResult_StringErrorZ_ok(o_conv);
16880 return (uint32_t)ret_conv;
16883 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
16884 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16885 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16886 *ret_conv = CResult_StringErrorZ_err(e_conv);
16887 return (uint32_t)ret_conv;
16890 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
16891 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
16892 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
16896 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
16897 if ((_res & 1) != 0) return;
16898 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16899 CHECK_ACCESS(_res_ptr);
16900 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16902 CResult_StringErrorZ_free(_res_conv);
16905 static inline uintptr_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
16906 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16907 *ret_conv = CResult_StringErrorZ_clone(arg);
16908 return (uint32_t)ret_conv;
16910 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint32_t arg) {
16911 LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)(arg & ~1);
16912 uint32_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
16916 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint32_t orig) {
16917 LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)(orig & ~1);
16918 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16919 *ret_conv = CResult_StringErrorZ_clone(orig_conv);
16920 return (uint32_t)ret_conv;
16923 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
16924 LDKChannelMonitorUpdate o_conv;
16925 o_conv.inner = (void*)(o & (~1));
16926 o_conv.is_owned = (o & 1) || (o == 0);
16927 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16928 o_conv = ChannelMonitorUpdate_clone(&o_conv);
16929 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16930 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16931 return (uint32_t)ret_conv;
16934 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
16935 LDKDecodeError e_conv;
16936 e_conv.inner = (void*)(e & (~1));
16937 e_conv.is_owned = (e & 1) || (e == 0);
16938 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16939 e_conv = DecodeError_clone(&e_conv);
16940 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16941 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16942 return (uint32_t)ret_conv;
16945 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
16946 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
16947 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16951 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
16952 if ((_res & 1) != 0) return;
16953 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16954 CHECK_ACCESS(_res_ptr);
16955 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16957 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16960 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16961 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16962 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16963 return (uint32_t)ret_conv;
16965 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
16966 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
16967 uint32_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16971 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
16972 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
16973 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16974 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16975 return (uint32_t)ret_conv;
16978 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
16979 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16980 CHECK_ACCESS(o_ptr);
16981 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16982 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
16983 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16984 *ret_copy = COption_MonitorEventZ_some(o_conv);
16985 uint32_t ret_ref = (uintptr_t)ret_copy;
16989 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
16990 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16991 *ret_copy = COption_MonitorEventZ_none();
16992 uint32_t ret_ref = (uintptr_t)ret_copy;
16996 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
16997 if ((_res & 1) != 0) return;
16998 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16999 CHECK_ACCESS(_res_ptr);
17000 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17002 COption_MonitorEventZ_free(_res_conv);
17005 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17006 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17007 *ret_copy = COption_MonitorEventZ_clone(arg);
17008 uint32_t ret_ref = (uintptr_t)ret_copy;
17011 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
17012 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
17013 uint32_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17017 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
17018 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
17019 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17020 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17021 uint32_t ret_ref = (uintptr_t)ret_copy;
17025 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
17026 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17027 CHECK_ACCESS(o_ptr);
17028 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17029 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
17030 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17031 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17032 return (uint32_t)ret_conv;
17035 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
17036 LDKDecodeError e_conv;
17037 e_conv.inner = (void*)(e & (~1));
17038 e_conv.is_owned = (e & 1) || (e == 0);
17039 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17040 e_conv = DecodeError_clone(&e_conv);
17041 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17042 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17043 return (uint32_t)ret_conv;
17046 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
17047 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
17048 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17052 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
17053 if ((_res & 1) != 0) return;
17054 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17055 CHECK_ACCESS(_res_ptr);
17056 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17058 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17061 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17062 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17063 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17064 return (uint32_t)ret_conv;
17066 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
17067 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
17068 uint32_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17072 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
17073 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
17074 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17075 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17076 return (uint32_t)ret_conv;
17079 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
17080 LDKHTLCUpdate o_conv;
17081 o_conv.inner = (void*)(o & (~1));
17082 o_conv.is_owned = (o & 1) || (o == 0);
17083 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17084 o_conv = HTLCUpdate_clone(&o_conv);
17085 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17086 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17087 return (uint32_t)ret_conv;
17090 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
17091 LDKDecodeError e_conv;
17092 e_conv.inner = (void*)(e & (~1));
17093 e_conv.is_owned = (e & 1) || (e == 0);
17094 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17095 e_conv = DecodeError_clone(&e_conv);
17096 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17097 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17098 return (uint32_t)ret_conv;
17101 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
17102 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
17103 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17107 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
17108 if ((_res & 1) != 0) return;
17109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17110 CHECK_ACCESS(_res_ptr);
17111 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17113 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17116 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17117 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17118 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17119 return (uint32_t)ret_conv;
17121 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
17122 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
17123 uint32_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17127 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
17128 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
17129 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17130 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17131 return (uint32_t)ret_conv;
17134 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17135 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17136 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17137 return ((uint32_t)ret_conv);
17139 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
17140 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
17141 uint32_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17145 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
17146 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
17147 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17148 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17149 return ((uint32_t)ret_conv);
17152 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
17153 LDKOutPoint a_conv;
17154 a_conv.inner = (void*)(a & (~1));
17155 a_conv.is_owned = (a & 1) || (a == 0);
17156 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17157 a_conv = OutPoint_clone(&a_conv);
17159 b_ref.datalen = b->arr_len;
17160 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17161 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17162 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17163 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17164 return ((uint32_t)ret_conv);
17167 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
17168 if ((_res & 1) != 0) return;
17169 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17170 CHECK_ACCESS(_res_ptr);
17171 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17173 C2Tuple_OutPointScriptZ_free(_res_conv);
17176 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17177 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17178 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17179 return ((uint32_t)ret_conv);
17181 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
17182 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
17183 uint32_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17187 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
17188 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
17189 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17190 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17191 return ((uint32_t)ret_conv);
17194 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17196 b_ref.datalen = b->arr_len;
17197 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17198 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17199 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17200 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17201 return ((uint32_t)ret_conv);
17204 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
17205 if ((_res & 1) != 0) return;
17206 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17207 CHECK_ACCESS(_res_ptr);
17208 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17210 C2Tuple_u32ScriptZ_free(_res_conv);
17213 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
17214 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17215 _res_constr.datalen = _res->arr_len;
17216 if (_res_constr.datalen > 0)
17217 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17219 _res_constr.data = NULL;
17220 uint32_t* _res_vals = _res->elems;
17221 for (size_t v = 0; v < _res_constr.datalen; v++) {
17222 uint32_t _res_conv_21 = _res_vals[v];
17223 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
17224 CHECK_ACCESS(_res_conv_21_ptr);
17225 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17226 FREE((void*)_res_conv_21);
17227 _res_constr.data[v] = _res_conv_21_conv;
17230 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17233 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17234 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17235 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17236 return ((uint32_t)ret_conv);
17238 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
17239 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
17240 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17244 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
17245 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
17246 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17247 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17248 return ((uint32_t)ret_conv);
17251 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
17252 LDKThirtyTwoBytes a_ref;
17253 CHECK(a->arr_len == 32);
17254 memcpy(a_ref.data, a->elems, 32); FREE(a);
17255 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17256 b_constr.datalen = b->arr_len;
17257 if (b_constr.datalen > 0)
17258 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17260 b_constr.data = NULL;
17261 uint32_t* b_vals = b->elems;
17262 for (size_t v = 0; v < b_constr.datalen; v++) {
17263 uint32_t b_conv_21 = b_vals[v];
17264 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
17265 CHECK_ACCESS(b_conv_21_ptr);
17266 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17267 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
17268 b_constr.data[v] = b_conv_21_conv;
17271 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17272 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17273 return ((uint32_t)ret_conv);
17276 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
17277 if ((_res & 1) != 0) return;
17278 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17279 CHECK_ACCESS(_res_ptr);
17280 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17282 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17285 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
17286 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17287 _res_constr.datalen = _res->arr_len;
17288 if (_res_constr.datalen > 0)
17289 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17291 _res_constr.data = NULL;
17292 uint32_t* _res_vals = _res->elems;
17293 for (size_t o = 0; o < _res_constr.datalen; o++) {
17294 uint32_t _res_conv_40 = _res_vals[o];
17295 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
17296 CHECK_ACCESS(_res_conv_40_ptr);
17297 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17298 FREE((void*)_res_conv_40);
17299 _res_constr.data[o] = _res_conv_40_conv;
17302 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17305 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
17306 LDKCVec_EventZ _res_constr;
17307 _res_constr.datalen = _res->arr_len;
17308 if (_res_constr.datalen > 0)
17309 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17311 _res_constr.data = NULL;
17312 uint32_t* _res_vals = _res->elems;
17313 for (size_t h = 0; h < _res_constr.datalen; h++) {
17314 uint32_t _res_conv_7 = _res_vals[h];
17315 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17316 CHECK_ACCESS(_res_conv_7_ptr);
17317 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17318 FREE((void*)_res_conv_7);
17319 _res_constr.data[h] = _res_conv_7_conv;
17322 CVec_EventZ_free(_res_constr);
17325 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17326 LDKCVec_TransactionZ _res_constr;
17327 _res_constr.datalen = _res->arr_len;
17328 if (_res_constr.datalen > 0)
17329 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17331 _res_constr.data = NULL;
17332 int8_tArray* _res_vals = (void*) _res->elems;
17333 for (size_t m = 0; m < _res_constr.datalen; m++) {
17334 int8_tArray _res_conv_12 = _res_vals[m];
17335 LDKTransaction _res_conv_12_ref;
17336 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17337 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17338 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17339 _res_conv_12_ref.data_is_owned = true;
17340 _res_constr.data[m] = _res_conv_12_ref;
17343 CVec_TransactionZ_free(_res_constr);
17346 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
17347 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17348 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
17349 return ((uint32_t)ret_conv);
17351 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
17352 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
17353 uint32_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
17357 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
17358 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
17359 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17360 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
17361 return ((uint32_t)ret_conv);
17364 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
17365 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17366 CHECK_ACCESS(b_ptr);
17367 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
17368 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
17369 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
17370 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
17371 return ((uint32_t)ret_conv);
17374 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
17375 if ((_res & 1) != 0) return;
17376 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17377 CHECK_ACCESS(_res_ptr);
17378 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
17380 C2Tuple_u32TxOutZ_free(_res_conv);
17383 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
17384 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
17385 _res_constr.datalen = _res->arr_len;
17386 if (_res_constr.datalen > 0)
17387 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17389 _res_constr.data = NULL;
17390 uint32_t* _res_vals = _res->elems;
17391 for (size_t u = 0; u < _res_constr.datalen; u++) {
17392 uint32_t _res_conv_20 = _res_vals[u];
17393 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
17394 CHECK_ACCESS(_res_conv_20_ptr);
17395 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
17396 FREE((void*)_res_conv_20);
17397 _res_constr.data[u] = _res_conv_20_conv;
17400 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
17403 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
17404 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17405 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
17406 return ((uint32_t)ret_conv);
17408 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
17409 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
17410 uint32_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
17414 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
17415 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
17416 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17417 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
17418 return ((uint32_t)ret_conv);
17421 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
17422 LDKThirtyTwoBytes a_ref;
17423 CHECK(a->arr_len == 32);
17424 memcpy(a_ref.data, a->elems, 32); FREE(a);
17425 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
17426 b_constr.datalen = b->arr_len;
17427 if (b_constr.datalen > 0)
17428 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17430 b_constr.data = NULL;
17431 uint32_t* b_vals = b->elems;
17432 for (size_t u = 0; u < b_constr.datalen; u++) {
17433 uint32_t b_conv_20 = b_vals[u];
17434 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
17435 CHECK_ACCESS(b_conv_20_ptr);
17436 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
17437 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
17438 b_constr.data[u] = b_conv_20_conv;
17441 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17442 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
17443 return ((uint32_t)ret_conv);
17446 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
17447 if ((_res & 1) != 0) return;
17448 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17449 CHECK_ACCESS(_res_ptr);
17450 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
17452 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
17455 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
17456 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
17457 _res_constr.datalen = _res->arr_len;
17458 if (_res_constr.datalen > 0)
17459 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
17461 _res_constr.data = NULL;
17462 uint32_t* _res_vals = _res->elems;
17463 for (size_t n = 0; n < _res_constr.datalen; n++) {
17464 uint32_t _res_conv_39 = _res_vals[n];
17465 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
17466 CHECK_ACCESS(_res_conv_39_ptr);
17467 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
17468 FREE((void*)_res_conv_39);
17469 _res_constr.data[n] = _res_conv_39_conv;
17472 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
17475 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
17476 LDKCVec_BalanceZ _res_constr;
17477 _res_constr.datalen = _res->arr_len;
17478 if (_res_constr.datalen > 0)
17479 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
17481 _res_constr.data = NULL;
17482 uint32_t* _res_vals = _res->elems;
17483 for (size_t j = 0; j < _res_constr.datalen; j++) {
17484 uint32_t _res_conv_9 = _res_vals[j];
17485 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
17486 CHECK_ACCESS(_res_conv_9_ptr);
17487 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
17488 FREE((void*)_res_conv_9);
17489 _res_constr.data[j] = _res_conv_9_conv;
17492 CVec_BalanceZ_free(_res_constr);
17495 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17496 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17497 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17498 return ((uint32_t)ret_conv);
17500 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
17501 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17502 uint32_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17506 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
17507 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17508 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17509 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17510 return ((uint32_t)ret_conv);
17513 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
17514 LDKThirtyTwoBytes a_ref;
17515 CHECK(a->arr_len == 32);
17516 memcpy(a_ref.data, a->elems, 32); FREE(a);
17517 LDKChannelMonitor b_conv;
17518 b_conv.inner = (void*)(b & (~1));
17519 b_conv.is_owned = (b & 1) || (b == 0);
17520 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17521 b_conv = ChannelMonitor_clone(&b_conv);
17522 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17523 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17524 return ((uint32_t)ret_conv);
17527 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
17528 if ((_res & 1) != 0) return;
17529 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17530 CHECK_ACCESS(_res_ptr);
17531 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17533 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17536 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
17537 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17538 CHECK_ACCESS(o_ptr);
17539 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
17540 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
17541 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17542 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
17543 return (uint32_t)ret_conv;
17546 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
17547 LDKDecodeError e_conv;
17548 e_conv.inner = (void*)(e & (~1));
17549 e_conv.is_owned = (e & 1) || (e == 0);
17550 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17551 e_conv = DecodeError_clone(&e_conv);
17552 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17553 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
17554 return (uint32_t)ret_conv;
17557 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
17558 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
17559 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
17563 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
17564 if ((_res & 1) != 0) return;
17565 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17566 CHECK_ACCESS(_res_ptr);
17567 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
17569 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
17572 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
17573 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17574 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
17575 return (uint32_t)ret_conv;
17577 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
17578 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
17579 uint32_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
17583 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
17584 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
17585 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17586 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
17587 return (uint32_t)ret_conv;
17590 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
17591 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17592 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
17593 return ((uint32_t)ret_conv);
17595 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
17596 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
17597 uint32_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
17601 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
17602 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
17603 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17604 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
17605 return ((uint32_t)ret_conv);
17608 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
17609 LDKPublicKey a_ref;
17610 CHECK(a->arr_len == 33);
17611 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
17612 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
17613 CHECK_ACCESS(b_ptr);
17614 LDKType b_conv = *(LDKType*)(b_ptr);
17615 if (b_conv.free == LDKType_JCalls_free) {
17616 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17617 LDKType_JCalls_cloned(&b_conv);
17619 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17620 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
17621 return ((uint32_t)ret_conv);
17624 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
17625 if ((_res & 1) != 0) return;
17626 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17627 CHECK_ACCESS(_res_ptr);
17628 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
17630 C2Tuple_PublicKeyTypeZ_free(_res_conv);
17633 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
17634 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17635 _res_constr.datalen = _res->arr_len;
17636 if (_res_constr.datalen > 0)
17637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17639 _res_constr.data = NULL;
17640 uint32_t* _res_vals = _res->elems;
17641 for (size_t z = 0; z < _res_constr.datalen; z++) {
17642 uint32_t _res_conv_25 = _res_vals[z];
17643 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
17644 CHECK_ACCESS(_res_conv_25_ptr);
17645 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17646 FREE((void*)_res_conv_25);
17647 _res_constr.data[z] = _res_conv_25_conv;
17650 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17653 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint32_t o) {
17654 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17655 CHECK_ACCESS(o_ptr);
17656 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17657 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17658 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17659 *ret_copy = COption_NetAddressZ_some(o_conv);
17660 uint32_t ret_ref = (uintptr_t)ret_copy;
17664 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
17665 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17666 *ret_copy = COption_NetAddressZ_none();
17667 uint32_t ret_ref = (uintptr_t)ret_copy;
17671 void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint32_t _res) {
17672 if ((_res & 1) != 0) return;
17673 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17674 CHECK_ACCESS(_res_ptr);
17675 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
17677 COption_NetAddressZ_free(_res_conv);
17680 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
17681 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17682 *ret_copy = COption_NetAddressZ_clone(arg);
17683 uint32_t ret_ref = (uintptr_t)ret_copy;
17686 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint32_t arg) {
17687 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
17688 uint32_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
17692 uint32_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint32_t orig) {
17693 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
17694 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17695 *ret_copy = COption_NetAddressZ_clone(orig_conv);
17696 uint32_t ret_ref = (uintptr_t)ret_copy;
17700 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
17702 o_ref.datalen = o->arr_len;
17703 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17704 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17705 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17706 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17707 return (uint32_t)ret_conv;
17710 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
17711 LDKPeerHandleError e_conv;
17712 e_conv.inner = (void*)(e & (~1));
17713 e_conv.is_owned = (e & 1) || (e == 0);
17714 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17715 e_conv = PeerHandleError_clone(&e_conv);
17716 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17717 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17718 return (uint32_t)ret_conv;
17721 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
17722 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
17723 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17727 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
17728 if ((_res & 1) != 0) return;
17729 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17730 CHECK_ACCESS(_res_ptr);
17731 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17733 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17736 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17737 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17738 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17739 return (uint32_t)ret_conv;
17741 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17742 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
17743 uint32_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17747 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
17748 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
17749 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17750 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17751 return (uint32_t)ret_conv;
17754 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
17755 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17756 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17757 return (uint32_t)ret_conv;
17760 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
17761 LDKPeerHandleError e_conv;
17762 e_conv.inner = (void*)(e & (~1));
17763 e_conv.is_owned = (e & 1) || (e == 0);
17764 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17765 e_conv = PeerHandleError_clone(&e_conv);
17766 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17767 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17768 return (uint32_t)ret_conv;
17771 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
17772 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
17773 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17777 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
17778 if ((_res & 1) != 0) return;
17779 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17780 CHECK_ACCESS(_res_ptr);
17781 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17783 CResult_NonePeerHandleErrorZ_free(_res_conv);
17786 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17787 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17788 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17789 return (uint32_t)ret_conv;
17791 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
17792 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
17793 uint32_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17797 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
17798 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
17799 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17800 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17801 return (uint32_t)ret_conv;
17804 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
17805 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17806 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17807 return (uint32_t)ret_conv;
17810 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
17811 LDKPeerHandleError e_conv;
17812 e_conv.inner = (void*)(e & (~1));
17813 e_conv.is_owned = (e & 1) || (e == 0);
17814 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17815 e_conv = PeerHandleError_clone(&e_conv);
17816 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17817 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17818 return (uint32_t)ret_conv;
17821 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
17822 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
17823 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17827 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
17828 if ((_res & 1) != 0) return;
17829 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17830 CHECK_ACCESS(_res_ptr);
17831 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17833 CResult_boolPeerHandleErrorZ_free(_res_conv);
17836 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17837 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17838 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17839 return (uint32_t)ret_conv;
17841 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
17842 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
17843 uint32_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17847 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
17848 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
17849 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17850 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17851 return (uint32_t)ret_conv;
17854 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
17855 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17856 *ret_conv = CResult_NoneErrorZ_ok();
17857 return (uint32_t)ret_conv;
17860 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
17861 LDKIOError e_conv = LDKIOError_from_js(e);
17862 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17863 *ret_conv = CResult_NoneErrorZ_err(e_conv);
17864 return (uint32_t)ret_conv;
17867 jboolean __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint32_t o) {
17868 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
17869 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17873 void __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint32_t _res) {
17874 if ((_res & 1) != 0) return;
17875 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17876 CHECK_ACCESS(_res_ptr);
17877 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17879 CResult_NoneErrorZ_free(_res_conv);
17882 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17883 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17884 *ret_conv = CResult_NoneErrorZ_clone(arg);
17885 return (uint32_t)ret_conv;
17887 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint32_t arg) {
17888 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
17889 uint32_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17893 uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint32_t orig) {
17894 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
17895 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17896 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17897 return (uint32_t)ret_conv;
17900 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
17901 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17902 CHECK_ACCESS(o_ptr);
17903 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17904 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17905 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17906 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17907 return (uint32_t)ret_conv;
17910 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
17911 LDKDecodeError e_conv;
17912 e_conv.inner = (void*)(e & (~1));
17913 e_conv.is_owned = (e & 1) || (e == 0);
17914 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17915 e_conv = DecodeError_clone(&e_conv);
17916 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17917 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17918 return (uint32_t)ret_conv;
17921 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
17922 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17923 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17927 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
17928 if ((_res & 1) != 0) return;
17929 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17930 CHECK_ACCESS(_res_ptr);
17931 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17933 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17936 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17937 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17938 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17939 return (uint32_t)ret_conv;
17941 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
17942 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17943 uint32_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17947 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
17948 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17949 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17950 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17951 return (uint32_t)ret_conv;
17954 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
17955 LDKCVec_UpdateAddHTLCZ _res_constr;
17956 _res_constr.datalen = _res->arr_len;
17957 if (_res_constr.datalen > 0)
17958 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17960 _res_constr.data = NULL;
17961 uint32_t* _res_vals = _res->elems;
17962 for (size_t p = 0; p < _res_constr.datalen; p++) {
17963 uint32_t _res_conv_15 = _res_vals[p];
17964 LDKUpdateAddHTLC _res_conv_15_conv;
17965 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17966 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17967 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17968 _res_constr.data[p] = _res_conv_15_conv;
17971 CVec_UpdateAddHTLCZ_free(_res_constr);
17974 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
17975 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17976 _res_constr.datalen = _res->arr_len;
17977 if (_res_constr.datalen > 0)
17978 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17980 _res_constr.data = NULL;
17981 uint32_t* _res_vals = _res->elems;
17982 for (size_t t = 0; t < _res_constr.datalen; t++) {
17983 uint32_t _res_conv_19 = _res_vals[t];
17984 LDKUpdateFulfillHTLC _res_conv_19_conv;
17985 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17986 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17987 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17988 _res_constr.data[t] = _res_conv_19_conv;
17991 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17994 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
17995 LDKCVec_UpdateFailHTLCZ _res_constr;
17996 _res_constr.datalen = _res->arr_len;
17997 if (_res_constr.datalen > 0)
17998 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18000 _res_constr.data = NULL;
18001 uint32_t* _res_vals = _res->elems;
18002 for (size_t q = 0; q < _res_constr.datalen; q++) {
18003 uint32_t _res_conv_16 = _res_vals[q];
18004 LDKUpdateFailHTLC _res_conv_16_conv;
18005 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18006 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18007 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18008 _res_constr.data[q] = _res_conv_16_conv;
18011 CVec_UpdateFailHTLCZ_free(_res_constr);
18014 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
18015 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18016 _res_constr.datalen = _res->arr_len;
18017 if (_res_constr.datalen > 0)
18018 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18020 _res_constr.data = NULL;
18021 uint32_t* _res_vals = _res->elems;
18022 for (size_t z = 0; z < _res_constr.datalen; z++) {
18023 uint32_t _res_conv_25 = _res_vals[z];
18024 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18025 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
18026 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
18027 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18028 _res_constr.data[z] = _res_conv_25_conv;
18031 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18034 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
18035 LDKAcceptChannel o_conv;
18036 o_conv.inner = (void*)(o & (~1));
18037 o_conv.is_owned = (o & 1) || (o == 0);
18038 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18039 o_conv = AcceptChannel_clone(&o_conv);
18040 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18041 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18042 return (uint32_t)ret_conv;
18045 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
18046 LDKDecodeError e_conv;
18047 e_conv.inner = (void*)(e & (~1));
18048 e_conv.is_owned = (e & 1) || (e == 0);
18049 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18050 e_conv = DecodeError_clone(&e_conv);
18051 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18052 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18053 return (uint32_t)ret_conv;
18056 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
18057 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
18058 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18062 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
18063 if ((_res & 1) != 0) return;
18064 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18065 CHECK_ACCESS(_res_ptr);
18066 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18068 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18071 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18072 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18073 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18074 return (uint32_t)ret_conv;
18076 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18077 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
18078 uint32_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18082 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
18083 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
18084 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18085 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18086 return (uint32_t)ret_conv;
18089 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
18090 LDKAnnouncementSignatures o_conv;
18091 o_conv.inner = (void*)(o & (~1));
18092 o_conv.is_owned = (o & 1) || (o == 0);
18093 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18094 o_conv = AnnouncementSignatures_clone(&o_conv);
18095 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18096 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18097 return (uint32_t)ret_conv;
18100 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
18101 LDKDecodeError e_conv;
18102 e_conv.inner = (void*)(e & (~1));
18103 e_conv.is_owned = (e & 1) || (e == 0);
18104 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18105 e_conv = DecodeError_clone(&e_conv);
18106 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18107 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18108 return (uint32_t)ret_conv;
18111 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
18112 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
18113 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18117 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
18118 if ((_res & 1) != 0) return;
18119 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18120 CHECK_ACCESS(_res_ptr);
18121 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18123 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18126 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18127 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18128 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18129 return (uint32_t)ret_conv;
18131 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
18132 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
18133 uint32_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18137 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
18138 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
18139 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18140 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18141 return (uint32_t)ret_conv;
18144 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
18145 LDKChannelReestablish o_conv;
18146 o_conv.inner = (void*)(o & (~1));
18147 o_conv.is_owned = (o & 1) || (o == 0);
18148 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18149 o_conv = ChannelReestablish_clone(&o_conv);
18150 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18151 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18152 return (uint32_t)ret_conv;
18155 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
18156 LDKDecodeError e_conv;
18157 e_conv.inner = (void*)(e & (~1));
18158 e_conv.is_owned = (e & 1) || (e == 0);
18159 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18160 e_conv = DecodeError_clone(&e_conv);
18161 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18162 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18163 return (uint32_t)ret_conv;
18166 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
18167 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
18168 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18172 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
18173 if ((_res & 1) != 0) return;
18174 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18175 CHECK_ACCESS(_res_ptr);
18176 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18178 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18181 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18182 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18183 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18184 return (uint32_t)ret_conv;
18186 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
18187 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
18188 uint32_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18192 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
18193 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
18194 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18195 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18196 return (uint32_t)ret_conv;
18199 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
18200 LDKClosingSigned o_conv;
18201 o_conv.inner = (void*)(o & (~1));
18202 o_conv.is_owned = (o & 1) || (o == 0);
18203 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18204 o_conv = ClosingSigned_clone(&o_conv);
18205 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18206 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18207 return (uint32_t)ret_conv;
18210 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
18211 LDKDecodeError e_conv;
18212 e_conv.inner = (void*)(e & (~1));
18213 e_conv.is_owned = (e & 1) || (e == 0);
18214 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18215 e_conv = DecodeError_clone(&e_conv);
18216 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18217 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18218 return (uint32_t)ret_conv;
18221 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
18222 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
18223 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18227 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
18228 if ((_res & 1) != 0) return;
18229 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18230 CHECK_ACCESS(_res_ptr);
18231 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18233 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18236 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18237 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18238 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18239 return (uint32_t)ret_conv;
18241 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18242 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
18243 uint32_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18247 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
18248 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
18249 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18250 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18251 return (uint32_t)ret_conv;
18254 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
18255 LDKClosingSignedFeeRange o_conv;
18256 o_conv.inner = (void*)(o & (~1));
18257 o_conv.is_owned = (o & 1) || (o == 0);
18258 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18259 o_conv = ClosingSignedFeeRange_clone(&o_conv);
18260 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18261 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18262 return (uint32_t)ret_conv;
18265 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
18266 LDKDecodeError e_conv;
18267 e_conv.inner = (void*)(e & (~1));
18268 e_conv.is_owned = (e & 1) || (e == 0);
18269 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18270 e_conv = DecodeError_clone(&e_conv);
18271 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18272 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18273 return (uint32_t)ret_conv;
18276 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
18277 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
18278 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18282 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
18283 if ((_res & 1) != 0) return;
18284 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18285 CHECK_ACCESS(_res_ptr);
18286 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
18288 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
18291 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
18292 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18293 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
18294 return (uint32_t)ret_conv;
18296 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18297 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
18298 uint32_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
18302 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
18303 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
18304 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18305 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
18306 return (uint32_t)ret_conv;
18309 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
18310 LDKCommitmentSigned o_conv;
18311 o_conv.inner = (void*)(o & (~1));
18312 o_conv.is_owned = (o & 1) || (o == 0);
18313 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18314 o_conv = CommitmentSigned_clone(&o_conv);
18315 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18316 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
18317 return (uint32_t)ret_conv;
18320 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
18321 LDKDecodeError e_conv;
18322 e_conv.inner = (void*)(e & (~1));
18323 e_conv.is_owned = (e & 1) || (e == 0);
18324 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18325 e_conv = DecodeError_clone(&e_conv);
18326 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18327 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
18328 return (uint32_t)ret_conv;
18331 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
18332 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
18333 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
18337 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
18338 if ((_res & 1) != 0) return;
18339 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18340 CHECK_ACCESS(_res_ptr);
18341 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
18343 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
18346 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
18347 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18348 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
18349 return (uint32_t)ret_conv;
18351 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18352 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
18353 uint32_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
18357 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
18358 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
18359 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
18360 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
18361 return (uint32_t)ret_conv;
18364 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
18365 LDKFundingCreated o_conv;
18366 o_conv.inner = (void*)(o & (~1));
18367 o_conv.is_owned = (o & 1) || (o == 0);
18368 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18369 o_conv = FundingCreated_clone(&o_conv);
18370 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18371 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
18372 return (uint32_t)ret_conv;
18375 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
18376 LDKDecodeError e_conv;
18377 e_conv.inner = (void*)(e & (~1));
18378 e_conv.is_owned = (e & 1) || (e == 0);
18379 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18380 e_conv = DecodeError_clone(&e_conv);
18381 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18382 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
18383 return (uint32_t)ret_conv;
18386 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
18387 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
18388 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
18392 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
18393 if ((_res & 1) != 0) return;
18394 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18395 CHECK_ACCESS(_res_ptr);
18396 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
18398 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
18401 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
18402 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18403 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
18404 return (uint32_t)ret_conv;
18406 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
18407 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
18408 uint32_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
18412 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
18413 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
18414 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18415 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
18416 return (uint32_t)ret_conv;
18419 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
18420 LDKFundingSigned o_conv;
18421 o_conv.inner = (void*)(o & (~1));
18422 o_conv.is_owned = (o & 1) || (o == 0);
18423 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18424 o_conv = FundingSigned_clone(&o_conv);
18425 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18426 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
18427 return (uint32_t)ret_conv;
18430 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
18431 LDKDecodeError e_conv;
18432 e_conv.inner = (void*)(e & (~1));
18433 e_conv.is_owned = (e & 1) || (e == 0);
18434 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18435 e_conv = DecodeError_clone(&e_conv);
18436 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18437 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
18438 return (uint32_t)ret_conv;
18441 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
18442 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
18443 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
18447 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
18448 if ((_res & 1) != 0) return;
18449 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18450 CHECK_ACCESS(_res_ptr);
18451 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
18453 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
18456 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
18457 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18458 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
18459 return (uint32_t)ret_conv;
18461 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
18462 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
18463 uint32_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
18467 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
18468 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
18469 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18470 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
18471 return (uint32_t)ret_conv;
18474 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint32_t o) {
18475 LDKChannelReady o_conv;
18476 o_conv.inner = (void*)(o & (~1));
18477 o_conv.is_owned = (o & 1) || (o == 0);
18478 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18479 o_conv = ChannelReady_clone(&o_conv);
18480 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18481 *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
18482 return (uint32_t)ret_conv;
18485 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint32_t e) {
18486 LDKDecodeError e_conv;
18487 e_conv.inner = (void*)(e & (~1));
18488 e_conv.is_owned = (e & 1) || (e == 0);
18489 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18490 e_conv = DecodeError_clone(&e_conv);
18491 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18492 *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
18493 return (uint32_t)ret_conv;
18496 jboolean __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint32_t o) {
18497 LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(o & ~1);
18498 jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
18502 void __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint32_t _res) {
18503 if ((_res & 1) != 0) return;
18504 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18505 CHECK_ACCESS(_res_ptr);
18506 LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
18508 CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
18511 static inline uintptr_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
18512 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18513 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
18514 return (uint32_t)ret_conv;
18516 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint32_t arg) {
18517 LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(arg & ~1);
18518 uint32_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
18522 uint32_t __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint32_t orig) {
18523 LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)(orig & ~1);
18524 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18525 *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
18526 return (uint32_t)ret_conv;
18529 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
18531 o_conv.inner = (void*)(o & (~1));
18532 o_conv.is_owned = (o & 1) || (o == 0);
18533 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18534 o_conv = Init_clone(&o_conv);
18535 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18536 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
18537 return (uint32_t)ret_conv;
18540 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
18541 LDKDecodeError e_conv;
18542 e_conv.inner = (void*)(e & (~1));
18543 e_conv.is_owned = (e & 1) || (e == 0);
18544 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18545 e_conv = DecodeError_clone(&e_conv);
18546 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18547 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
18548 return (uint32_t)ret_conv;
18551 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
18552 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
18553 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
18557 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
18558 if ((_res & 1) != 0) return;
18559 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18560 CHECK_ACCESS(_res_ptr);
18561 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
18563 CResult_InitDecodeErrorZ_free(_res_conv);
18566 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
18567 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18568 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
18569 return (uint32_t)ret_conv;
18571 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
18572 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
18573 uint32_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
18577 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
18578 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
18579 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18580 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
18581 return (uint32_t)ret_conv;
18584 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
18585 LDKOpenChannel o_conv;
18586 o_conv.inner = (void*)(o & (~1));
18587 o_conv.is_owned = (o & 1) || (o == 0);
18588 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18589 o_conv = OpenChannel_clone(&o_conv);
18590 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18591 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
18592 return (uint32_t)ret_conv;
18595 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
18596 LDKDecodeError e_conv;
18597 e_conv.inner = (void*)(e & (~1));
18598 e_conv.is_owned = (e & 1) || (e == 0);
18599 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18600 e_conv = DecodeError_clone(&e_conv);
18601 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18602 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
18603 return (uint32_t)ret_conv;
18606 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
18607 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
18608 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
18612 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
18613 if ((_res & 1) != 0) return;
18614 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18615 CHECK_ACCESS(_res_ptr);
18616 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18618 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18621 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18622 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18623 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18624 return (uint32_t)ret_conv;
18626 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
18627 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
18628 uint32_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18632 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
18633 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
18634 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18635 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18636 return (uint32_t)ret_conv;
18639 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
18640 LDKRevokeAndACK o_conv;
18641 o_conv.inner = (void*)(o & (~1));
18642 o_conv.is_owned = (o & 1) || (o == 0);
18643 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18644 o_conv = RevokeAndACK_clone(&o_conv);
18645 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18646 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18647 return (uint32_t)ret_conv;
18650 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
18651 LDKDecodeError e_conv;
18652 e_conv.inner = (void*)(e & (~1));
18653 e_conv.is_owned = (e & 1) || (e == 0);
18654 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18655 e_conv = DecodeError_clone(&e_conv);
18656 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18657 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18658 return (uint32_t)ret_conv;
18661 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
18662 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
18663 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18667 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
18668 if ((_res & 1) != 0) return;
18669 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18670 CHECK_ACCESS(_res_ptr);
18671 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18673 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18676 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18677 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18678 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18679 return (uint32_t)ret_conv;
18681 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
18682 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
18683 uint32_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18687 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
18688 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
18689 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18690 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18691 return (uint32_t)ret_conv;
18694 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
18695 LDKShutdown o_conv;
18696 o_conv.inner = (void*)(o & (~1));
18697 o_conv.is_owned = (o & 1) || (o == 0);
18698 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18699 o_conv = Shutdown_clone(&o_conv);
18700 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18701 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18702 return (uint32_t)ret_conv;
18705 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
18706 LDKDecodeError e_conv;
18707 e_conv.inner = (void*)(e & (~1));
18708 e_conv.is_owned = (e & 1) || (e == 0);
18709 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18710 e_conv = DecodeError_clone(&e_conv);
18711 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18712 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18713 return (uint32_t)ret_conv;
18716 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
18717 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
18718 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18722 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
18723 if ((_res & 1) != 0) return;
18724 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18725 CHECK_ACCESS(_res_ptr);
18726 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18728 CResult_ShutdownDecodeErrorZ_free(_res_conv);
18731 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18732 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18733 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18734 return (uint32_t)ret_conv;
18736 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
18737 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
18738 uint32_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18742 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
18743 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
18744 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18745 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18746 return (uint32_t)ret_conv;
18749 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
18750 LDKUpdateFailHTLC o_conv;
18751 o_conv.inner = (void*)(o & (~1));
18752 o_conv.is_owned = (o & 1) || (o == 0);
18753 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18754 o_conv = UpdateFailHTLC_clone(&o_conv);
18755 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18756 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18757 return (uint32_t)ret_conv;
18760 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
18761 LDKDecodeError e_conv;
18762 e_conv.inner = (void*)(e & (~1));
18763 e_conv.is_owned = (e & 1) || (e == 0);
18764 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18765 e_conv = DecodeError_clone(&e_conv);
18766 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18767 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18768 return (uint32_t)ret_conv;
18771 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
18772 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
18773 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18777 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
18778 if ((_res & 1) != 0) return;
18779 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18780 CHECK_ACCESS(_res_ptr);
18781 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18783 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18786 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18787 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18788 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18789 return (uint32_t)ret_conv;
18791 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18792 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
18793 uint32_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18797 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
18798 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
18799 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18800 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18801 return (uint32_t)ret_conv;
18804 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
18805 LDKUpdateFailMalformedHTLC o_conv;
18806 o_conv.inner = (void*)(o & (~1));
18807 o_conv.is_owned = (o & 1) || (o == 0);
18808 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18809 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18810 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18811 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18812 return (uint32_t)ret_conv;
18815 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
18816 LDKDecodeError e_conv;
18817 e_conv.inner = (void*)(e & (~1));
18818 e_conv.is_owned = (e & 1) || (e == 0);
18819 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18820 e_conv = DecodeError_clone(&e_conv);
18821 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18822 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18823 return (uint32_t)ret_conv;
18826 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
18827 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
18828 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18832 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
18833 if ((_res & 1) != 0) return;
18834 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18835 CHECK_ACCESS(_res_ptr);
18836 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18838 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18841 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18842 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18843 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18844 return (uint32_t)ret_conv;
18846 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18847 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
18848 uint32_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18852 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
18853 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
18854 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18855 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18856 return (uint32_t)ret_conv;
18859 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
18860 LDKUpdateFee o_conv;
18861 o_conv.inner = (void*)(o & (~1));
18862 o_conv.is_owned = (o & 1) || (o == 0);
18863 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18864 o_conv = UpdateFee_clone(&o_conv);
18865 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18866 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18867 return (uint32_t)ret_conv;
18870 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
18871 LDKDecodeError e_conv;
18872 e_conv.inner = (void*)(e & (~1));
18873 e_conv.is_owned = (e & 1) || (e == 0);
18874 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18875 e_conv = DecodeError_clone(&e_conv);
18876 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18877 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18878 return (uint32_t)ret_conv;
18881 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
18882 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18883 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18887 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
18888 if ((_res & 1) != 0) return;
18889 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18890 CHECK_ACCESS(_res_ptr);
18891 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18893 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18896 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18897 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18898 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18899 return (uint32_t)ret_conv;
18901 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
18902 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18903 uint32_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18907 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
18908 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18909 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18910 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18911 return (uint32_t)ret_conv;
18914 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
18915 LDKUpdateFulfillHTLC o_conv;
18916 o_conv.inner = (void*)(o & (~1));
18917 o_conv.is_owned = (o & 1) || (o == 0);
18918 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18919 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18920 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18921 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18922 return (uint32_t)ret_conv;
18925 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
18926 LDKDecodeError e_conv;
18927 e_conv.inner = (void*)(e & (~1));
18928 e_conv.is_owned = (e & 1) || (e == 0);
18929 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18930 e_conv = DecodeError_clone(&e_conv);
18931 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18932 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18933 return (uint32_t)ret_conv;
18936 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
18937 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18938 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18942 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
18943 if ((_res & 1) != 0) return;
18944 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18945 CHECK_ACCESS(_res_ptr);
18946 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18948 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18951 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18952 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18953 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18954 return (uint32_t)ret_conv;
18956 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18957 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18958 uint32_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18962 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
18963 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18964 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18965 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18966 return (uint32_t)ret_conv;
18969 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
18970 LDKUpdateAddHTLC o_conv;
18971 o_conv.inner = (void*)(o & (~1));
18972 o_conv.is_owned = (o & 1) || (o == 0);
18973 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18974 o_conv = UpdateAddHTLC_clone(&o_conv);
18975 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18976 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18977 return (uint32_t)ret_conv;
18980 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
18981 LDKDecodeError e_conv;
18982 e_conv.inner = (void*)(e & (~1));
18983 e_conv.is_owned = (e & 1) || (e == 0);
18984 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18985 e_conv = DecodeError_clone(&e_conv);
18986 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18987 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18988 return (uint32_t)ret_conv;
18991 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
18992 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18993 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18997 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
18998 if ((_res & 1) != 0) return;
18999 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19000 CHECK_ACCESS(_res_ptr);
19001 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19003 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19006 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19007 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19008 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19009 return (uint32_t)ret_conv;
19011 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
19012 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
19013 uint32_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19017 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
19018 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
19019 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19020 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19021 return (uint32_t)ret_conv;
19024 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
19026 o_conv.inner = (void*)(o & (~1));
19027 o_conv.is_owned = (o & 1) || (o == 0);
19028 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19029 o_conv = Ping_clone(&o_conv);
19030 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19031 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19032 return (uint32_t)ret_conv;
19035 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
19036 LDKDecodeError e_conv;
19037 e_conv.inner = (void*)(e & (~1));
19038 e_conv.is_owned = (e & 1) || (e == 0);
19039 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19040 e_conv = DecodeError_clone(&e_conv);
19041 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19042 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19043 return (uint32_t)ret_conv;
19046 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
19047 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
19048 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19052 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
19053 if ((_res & 1) != 0) return;
19054 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19055 CHECK_ACCESS(_res_ptr);
19056 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19058 CResult_PingDecodeErrorZ_free(_res_conv);
19061 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19062 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19063 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19064 return (uint32_t)ret_conv;
19066 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
19067 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
19068 uint32_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19072 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
19073 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
19074 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19075 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19076 return (uint32_t)ret_conv;
19079 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
19081 o_conv.inner = (void*)(o & (~1));
19082 o_conv.is_owned = (o & 1) || (o == 0);
19083 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19084 o_conv = Pong_clone(&o_conv);
19085 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19086 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19087 return (uint32_t)ret_conv;
19090 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
19091 LDKDecodeError e_conv;
19092 e_conv.inner = (void*)(e & (~1));
19093 e_conv.is_owned = (e & 1) || (e == 0);
19094 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19095 e_conv = DecodeError_clone(&e_conv);
19096 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19097 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19098 return (uint32_t)ret_conv;
19101 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
19102 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
19103 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19107 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
19108 if ((_res & 1) != 0) return;
19109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19110 CHECK_ACCESS(_res_ptr);
19111 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19113 CResult_PongDecodeErrorZ_free(_res_conv);
19116 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19117 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19118 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19119 return (uint32_t)ret_conv;
19121 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
19122 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
19123 uint32_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19127 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
19128 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
19129 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19130 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19131 return (uint32_t)ret_conv;
19134 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19135 LDKUnsignedChannelAnnouncement o_conv;
19136 o_conv.inner = (void*)(o & (~1));
19137 o_conv.is_owned = (o & 1) || (o == 0);
19138 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19139 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19140 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19141 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19142 return (uint32_t)ret_conv;
19145 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19146 LDKDecodeError e_conv;
19147 e_conv.inner = (void*)(e & (~1));
19148 e_conv.is_owned = (e & 1) || (e == 0);
19149 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19150 e_conv = DecodeError_clone(&e_conv);
19151 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19152 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19153 return (uint32_t)ret_conv;
19156 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19157 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
19158 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19162 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19163 if ((_res & 1) != 0) return;
19164 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19165 CHECK_ACCESS(_res_ptr);
19166 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19168 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19171 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19172 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19173 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19174 return (uint32_t)ret_conv;
19176 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19177 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19178 uint32_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19182 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19183 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19184 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19185 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19186 return (uint32_t)ret_conv;
19189 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
19190 LDKChannelAnnouncement o_conv;
19191 o_conv.inner = (void*)(o & (~1));
19192 o_conv.is_owned = (o & 1) || (o == 0);
19193 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19194 o_conv = ChannelAnnouncement_clone(&o_conv);
19195 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19196 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19197 return (uint32_t)ret_conv;
19200 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
19201 LDKDecodeError e_conv;
19202 e_conv.inner = (void*)(e & (~1));
19203 e_conv.is_owned = (e & 1) || (e == 0);
19204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19205 e_conv = DecodeError_clone(&e_conv);
19206 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19207 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19208 return (uint32_t)ret_conv;
19211 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19212 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
19213 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19217 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
19218 if ((_res & 1) != 0) return;
19219 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19220 CHECK_ACCESS(_res_ptr);
19221 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19223 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19226 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19227 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19228 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19229 return (uint32_t)ret_conv;
19231 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19232 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
19233 uint32_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19237 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19238 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
19239 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19240 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19241 return (uint32_t)ret_conv;
19244 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19245 LDKUnsignedChannelUpdate o_conv;
19246 o_conv.inner = (void*)(o & (~1));
19247 o_conv.is_owned = (o & 1) || (o == 0);
19248 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19249 o_conv = UnsignedChannelUpdate_clone(&o_conv);
19250 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19251 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
19252 return (uint32_t)ret_conv;
19255 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
19256 LDKDecodeError e_conv;
19257 e_conv.inner = (void*)(e & (~1));
19258 e_conv.is_owned = (e & 1) || (e == 0);
19259 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19260 e_conv = DecodeError_clone(&e_conv);
19261 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19262 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
19263 return (uint32_t)ret_conv;
19266 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19267 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
19268 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
19272 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19273 if ((_res & 1) != 0) return;
19274 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19275 CHECK_ACCESS(_res_ptr);
19276 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
19278 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
19281 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19282 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19283 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
19284 return (uint32_t)ret_conv;
19286 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19287 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
19288 uint32_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19292 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19293 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
19294 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
19295 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
19296 return (uint32_t)ret_conv;
19299 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
19300 LDKChannelUpdate o_conv;
19301 o_conv.inner = (void*)(o & (~1));
19302 o_conv.is_owned = (o & 1) || (o == 0);
19303 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19304 o_conv = ChannelUpdate_clone(&o_conv);
19305 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19306 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
19307 return (uint32_t)ret_conv;
19310 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
19311 LDKDecodeError e_conv;
19312 e_conv.inner = (void*)(e & (~1));
19313 e_conv.is_owned = (e & 1) || (e == 0);
19314 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19315 e_conv = DecodeError_clone(&e_conv);
19316 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19317 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
19318 return (uint32_t)ret_conv;
19321 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
19322 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
19323 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
19327 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
19328 if ((_res & 1) != 0) return;
19329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19330 CHECK_ACCESS(_res_ptr);
19331 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
19333 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
19336 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
19337 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19338 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
19339 return (uint32_t)ret_conv;
19341 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
19342 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
19343 uint32_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
19347 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
19348 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
19349 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
19350 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
19351 return (uint32_t)ret_conv;
19354 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
19355 LDKErrorMessage o_conv;
19356 o_conv.inner = (void*)(o & (~1));
19357 o_conv.is_owned = (o & 1) || (o == 0);
19358 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19359 o_conv = ErrorMessage_clone(&o_conv);
19360 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19361 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
19362 return (uint32_t)ret_conv;
19365 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
19366 LDKDecodeError e_conv;
19367 e_conv.inner = (void*)(e & (~1));
19368 e_conv.is_owned = (e & 1) || (e == 0);
19369 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19370 e_conv = DecodeError_clone(&e_conv);
19371 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19372 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
19373 return (uint32_t)ret_conv;
19376 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
19377 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
19378 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
19382 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
19383 if ((_res & 1) != 0) return;
19384 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19385 CHECK_ACCESS(_res_ptr);
19386 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
19388 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
19391 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
19392 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19393 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
19394 return (uint32_t)ret_conv;
19396 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19397 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
19398 uint32_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
19402 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
19403 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
19404 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
19405 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
19406 return (uint32_t)ret_conv;
19409 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
19410 LDKWarningMessage o_conv;
19411 o_conv.inner = (void*)(o & (~1));
19412 o_conv.is_owned = (o & 1) || (o == 0);
19413 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19414 o_conv = WarningMessage_clone(&o_conv);
19415 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19416 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
19417 return (uint32_t)ret_conv;
19420 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
19421 LDKDecodeError e_conv;
19422 e_conv.inner = (void*)(e & (~1));
19423 e_conv.is_owned = (e & 1) || (e == 0);
19424 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19425 e_conv = DecodeError_clone(&e_conv);
19426 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19427 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
19428 return (uint32_t)ret_conv;
19431 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
19432 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
19433 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
19437 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
19438 if ((_res & 1) != 0) return;
19439 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19440 CHECK_ACCESS(_res_ptr);
19441 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
19443 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
19446 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
19447 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19448 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
19449 return (uint32_t)ret_conv;
19451 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
19452 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
19453 uint32_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
19457 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
19458 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
19459 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19460 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
19461 return (uint32_t)ret_conv;
19464 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19465 LDKUnsignedNodeAnnouncement o_conv;
19466 o_conv.inner = (void*)(o & (~1));
19467 o_conv.is_owned = (o & 1) || (o == 0);
19468 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19469 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
19470 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19471 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
19472 return (uint32_t)ret_conv;
19475 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19476 LDKDecodeError e_conv;
19477 e_conv.inner = (void*)(e & (~1));
19478 e_conv.is_owned = (e & 1) || (e == 0);
19479 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19480 e_conv = DecodeError_clone(&e_conv);
19481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19482 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
19483 return (uint32_t)ret_conv;
19486 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19487 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
19488 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19492 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19493 if ((_res & 1) != 0) return;
19494 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19495 CHECK_ACCESS(_res_ptr);
19496 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
19498 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
19501 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19502 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19503 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
19504 return (uint32_t)ret_conv;
19506 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19507 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
19508 uint32_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19512 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19513 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
19514 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19515 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
19516 return (uint32_t)ret_conv;
19519 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
19520 LDKNodeAnnouncement o_conv;
19521 o_conv.inner = (void*)(o & (~1));
19522 o_conv.is_owned = (o & 1) || (o == 0);
19523 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19524 o_conv = NodeAnnouncement_clone(&o_conv);
19525 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19526 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
19527 return (uint32_t)ret_conv;
19530 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
19531 LDKDecodeError e_conv;
19532 e_conv.inner = (void*)(e & (~1));
19533 e_conv.is_owned = (e & 1) || (e == 0);
19534 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19535 e_conv = DecodeError_clone(&e_conv);
19536 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19537 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
19538 return (uint32_t)ret_conv;
19541 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
19542 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
19543 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19547 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
19548 if ((_res & 1) != 0) return;
19549 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19550 CHECK_ACCESS(_res_ptr);
19551 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
19553 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
19556 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19557 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19558 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
19559 return (uint32_t)ret_conv;
19561 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
19562 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
19563 uint32_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19567 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
19568 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
19569 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19570 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
19571 return (uint32_t)ret_conv;
19574 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
19575 LDKQueryShortChannelIds o_conv;
19576 o_conv.inner = (void*)(o & (~1));
19577 o_conv.is_owned = (o & 1) || (o == 0);
19578 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19579 o_conv = QueryShortChannelIds_clone(&o_conv);
19580 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19581 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
19582 return (uint32_t)ret_conv;
19585 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
19586 LDKDecodeError e_conv;
19587 e_conv.inner = (void*)(e & (~1));
19588 e_conv.is_owned = (e & 1) || (e == 0);
19589 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19590 e_conv = DecodeError_clone(&e_conv);
19591 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19592 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
19593 return (uint32_t)ret_conv;
19596 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
19597 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
19598 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
19602 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
19603 if ((_res & 1) != 0) return;
19604 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19605 CHECK_ACCESS(_res_ptr);
19606 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
19608 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
19611 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
19612 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19613 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
19614 return (uint32_t)ret_conv;
19616 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
19617 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
19618 uint32_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19622 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
19623 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
19624 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19625 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19626 return (uint32_t)ret_conv;
19629 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
19630 LDKReplyShortChannelIdsEnd o_conv;
19631 o_conv.inner = (void*)(o & (~1));
19632 o_conv.is_owned = (o & 1) || (o == 0);
19633 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19634 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19635 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19636 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19637 return (uint32_t)ret_conv;
19640 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
19641 LDKDecodeError e_conv;
19642 e_conv.inner = (void*)(e & (~1));
19643 e_conv.is_owned = (e & 1) || (e == 0);
19644 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19645 e_conv = DecodeError_clone(&e_conv);
19646 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19647 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19648 return (uint32_t)ret_conv;
19651 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
19652 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
19653 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19657 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
19658 if ((_res & 1) != 0) return;
19659 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19660 CHECK_ACCESS(_res_ptr);
19661 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19663 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19666 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19667 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19668 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19669 return (uint32_t)ret_conv;
19671 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
19672 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
19673 uint32_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19677 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
19678 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
19679 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19680 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19681 return (uint32_t)ret_conv;
19684 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
19685 LDKQueryChannelRange o_conv;
19686 o_conv.inner = (void*)(o & (~1));
19687 o_conv.is_owned = (o & 1) || (o == 0);
19688 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19689 o_conv = QueryChannelRange_clone(&o_conv);
19690 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19691 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19692 return (uint32_t)ret_conv;
19695 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
19696 LDKDecodeError e_conv;
19697 e_conv.inner = (void*)(e & (~1));
19698 e_conv.is_owned = (e & 1) || (e == 0);
19699 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19700 e_conv = DecodeError_clone(&e_conv);
19701 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19702 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19703 return (uint32_t)ret_conv;
19706 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19707 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
19708 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19712 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
19713 if ((_res & 1) != 0) return;
19714 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19715 CHECK_ACCESS(_res_ptr);
19716 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19718 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19721 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19722 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19723 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19724 return (uint32_t)ret_conv;
19726 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19727 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
19728 uint32_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19732 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19733 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
19734 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19735 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19736 return (uint32_t)ret_conv;
19739 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
19740 LDKReplyChannelRange o_conv;
19741 o_conv.inner = (void*)(o & (~1));
19742 o_conv.is_owned = (o & 1) || (o == 0);
19743 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19744 o_conv = ReplyChannelRange_clone(&o_conv);
19745 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19746 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19747 return (uint32_t)ret_conv;
19750 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
19751 LDKDecodeError e_conv;
19752 e_conv.inner = (void*)(e & (~1));
19753 e_conv.is_owned = (e & 1) || (e == 0);
19754 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19755 e_conv = DecodeError_clone(&e_conv);
19756 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19757 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19758 return (uint32_t)ret_conv;
19761 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19762 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
19763 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19767 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
19768 if ((_res & 1) != 0) return;
19769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19770 CHECK_ACCESS(_res_ptr);
19771 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19773 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19776 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19777 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19778 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19779 return (uint32_t)ret_conv;
19781 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19782 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
19783 uint32_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19787 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19788 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
19789 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19790 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19791 return (uint32_t)ret_conv;
19794 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
19795 LDKGossipTimestampFilter o_conv;
19796 o_conv.inner = (void*)(o & (~1));
19797 o_conv.is_owned = (o & 1) || (o == 0);
19798 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19799 o_conv = GossipTimestampFilter_clone(&o_conv);
19800 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19801 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19802 return (uint32_t)ret_conv;
19805 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
19806 LDKDecodeError e_conv;
19807 e_conv.inner = (void*)(e & (~1));
19808 e_conv.is_owned = (e & 1) || (e == 0);
19809 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19810 e_conv = DecodeError_clone(&e_conv);
19811 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19812 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19813 return (uint32_t)ret_conv;
19816 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
19817 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
19818 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19822 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
19823 if ((_res & 1) != 0) return;
19824 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19825 CHECK_ACCESS(_res_ptr);
19826 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19828 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19831 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19832 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19833 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19834 return (uint32_t)ret_conv;
19836 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
19837 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
19838 uint32_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19842 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
19843 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
19844 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19845 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19846 return (uint32_t)ret_conv;
19849 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
19851 o_conv.inner = (void*)(o & (~1));
19852 o_conv.is_owned = (o & 1) || (o == 0);
19853 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19854 o_conv = Invoice_clone(&o_conv);
19855 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19856 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19857 return (uint32_t)ret_conv;
19860 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
19861 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19862 CHECK_ACCESS(e_ptr);
19863 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19864 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
19865 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19866 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19867 return (uint32_t)ret_conv;
19870 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
19871 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19872 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19876 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
19877 if ((_res & 1) != 0) return;
19878 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19879 CHECK_ACCESS(_res_ptr);
19880 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19882 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19885 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19886 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19887 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19888 return (uint32_t)ret_conv;
19890 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
19891 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19892 uint32_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19896 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
19897 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19898 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19899 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19900 return (uint32_t)ret_conv;
19903 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
19904 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19905 CHECK_ACCESS(o_ptr);
19906 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19907 if (o_conv.free == LDKFilter_JCalls_free) {
19908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19909 LDKFilter_JCalls_cloned(&o_conv);
19911 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19912 *ret_copy = COption_FilterZ_some(o_conv);
19913 uint32_t ret_ref = (uintptr_t)ret_copy;
19917 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19918 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19919 *ret_copy = COption_FilterZ_none();
19920 uint32_t ret_ref = (uintptr_t)ret_copy;
19924 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
19925 if ((_res & 1) != 0) return;
19926 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19927 CHECK_ACCESS(_res_ptr);
19928 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19930 COption_FilterZ_free(_res_conv);
19933 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
19934 LDKLockedChannelMonitor o_conv;
19935 o_conv.inner = (void*)(o & (~1));
19936 o_conv.is_owned = (o & 1) || (o == 0);
19937 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19938 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19939 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19940 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19941 return (uint32_t)ret_conv;
19944 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19945 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19946 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19947 return (uint32_t)ret_conv;
19950 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
19951 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19952 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19956 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
19957 if ((_res & 1) != 0) return;
19958 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19959 CHECK_ACCESS(_res_ptr);
19960 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19962 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19965 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
19966 LDKCVec_OutPointZ _res_constr;
19967 _res_constr.datalen = _res->arr_len;
19968 if (_res_constr.datalen > 0)
19969 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19971 _res_constr.data = NULL;
19972 uint32_t* _res_vals = _res->elems;
19973 for (size_t k = 0; k < _res_constr.datalen; k++) {
19974 uint32_t _res_conv_10 = _res_vals[k];
19975 LDKOutPoint _res_conv_10_conv;
19976 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19977 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19978 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19979 _res_constr.data[k] = _res_conv_10_conv;
19982 CVec_OutPointZ_free(_res_constr);
19985 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
19986 if ((this_ptr & 1) != 0) return;
19987 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19988 CHECK_ACCESS(this_ptr_ptr);
19989 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19990 FREE((void*)this_ptr);
19991 PaymentPurpose_free(this_ptr_conv);
19994 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19995 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19996 *ret_copy = PaymentPurpose_clone(arg);
19997 uint32_t ret_ref = (uintptr_t)ret_copy;
20000 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
20001 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
20002 uint32_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20006 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
20007 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
20008 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20009 *ret_copy = PaymentPurpose_clone(orig_conv);
20010 uint32_t ret_ref = (uintptr_t)ret_copy;
20014 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20015 LDKThirtyTwoBytes payment_preimage_ref;
20016 CHECK(payment_preimage->arr_len == 32);
20017 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20018 LDKThirtyTwoBytes payment_secret_ref;
20019 CHECK(payment_secret->arr_len == 32);
20020 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20021 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20022 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20023 uint32_t ret_ref = (uintptr_t)ret_copy;
20027 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20028 LDKThirtyTwoBytes a_ref;
20029 CHECK(a->arr_len == 32);
20030 memcpy(a_ref.data, a->elems, 32); FREE(a);
20031 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20032 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20033 uint32_t ret_ref = (uintptr_t)ret_copy;
20037 int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint32_t obj) {
20038 LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)obj;
20039 LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20040 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20041 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20042 CVec_u8Z_free(ret_var);
20046 uint32_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20047 LDKu8slice ser_ref;
20048 ser_ref.datalen = ser->arr_len;
20049 ser_ref.data = ser->elems;
20050 LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20051 *ret_conv = PaymentPurpose_read(ser_ref);
20053 return (uint32_t)ret_conv;
20056 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
20057 if ((this_ptr & 1) != 0) return;
20058 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20059 CHECK_ACCESS(this_ptr_ptr);
20060 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20061 FREE((void*)this_ptr);
20062 ClosureReason_free(this_ptr_conv);
20065 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20066 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20067 *ret_copy = ClosureReason_clone(arg);
20068 uint32_t ret_ref = (uintptr_t)ret_copy;
20071 uint32_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
20072 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
20073 uint32_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20077 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
20078 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
20079 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20080 *ret_copy = ClosureReason_clone(orig_conv);
20081 uint32_t ret_ref = (uintptr_t)ret_copy;
20085 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20086 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20087 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20088 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20089 uint32_t ret_ref = (uintptr_t)ret_copy;
20093 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20094 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20095 *ret_copy = ClosureReason_holder_force_closed();
20096 uint32_t ret_ref = (uintptr_t)ret_copy;
20100 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20101 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20102 *ret_copy = ClosureReason_cooperative_closure();
20103 uint32_t ret_ref = (uintptr_t)ret_copy;
20107 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20108 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20109 *ret_copy = ClosureReason_commitment_tx_confirmed();
20110 uint32_t ret_ref = (uintptr_t)ret_copy;
20114 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20115 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20116 *ret_copy = ClosureReason_funding_timed_out();
20117 uint32_t ret_ref = (uintptr_t)ret_copy;
20121 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20122 LDKStr err_conv = str_ref_to_owned_c(err);
20123 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20124 *ret_copy = ClosureReason_processing_error(err_conv);
20125 uint32_t ret_ref = (uintptr_t)ret_copy;
20129 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20130 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20131 *ret_copy = ClosureReason_disconnected_peer();
20132 uint32_t ret_ref = (uintptr_t)ret_copy;
20136 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20137 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20138 *ret_copy = ClosureReason_outdated_channel_manager();
20139 uint32_t ret_ref = (uintptr_t)ret_copy;
20143 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
20144 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
20145 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20146 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20147 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20148 CVec_u8Z_free(ret_var);
20152 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20153 LDKu8slice ser_ref;
20154 ser_ref.datalen = ser->arr_len;
20155 ser_ref.data = ser->elems;
20156 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20157 *ret_conv = ClosureReason_read(ser_ref);
20159 return (uint32_t)ret_conv;
20162 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
20163 if ((this_ptr & 1) != 0) return;
20164 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20165 CHECK_ACCESS(this_ptr_ptr);
20166 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
20167 FREE((void*)this_ptr);
20168 Event_free(this_ptr_conv);
20171 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
20172 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20173 *ret_copy = Event_clone(arg);
20174 uint32_t ret_ref = (uintptr_t)ret_copy;
20177 uint32_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
20178 LDKEvent* arg_conv = (LDKEvent*)arg;
20179 uint32_t ret_conv = Event_clone_ptr(arg_conv);
20183 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
20184 LDKEvent* orig_conv = (LDKEvent*)orig;
20185 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20186 *ret_copy = Event_clone(orig_conv);
20187 uint32_t ret_ref = (uintptr_t)ret_copy;
20191 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) {
20192 LDKThirtyTwoBytes temporary_channel_id_ref;
20193 CHECK(temporary_channel_id->arr_len == 32);
20194 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20195 LDKPublicKey counterparty_node_id_ref;
20196 CHECK(counterparty_node_id->arr_len == 33);
20197 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20198 LDKCVec_u8Z output_script_ref;
20199 output_script_ref.datalen = output_script->arr_len;
20200 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
20201 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
20202 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20203 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
20204 uint32_t ret_ref = (uintptr_t)ret_copy;
20208 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20209 LDKThirtyTwoBytes payment_hash_ref;
20210 CHECK(payment_hash->arr_len == 32);
20211 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20212 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20213 CHECK_ACCESS(purpose_ptr);
20214 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20215 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20216 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20217 *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
20218 uint32_t ret_ref = (uintptr_t)ret_copy;
20222 uint32_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint32_t purpose) {
20223 LDKThirtyTwoBytes payment_hash_ref;
20224 CHECK(payment_hash->arr_len == 32);
20225 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20226 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
20227 CHECK_ACCESS(purpose_ptr);
20228 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
20229 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
20230 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20231 *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
20232 uint32_t ret_ref = (uintptr_t)ret_copy;
20236 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) {
20237 LDKThirtyTwoBytes payment_id_ref;
20238 CHECK(payment_id->arr_len == 32);
20239 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20240 LDKThirtyTwoBytes payment_preimage_ref;
20241 CHECK(payment_preimage->arr_len == 32);
20242 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20243 LDKThirtyTwoBytes payment_hash_ref;
20244 CHECK(payment_hash->arr_len == 32);
20245 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20246 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
20247 CHECK_ACCESS(fee_paid_msat_ptr);
20248 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
20249 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
20250 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20251 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
20252 uint32_t ret_ref = (uintptr_t)ret_copy;
20256 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
20257 LDKThirtyTwoBytes payment_id_ref;
20258 CHECK(payment_id->arr_len == 32);
20259 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20260 LDKThirtyTwoBytes payment_hash_ref;
20261 CHECK(payment_hash->arr_len == 32);
20262 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20263 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20264 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
20265 uint32_t ret_ref = (uintptr_t)ret_copy;
20269 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) {
20270 LDKThirtyTwoBytes payment_id_ref;
20271 CHECK(payment_id->arr_len == 32);
20272 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20273 LDKThirtyTwoBytes payment_hash_ref;
20274 CHECK(payment_hash->arr_len == 32);
20275 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20276 LDKCVec_RouteHopZ path_constr;
20277 path_constr.datalen = path->arr_len;
20278 if (path_constr.datalen > 0)
20279 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20281 path_constr.data = NULL;
20282 uint32_t* path_vals = path->elems;
20283 for (size_t k = 0; k < path_constr.datalen; k++) {
20284 uint32_t path_conv_10 = path_vals[k];
20285 LDKRouteHop path_conv_10_conv;
20286 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20287 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20288 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20289 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20290 path_constr.data[k] = path_conv_10_conv;
20293 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20294 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
20295 uint32_t ret_ref = (uintptr_t)ret_copy;
20299 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) {
20300 LDKThirtyTwoBytes payment_id_ref;
20301 CHECK(payment_id->arr_len == 32);
20302 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20303 LDKThirtyTwoBytes payment_hash_ref;
20304 CHECK(payment_hash->arr_len == 32);
20305 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20306 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
20307 CHECK_ACCESS(network_update_ptr);
20308 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
20309 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
20310 LDKCVec_RouteHopZ path_constr;
20311 path_constr.datalen = path->arr_len;
20312 if (path_constr.datalen > 0)
20313 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20315 path_constr.data = NULL;
20316 uint32_t* path_vals = path->elems;
20317 for (size_t k = 0; k < path_constr.datalen; k++) {
20318 uint32_t path_conv_10 = path_vals[k];
20319 LDKRouteHop path_conv_10_conv;
20320 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
20321 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
20322 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20323 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20324 path_constr.data[k] = path_conv_10_conv;
20327 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
20328 CHECK_ACCESS(short_channel_id_ptr);
20329 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
20330 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
20331 LDKRouteParameters retry_conv;
20332 retry_conv.inner = (void*)(retry & (~1));
20333 retry_conv.is_owned = (retry & 1) || (retry == 0);
20334 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
20335 retry_conv = RouteParameters_clone(&retry_conv);
20336 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20337 *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);
20338 uint32_t ret_ref = (uintptr_t)ret_copy;
20342 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
20343 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20344 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
20345 uint32_t ret_ref = (uintptr_t)ret_copy;
20349 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
20350 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
20351 outputs_constr.datalen = outputs->arr_len;
20352 if (outputs_constr.datalen > 0)
20353 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20355 outputs_constr.data = NULL;
20356 uint32_t* outputs_vals = outputs->elems;
20357 for (size_t b = 0; b < outputs_constr.datalen; b++) {
20358 uint32_t outputs_conv_27 = outputs_vals[b];
20359 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
20360 CHECK_ACCESS(outputs_conv_27_ptr);
20361 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
20362 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
20363 outputs_constr.data[b] = outputs_conv_27_conv;
20366 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20367 *ret_copy = Event_spendable_outputs(outputs_constr);
20368 uint32_t ret_ref = (uintptr_t)ret_copy;
20372 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) {
20373 LDKThirtyTwoBytes prev_channel_id_ref;
20374 CHECK(prev_channel_id->arr_len == 32);
20375 memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
20376 LDKThirtyTwoBytes next_channel_id_ref;
20377 CHECK(next_channel_id->arr_len == 32);
20378 memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
20379 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
20380 CHECK_ACCESS(fee_earned_msat_ptr);
20381 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
20382 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
20383 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20384 *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
20385 uint32_t ret_ref = (uintptr_t)ret_copy;
20389 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) {
20390 LDKThirtyTwoBytes channel_id_ref;
20391 CHECK(channel_id->arr_len == 32);
20392 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20393 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
20394 CHECK_ACCESS(reason_ptr);
20395 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
20396 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
20397 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20398 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
20399 uint32_t ret_ref = (uintptr_t)ret_copy;
20403 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
20404 LDKThirtyTwoBytes channel_id_ref;
20405 CHECK(channel_id->arr_len == 32);
20406 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20407 LDKTransaction transaction_ref;
20408 transaction_ref.datalen = transaction->arr_len;
20409 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
20410 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
20411 transaction_ref.data_is_owned = true;
20412 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20413 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
20414 uint32_t ret_ref = (uintptr_t)ret_copy;
20418 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) {
20419 LDKThirtyTwoBytes temporary_channel_id_ref;
20420 CHECK(temporary_channel_id->arr_len == 32);
20421 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20422 LDKPublicKey counterparty_node_id_ref;
20423 CHECK(counterparty_node_id->arr_len == 33);
20424 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20425 LDKChannelTypeFeatures channel_type_conv;
20426 channel_type_conv.inner = (void*)(channel_type & (~1));
20427 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
20428 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
20429 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
20430 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20431 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
20432 uint32_t ret_ref = (uintptr_t)ret_copy;
20436 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
20437 LDKEvent* obj_conv = (LDKEvent*)obj;
20438 LDKCVec_u8Z ret_var = Event_write(obj_conv);
20439 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20440 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20441 CVec_u8Z_free(ret_var);
20445 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
20446 LDKu8slice ser_ref;
20447 ser_ref.datalen = ser->arr_len;
20448 ser_ref.data = ser->elems;
20449 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
20450 *ret_conv = Event_read(ser_ref);
20452 return (uint32_t)ret_conv;
20455 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
20456 if ((this_ptr & 1) != 0) return;
20457 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20458 CHECK_ACCESS(this_ptr_ptr);
20459 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20460 FREE((void*)this_ptr);
20461 MessageSendEvent_free(this_ptr_conv);
20464 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20465 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20466 *ret_copy = MessageSendEvent_clone(arg);
20467 uint32_t ret_ref = (uintptr_t)ret_copy;
20470 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
20471 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
20472 uint32_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
20476 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
20477 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
20478 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20479 *ret_copy = MessageSendEvent_clone(orig_conv);
20480 uint32_t ret_ref = (uintptr_t)ret_copy;
20484 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
20485 LDKPublicKey node_id_ref;
20486 CHECK(node_id->arr_len == 33);
20487 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20488 LDKAcceptChannel msg_conv;
20489 msg_conv.inner = (void*)(msg & (~1));
20490 msg_conv.is_owned = (msg & 1) || (msg == 0);
20491 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20492 msg_conv = AcceptChannel_clone(&msg_conv);
20493 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20494 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20495 uint32_t ret_ref = (uintptr_t)ret_copy;
20499 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
20500 LDKPublicKey node_id_ref;
20501 CHECK(node_id->arr_len == 33);
20502 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20503 LDKOpenChannel msg_conv;
20504 msg_conv.inner = (void*)(msg & (~1));
20505 msg_conv.is_owned = (msg & 1) || (msg == 0);
20506 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20507 msg_conv = OpenChannel_clone(&msg_conv);
20508 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20509 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20510 uint32_t ret_ref = (uintptr_t)ret_copy;
20514 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
20515 LDKPublicKey node_id_ref;
20516 CHECK(node_id->arr_len == 33);
20517 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20518 LDKFundingCreated msg_conv;
20519 msg_conv.inner = (void*)(msg & (~1));
20520 msg_conv.is_owned = (msg & 1) || (msg == 0);
20521 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20522 msg_conv = FundingCreated_clone(&msg_conv);
20523 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20524 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20525 uint32_t ret_ref = (uintptr_t)ret_copy;
20529 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
20530 LDKPublicKey node_id_ref;
20531 CHECK(node_id->arr_len == 33);
20532 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20533 LDKFundingSigned msg_conv;
20534 msg_conv.inner = (void*)(msg & (~1));
20535 msg_conv.is_owned = (msg & 1) || (msg == 0);
20536 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20537 msg_conv = FundingSigned_clone(&msg_conv);
20538 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20539 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20540 uint32_t ret_ref = (uintptr_t)ret_copy;
20544 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint32_t msg) {
20545 LDKPublicKey node_id_ref;
20546 CHECK(node_id->arr_len == 33);
20547 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20548 LDKChannelReady msg_conv;
20549 msg_conv.inner = (void*)(msg & (~1));
20550 msg_conv.is_owned = (msg & 1) || (msg == 0);
20551 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20552 msg_conv = ChannelReady_clone(&msg_conv);
20553 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20554 *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
20555 uint32_t ret_ref = (uintptr_t)ret_copy;
20559 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
20560 LDKPublicKey node_id_ref;
20561 CHECK(node_id->arr_len == 33);
20562 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20563 LDKAnnouncementSignatures msg_conv;
20564 msg_conv.inner = (void*)(msg & (~1));
20565 msg_conv.is_owned = (msg & 1) || (msg == 0);
20566 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20567 msg_conv = AnnouncementSignatures_clone(&msg_conv);
20568 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20569 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20570 uint32_t ret_ref = (uintptr_t)ret_copy;
20574 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
20575 LDKPublicKey node_id_ref;
20576 CHECK(node_id->arr_len == 33);
20577 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20578 LDKCommitmentUpdate updates_conv;
20579 updates_conv.inner = (void*)(updates & (~1));
20580 updates_conv.is_owned = (updates & 1) || (updates == 0);
20581 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20582 updates_conv = CommitmentUpdate_clone(&updates_conv);
20583 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20584 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20585 uint32_t ret_ref = (uintptr_t)ret_copy;
20589 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
20590 LDKPublicKey node_id_ref;
20591 CHECK(node_id->arr_len == 33);
20592 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20593 LDKRevokeAndACK msg_conv;
20594 msg_conv.inner = (void*)(msg & (~1));
20595 msg_conv.is_owned = (msg & 1) || (msg == 0);
20596 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20597 msg_conv = RevokeAndACK_clone(&msg_conv);
20598 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20599 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20600 uint32_t ret_ref = (uintptr_t)ret_copy;
20604 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
20605 LDKPublicKey node_id_ref;
20606 CHECK(node_id->arr_len == 33);
20607 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20608 LDKClosingSigned 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 = ClosingSigned_clone(&msg_conv);
20613 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20614 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20615 uint32_t ret_ref = (uintptr_t)ret_copy;
20619 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(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 LDKShutdown 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 = Shutdown_clone(&msg_conv);
20628 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20629 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20630 uint32_t ret_ref = (uintptr_t)ret_copy;
20634 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
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 LDKChannelReestablish msg_conv;
20639 msg_conv.inner = (void*)(msg & (~1));
20640 msg_conv.is_owned = (msg & 1) || (msg == 0);
20641 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20642 msg_conv = ChannelReestablish_clone(&msg_conv);
20643 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20644 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20645 uint32_t ret_ref = (uintptr_t)ret_copy;
20649 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
20650 LDKChannelAnnouncement msg_conv;
20651 msg_conv.inner = (void*)(msg & (~1));
20652 msg_conv.is_owned = (msg & 1) || (msg == 0);
20653 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20654 msg_conv = ChannelAnnouncement_clone(&msg_conv);
20655 LDKChannelUpdate update_msg_conv;
20656 update_msg_conv.inner = (void*)(update_msg & (~1));
20657 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
20658 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20659 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20660 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20661 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20662 uint32_t ret_ref = (uintptr_t)ret_copy;
20666 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
20667 LDKNodeAnnouncement 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 = NodeAnnouncement_clone(&msg_conv);
20672 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20673 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20674 uint32_t ret_ref = (uintptr_t)ret_copy;
20678 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
20679 LDKChannelUpdate msg_conv;
20680 msg_conv.inner = (void*)(msg & (~1));
20681 msg_conv.is_owned = (msg & 1) || (msg == 0);
20682 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20683 msg_conv = ChannelUpdate_clone(&msg_conv);
20684 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20685 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20686 uint32_t ret_ref = (uintptr_t)ret_copy;
20690 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
20691 LDKPublicKey node_id_ref;
20692 CHECK(node_id->arr_len == 33);
20693 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20694 LDKChannelUpdate msg_conv;
20695 msg_conv.inner = (void*)(msg & (~1));
20696 msg_conv.is_owned = (msg & 1) || (msg == 0);
20697 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20698 msg_conv = ChannelUpdate_clone(&msg_conv);
20699 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20700 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20701 uint32_t ret_ref = (uintptr_t)ret_copy;
20705 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
20706 LDKPublicKey node_id_ref;
20707 CHECK(node_id->arr_len == 33);
20708 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20709 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
20710 CHECK_ACCESS(action_ptr);
20711 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20712 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
20713 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20714 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20715 uint32_t ret_ref = (uintptr_t)ret_copy;
20719 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
20720 LDKPublicKey node_id_ref;
20721 CHECK(node_id->arr_len == 33);
20722 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20723 LDKQueryChannelRange msg_conv;
20724 msg_conv.inner = (void*)(msg & (~1));
20725 msg_conv.is_owned = (msg & 1) || (msg == 0);
20726 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20727 msg_conv = QueryChannelRange_clone(&msg_conv);
20728 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20729 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20730 uint32_t ret_ref = (uintptr_t)ret_copy;
20734 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
20735 LDKPublicKey node_id_ref;
20736 CHECK(node_id->arr_len == 33);
20737 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20738 LDKQueryShortChannelIds msg_conv;
20739 msg_conv.inner = (void*)(msg & (~1));
20740 msg_conv.is_owned = (msg & 1) || (msg == 0);
20741 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20742 msg_conv = QueryShortChannelIds_clone(&msg_conv);
20743 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20744 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20745 uint32_t ret_ref = (uintptr_t)ret_copy;
20749 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
20750 LDKPublicKey node_id_ref;
20751 CHECK(node_id->arr_len == 33);
20752 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20753 LDKReplyChannelRange msg_conv;
20754 msg_conv.inner = (void*)(msg & (~1));
20755 msg_conv.is_owned = (msg & 1) || (msg == 0);
20756 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20757 msg_conv = ReplyChannelRange_clone(&msg_conv);
20758 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20759 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20760 uint32_t ret_ref = (uintptr_t)ret_copy;
20764 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint32_t msg) {
20765 LDKPublicKey node_id_ref;
20766 CHECK(node_id->arr_len == 33);
20767 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20768 LDKGossipTimestampFilter msg_conv;
20769 msg_conv.inner = (void*)(msg & (~1));
20770 msg_conv.is_owned = (msg & 1) || (msg == 0);
20771 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20772 msg_conv = GossipTimestampFilter_clone(&msg_conv);
20773 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20774 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
20775 uint32_t ret_ref = (uintptr_t)ret_copy;
20779 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
20780 if ((this_ptr & 1) != 0) return;
20781 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20782 CHECK_ACCESS(this_ptr_ptr);
20783 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20784 FREE((void*)this_ptr);
20785 MessageSendEventsProvider_free(this_ptr_conv);
20788 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
20789 if ((this_ptr & 1) != 0) return;
20790 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20791 CHECK_ACCESS(this_ptr_ptr);
20792 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20793 FREE((void*)this_ptr);
20794 EventsProvider_free(this_ptr_conv);
20797 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
20798 if ((this_ptr & 1) != 0) return;
20799 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20800 CHECK_ACCESS(this_ptr_ptr);
20801 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20802 FREE((void*)this_ptr);
20803 EventHandler_free(this_ptr_conv);
20806 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
20807 if ((this_ptr & 1) != 0) return;
20808 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20809 CHECK_ACCESS(this_ptr_ptr);
20810 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20811 FREE((void*)this_ptr);
20812 APIError_free(this_ptr_conv);
20815 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20816 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20817 *ret_copy = APIError_clone(arg);
20818 uint32_t ret_ref = (uintptr_t)ret_copy;
20821 uint32_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
20822 LDKAPIError* arg_conv = (LDKAPIError*)arg;
20823 uint32_t ret_conv = APIError_clone_ptr(arg_conv);
20827 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
20828 LDKAPIError* orig_conv = (LDKAPIError*)orig;
20829 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20830 *ret_copy = APIError_clone(orig_conv);
20831 uint32_t ret_ref = (uintptr_t)ret_copy;
20835 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20836 LDKStr err_conv = str_ref_to_owned_c(err);
20837 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20838 *ret_copy = APIError_apimisuse_error(err_conv);
20839 uint32_t ret_ref = (uintptr_t)ret_copy;
20843 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20844 LDKStr err_conv = str_ref_to_owned_c(err);
20845 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20846 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20847 uint32_t ret_ref = (uintptr_t)ret_copy;
20851 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20852 LDKStr err_conv = str_ref_to_owned_c(err);
20853 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20854 *ret_copy = APIError_route_error(err_conv);
20855 uint32_t ret_ref = (uintptr_t)ret_copy;
20859 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20860 LDKStr err_conv = str_ref_to_owned_c(err);
20861 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20862 *ret_copy = APIError_channel_unavailable(err_conv);
20863 uint32_t ret_ref = (uintptr_t)ret_copy;
20867 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20868 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20869 *ret_copy = APIError_monitor_update_failed();
20870 uint32_t ret_ref = (uintptr_t)ret_copy;
20874 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
20875 LDKShutdownScript script_conv;
20876 script_conv.inner = (void*)(script & (~1));
20877 script_conv.is_owned = (script & 1) || (script == 0);
20878 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20879 script_conv = ShutdownScript_clone(&script_conv);
20880 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20881 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20882 uint32_t ret_ref = (uintptr_t)ret_copy;
20886 void __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint32_t this_obj) {
20887 LDKBigSize this_obj_conv;
20888 this_obj_conv.inner = (void*)(this_obj & (~1));
20889 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20891 BigSize_free(this_obj_conv);
20894 int64_t __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint32_t this_ptr) {
20895 LDKBigSize this_ptr_conv;
20896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20897 this_ptr_conv.is_owned = false;
20898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20899 int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
20903 void __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint32_t this_ptr, int64_t val) {
20904 LDKBigSize this_ptr_conv;
20905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20906 this_ptr_conv.is_owned = false;
20907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20908 BigSize_set_a(&this_ptr_conv, val);
20911 uint32_t __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
20912 LDKBigSize ret_var = BigSize_new(a_arg);
20913 uint32_t ret_ref = 0;
20914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20917 ret_ref = (uintptr_t)ret_var.inner;
20918 if (ret_var.is_owned) {
20924 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20925 LDKu8slice msg_ref;
20926 msg_ref.datalen = msg->arr_len;
20927 msg_ref.data = msg->elems;
20928 unsigned char sk_arr[32];
20929 CHECK(sk->arr_len == 32);
20930 memcpy(sk_arr, sk->elems, 32); FREE(sk);
20931 unsigned char (*sk_ref)[32] = &sk_arr;
20932 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20933 *ret_conv = sign(msg_ref, sk_ref);
20935 return (uint32_t)ret_conv;
20938 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20939 LDKu8slice msg_ref;
20940 msg_ref.datalen = msg->arr_len;
20941 msg_ref.data = msg->elems;
20942 LDKStr sig_conv = str_ref_to_owned_c(sig);
20943 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20944 *ret_conv = recover_pk(msg_ref, sig_conv);
20946 return (uint32_t)ret_conv;
20949 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20950 LDKu8slice msg_ref;
20951 msg_ref.datalen = msg->arr_len;
20952 msg_ref.data = msg->elems;
20953 LDKStr sig_conv = str_ref_to_owned_c(sig);
20954 LDKPublicKey pk_ref;
20955 CHECK(pk->arr_len == 33);
20956 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20957 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
20962 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20963 LDKu8slice hrp_bytes_ref;
20964 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20965 hrp_bytes_ref.data = hrp_bytes->elems;
20966 LDKCVec_u5Z data_without_signature_constr;
20967 data_without_signature_constr.datalen = data_without_signature->arr_len;
20968 if (data_without_signature_constr.datalen > 0)
20969 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20971 data_without_signature_constr.data = NULL;
20972 int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
20973 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20974 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20976 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20978 FREE(data_without_signature);
20979 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20980 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20981 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20982 CVec_u8Z_free(ret_var);
20987 void __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint32_t this_ptr) {
20988 if ((this_ptr & 1) != 0) return;
20989 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20990 CHECK_ACCESS(this_ptr_ptr);
20991 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
20992 FREE((void*)this_ptr);
20993 Persister_free(this_ptr_conv);
20996 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
20997 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
20998 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
21002 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
21003 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
21007 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
21008 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
21012 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
21013 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
21017 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
21018 uint32_t ret_conv = LDKLevel_to_js(Level_info());
21022 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
21023 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
21027 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
21028 uint32_t ret_conv = LDKLevel_to_js(Level_error());
21032 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
21033 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
21034 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
21035 jboolean ret_conv = Level_eq(a_conv, b_conv);
21039 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
21040 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
21041 int64_t ret_conv = Level_hash(o_conv);
21045 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
21046 uint32_t ret_conv = LDKLevel_to_js(Level_max());
21050 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
21051 LDKRecord this_obj_conv;
21052 this_obj_conv.inner = (void*)(this_obj & (~1));
21053 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21055 Record_free(this_obj_conv);
21058 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
21059 LDKRecord this_ptr_conv;
21060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21061 this_ptr_conv.is_owned = false;
21062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21063 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
21067 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
21068 LDKRecord this_ptr_conv;
21069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21070 this_ptr_conv.is_owned = false;
21071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21072 LDKLevel val_conv = LDKLevel_from_js(val);
21073 Record_set_level(&this_ptr_conv, val_conv);
21076 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
21077 LDKRecord this_ptr_conv;
21078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21079 this_ptr_conv.is_owned = false;
21080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21081 LDKStr ret_str = Record_get_args(&this_ptr_conv);
21082 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21087 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
21088 LDKRecord this_ptr_conv;
21089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21090 this_ptr_conv.is_owned = false;
21091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21092 LDKStr val_conv = str_ref_to_owned_c(val);
21093 Record_set_args(&this_ptr_conv, val_conv);
21096 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
21097 LDKRecord this_ptr_conv;
21098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21099 this_ptr_conv.is_owned = false;
21100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21101 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
21102 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21107 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
21108 LDKRecord this_ptr_conv;
21109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21110 this_ptr_conv.is_owned = false;
21111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21112 LDKStr val_conv = str_ref_to_owned_c(val);
21113 Record_set_module_path(&this_ptr_conv, val_conv);
21116 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
21117 LDKRecord this_ptr_conv;
21118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21119 this_ptr_conv.is_owned = false;
21120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21121 LDKStr ret_str = Record_get_file(&this_ptr_conv);
21122 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
21127 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
21128 LDKRecord this_ptr_conv;
21129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21130 this_ptr_conv.is_owned = false;
21131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21132 LDKStr val_conv = str_ref_to_owned_c(val);
21133 Record_set_file(&this_ptr_conv, val_conv);
21136 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
21137 LDKRecord this_ptr_conv;
21138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21139 this_ptr_conv.is_owned = false;
21140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21141 int32_t ret_conv = Record_get_line(&this_ptr_conv);
21145 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
21146 LDKRecord this_ptr_conv;
21147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21148 this_ptr_conv.is_owned = false;
21149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21150 Record_set_line(&this_ptr_conv, val);
21153 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
21154 LDKRecord ret_var = Record_clone(arg);
21155 uint32_t ret_ref = 0;
21156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21159 ret_ref = (uintptr_t)ret_var.inner;
21160 if (ret_var.is_owned) {
21165 uint32_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
21166 LDKRecord arg_conv;
21167 arg_conv.inner = (void*)(arg & (~1));
21168 arg_conv.is_owned = false;
21169 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21170 uint32_t ret_conv = Record_clone_ptr(&arg_conv);
21174 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
21175 LDKRecord orig_conv;
21176 orig_conv.inner = (void*)(orig & (~1));
21177 orig_conv.is_owned = false;
21178 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21179 LDKRecord ret_var = Record_clone(&orig_conv);
21180 uint32_t ret_ref = 0;
21181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21184 ret_ref = (uintptr_t)ret_var.inner;
21185 if (ret_var.is_owned) {
21191 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
21192 if ((this_ptr & 1) != 0) return;
21193 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21194 CHECK_ACCESS(this_ptr_ptr);
21195 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
21196 FREE((void*)this_ptr);
21197 Logger_free(this_ptr_conv);
21200 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
21201 LDKChannelHandshakeConfig this_obj_conv;
21202 this_obj_conv.inner = (void*)(this_obj & (~1));
21203 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21205 ChannelHandshakeConfig_free(this_obj_conv);
21208 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
21209 LDKChannelHandshakeConfig this_ptr_conv;
21210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21211 this_ptr_conv.is_owned = false;
21212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21213 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
21217 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
21218 LDKChannelHandshakeConfig this_ptr_conv;
21219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21220 this_ptr_conv.is_owned = false;
21221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21222 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
21225 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
21226 LDKChannelHandshakeConfig this_ptr_conv;
21227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21228 this_ptr_conv.is_owned = false;
21229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21230 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
21234 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) {
21235 LDKChannelHandshakeConfig this_ptr_conv;
21236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21237 this_ptr_conv.is_owned = false;
21238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21239 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
21242 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
21243 LDKChannelHandshakeConfig this_ptr_conv;
21244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21245 this_ptr_conv.is_owned = false;
21246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21247 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
21251 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) {
21252 LDKChannelHandshakeConfig this_ptr_conv;
21253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21254 this_ptr_conv.is_owned = false;
21255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21256 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
21259 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) {
21260 LDKChannelHandshakeConfig this_ptr_conv;
21261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21262 this_ptr_conv.is_owned = false;
21263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21264 int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
21268 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) {
21269 LDKChannelHandshakeConfig this_ptr_conv;
21270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21271 this_ptr_conv.is_owned = false;
21272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21273 ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
21276 jboolean __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint32_t this_ptr) {
21277 LDKChannelHandshakeConfig this_ptr_conv;
21278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21279 this_ptr_conv.is_owned = false;
21280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21281 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
21285 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint32_t this_ptr, jboolean val) {
21286 LDKChannelHandshakeConfig this_ptr_conv;
21287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21288 this_ptr_conv.is_owned = false;
21289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21290 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
21293 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) {
21294 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);
21295 uint32_t ret_ref = 0;
21296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21299 ret_ref = (uintptr_t)ret_var.inner;
21300 if (ret_var.is_owned) {
21306 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
21307 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
21308 uint32_t ret_ref = 0;
21309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21312 ret_ref = (uintptr_t)ret_var.inner;
21313 if (ret_var.is_owned) {
21318 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
21319 LDKChannelHandshakeConfig arg_conv;
21320 arg_conv.inner = (void*)(arg & (~1));
21321 arg_conv.is_owned = false;
21322 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21323 uint32_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
21327 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
21328 LDKChannelHandshakeConfig orig_conv;
21329 orig_conv.inner = (void*)(orig & (~1));
21330 orig_conv.is_owned = false;
21331 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21332 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
21333 uint32_t ret_ref = 0;
21334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21337 ret_ref = (uintptr_t)ret_var.inner;
21338 if (ret_var.is_owned) {
21344 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
21345 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
21346 uint32_t ret_ref = 0;
21347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21350 ret_ref = (uintptr_t)ret_var.inner;
21351 if (ret_var.is_owned) {
21357 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
21358 LDKChannelHandshakeLimits this_obj_conv;
21359 this_obj_conv.inner = (void*)(this_obj & (~1));
21360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21362 ChannelHandshakeLimits_free(this_obj_conv);
21365 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
21366 LDKChannelHandshakeLimits this_ptr_conv;
21367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21368 this_ptr_conv.is_owned = false;
21369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21370 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
21374 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
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 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21382 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint32_t this_ptr) {
21383 LDKChannelHandshakeLimits this_ptr_conv;
21384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21385 this_ptr_conv.is_owned = false;
21386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21387 int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
21391 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint32_t this_ptr, int64_t val) {
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 ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
21399 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
21400 LDKChannelHandshakeLimits this_ptr_conv;
21401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21402 this_ptr_conv.is_owned = false;
21403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21404 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21408 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) {
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 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21416 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) {
21417 LDKChannelHandshakeLimits this_ptr_conv;
21418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21419 this_ptr_conv.is_owned = false;
21420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21421 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21425 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) {
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 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21433 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
21434 LDKChannelHandshakeLimits this_ptr_conv;
21435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21436 this_ptr_conv.is_owned = false;
21437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21438 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21442 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) {
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 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21450 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
21451 LDKChannelHandshakeLimits this_ptr_conv;
21452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21453 this_ptr_conv.is_owned = false;
21454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21455 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21459 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) {
21460 LDKChannelHandshakeLimits this_ptr_conv;
21461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21462 this_ptr_conv.is_owned = false;
21463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21464 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21467 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
21468 LDKChannelHandshakeLimits this_ptr_conv;
21469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21470 this_ptr_conv.is_owned = false;
21471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21472 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21476 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
21477 LDKChannelHandshakeLimits this_ptr_conv;
21478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21479 this_ptr_conv.is_owned = false;
21480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21481 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21484 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint32_t this_ptr) {
21485 LDKChannelHandshakeLimits this_ptr_conv;
21486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21487 this_ptr_conv.is_owned = false;
21488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21489 jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
21493 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint32_t this_ptr, jboolean val) {
21494 LDKChannelHandshakeLimits this_ptr_conv;
21495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21496 this_ptr_conv.is_owned = false;
21497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21498 ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
21501 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
21502 LDKChannelHandshakeLimits this_ptr_conv;
21503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21504 this_ptr_conv.is_owned = false;
21505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21506 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21510 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
21511 LDKChannelHandshakeLimits this_ptr_conv;
21512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21513 this_ptr_conv.is_owned = false;
21514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21515 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21518 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
21519 LDKChannelHandshakeLimits this_ptr_conv;
21520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21521 this_ptr_conv.is_owned = false;
21522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21523 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21527 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) {
21528 LDKChannelHandshakeLimits this_ptr_conv;
21529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21530 this_ptr_conv.is_owned = false;
21531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21532 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21535 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) {
21536 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);
21537 uint32_t ret_ref = 0;
21538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21541 ret_ref = (uintptr_t)ret_var.inner;
21542 if (ret_var.is_owned) {
21548 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21549 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21550 uint32_t ret_ref = 0;
21551 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21552 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21554 ret_ref = (uintptr_t)ret_var.inner;
21555 if (ret_var.is_owned) {
21560 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
21561 LDKChannelHandshakeLimits arg_conv;
21562 arg_conv.inner = (void*)(arg & (~1));
21563 arg_conv.is_owned = false;
21564 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21565 uint32_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21569 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
21570 LDKChannelHandshakeLimits orig_conv;
21571 orig_conv.inner = (void*)(orig & (~1));
21572 orig_conv.is_owned = false;
21573 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21574 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21575 uint32_t ret_ref = 0;
21576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21579 ret_ref = (uintptr_t)ret_var.inner;
21580 if (ret_var.is_owned) {
21586 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
21587 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21588 uint32_t ret_ref = 0;
21589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21592 ret_ref = (uintptr_t)ret_var.inner;
21593 if (ret_var.is_owned) {
21599 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
21600 LDKChannelConfig this_obj_conv;
21601 this_obj_conv.inner = (void*)(this_obj & (~1));
21602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21604 ChannelConfig_free(this_obj_conv);
21607 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
21608 LDKChannelConfig this_ptr_conv;
21609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21610 this_ptr_conv.is_owned = false;
21611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21612 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21616 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) {
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 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21624 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
21625 LDKChannelConfig this_ptr_conv;
21626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21627 this_ptr_conv.is_owned = false;
21628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21629 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21633 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) {
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 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21641 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
21642 LDKChannelConfig this_ptr_conv;
21643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21644 this_ptr_conv.is_owned = false;
21645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21646 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21650 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
21651 LDKChannelConfig this_ptr_conv;
21652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21653 this_ptr_conv.is_owned = false;
21654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21655 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21658 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
21659 LDKChannelConfig this_ptr_conv;
21660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21661 this_ptr_conv.is_owned = false;
21662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21663 jboolean ret_conv = ChannelConfig_get_announced_channel(&this_ptr_conv);
21667 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
21668 LDKChannelConfig this_ptr_conv;
21669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21670 this_ptr_conv.is_owned = false;
21671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21672 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
21675 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
21676 LDKChannelConfig this_ptr_conv;
21677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21678 this_ptr_conv.is_owned = false;
21679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21680 jboolean ret_conv = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
21684 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
21685 LDKChannelConfig this_ptr_conv;
21686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21687 this_ptr_conv.is_owned = false;
21688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21689 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
21692 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) {
21693 LDKChannelConfig this_ptr_conv;
21694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21695 this_ptr_conv.is_owned = false;
21696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21697 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21701 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) {
21702 LDKChannelConfig this_ptr_conv;
21703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21704 this_ptr_conv.is_owned = false;
21705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21706 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21709 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) {
21710 LDKChannelConfig this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21714 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21718 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) {
21719 LDKChannelConfig this_ptr_conv;
21720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21721 this_ptr_conv.is_owned = false;
21722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21723 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21726 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) {
21727 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);
21728 uint32_t ret_ref = 0;
21729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21732 ret_ref = (uintptr_t)ret_var.inner;
21733 if (ret_var.is_owned) {
21739 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21740 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21741 uint32_t ret_ref = 0;
21742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21745 ret_ref = (uintptr_t)ret_var.inner;
21746 if (ret_var.is_owned) {
21751 uint32_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
21752 LDKChannelConfig arg_conv;
21753 arg_conv.inner = (void*)(arg & (~1));
21754 arg_conv.is_owned = false;
21755 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21756 uint32_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
21760 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
21761 LDKChannelConfig orig_conv;
21762 orig_conv.inner = (void*)(orig & (~1));
21763 orig_conv.is_owned = false;
21764 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21765 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21766 uint32_t ret_ref = 0;
21767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21770 ret_ref = (uintptr_t)ret_var.inner;
21771 if (ret_var.is_owned) {
21777 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
21778 LDKChannelConfig ret_var = ChannelConfig_default();
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 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
21791 LDKChannelConfig obj_conv;
21792 obj_conv.inner = (void*)(obj & (~1));
21793 obj_conv.is_owned = false;
21794 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21795 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
21796 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21797 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21798 CVec_u8Z_free(ret_var);
21802 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
21803 LDKu8slice ser_ref;
21804 ser_ref.datalen = ser->arr_len;
21805 ser_ref.data = ser->elems;
21806 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21807 *ret_conv = ChannelConfig_read(ser_ref);
21809 return (uint32_t)ret_conv;
21812 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
21813 LDKUserConfig this_obj_conv;
21814 this_obj_conv.inner = (void*)(this_obj & (~1));
21815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21817 UserConfig_free(this_obj_conv);
21820 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
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 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
21826 uint32_t ret_ref = 0;
21827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21830 ret_ref = (uintptr_t)ret_var.inner;
21831 if (ret_var.is_owned) {
21837 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
21838 LDKUserConfig this_ptr_conv;
21839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21840 this_ptr_conv.is_owned = false;
21841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21842 LDKChannelHandshakeConfig val_conv;
21843 val_conv.inner = (void*)(val & (~1));
21844 val_conv.is_owned = (val & 1) || (val == 0);
21845 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21846 val_conv = ChannelHandshakeConfig_clone(&val_conv);
21847 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
21850 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(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 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
21856 uint32_t ret_ref = 0;
21857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21860 ret_ref = (uintptr_t)ret_var.inner;
21861 if (ret_var.is_owned) {
21867 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) {
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 LDKChannelHandshakeLimits val_conv;
21873 val_conv.inner = (void*)(val & (~1));
21874 val_conv.is_owned = (val & 1) || (val == 0);
21875 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21876 val_conv = ChannelHandshakeLimits_clone(&val_conv);
21877 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
21880 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
21881 LDKUserConfig this_ptr_conv;
21882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21883 this_ptr_conv.is_owned = false;
21884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21885 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
21886 uint32_t ret_ref = 0;
21887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21890 ret_ref = (uintptr_t)ret_var.inner;
21891 if (ret_var.is_owned) {
21897 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
21898 LDKUserConfig this_ptr_conv;
21899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21900 this_ptr_conv.is_owned = false;
21901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21902 LDKChannelConfig val_conv;
21903 val_conv.inner = (void*)(val & (~1));
21904 val_conv.is_owned = (val & 1) || (val == 0);
21905 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21906 val_conv = ChannelConfig_clone(&val_conv);
21907 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
21910 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
21911 LDKUserConfig this_ptr_conv;
21912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21913 this_ptr_conv.is_owned = false;
21914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21915 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21919 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) {
21920 LDKUserConfig this_ptr_conv;
21921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21922 this_ptr_conv.is_owned = false;
21923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21924 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21927 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
21928 LDKUserConfig this_ptr_conv;
21929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21930 this_ptr_conv.is_owned = false;
21931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21932 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21936 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21937 LDKUserConfig this_ptr_conv;
21938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21939 this_ptr_conv.is_owned = false;
21940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21941 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21944 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
21945 LDKUserConfig this_ptr_conv;
21946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21947 this_ptr_conv.is_owned = false;
21948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21949 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21953 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21954 LDKUserConfig this_ptr_conv;
21955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21956 this_ptr_conv.is_owned = false;
21957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21958 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21961 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) {
21962 LDKChannelHandshakeConfig own_channel_config_arg_conv;
21963 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
21964 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
21965 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
21966 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
21967 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
21968 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
21969 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
21970 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
21971 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
21972 LDKChannelConfig channel_options_arg_conv;
21973 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
21974 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
21975 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
21976 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
21977 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);
21978 uint32_t ret_ref = 0;
21979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21982 ret_ref = (uintptr_t)ret_var.inner;
21983 if (ret_var.is_owned) {
21989 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21990 LDKUserConfig ret_var = UserConfig_clone(arg);
21991 uint32_t ret_ref = 0;
21992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21995 ret_ref = (uintptr_t)ret_var.inner;
21996 if (ret_var.is_owned) {
22001 uint32_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
22002 LDKUserConfig arg_conv;
22003 arg_conv.inner = (void*)(arg & (~1));
22004 arg_conv.is_owned = false;
22005 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22006 uint32_t ret_conv = UserConfig_clone_ptr(&arg_conv);
22010 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
22011 LDKUserConfig orig_conv;
22012 orig_conv.inner = (void*)(orig & (~1));
22013 orig_conv.is_owned = false;
22014 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22015 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
22016 uint32_t ret_ref = 0;
22017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22020 ret_ref = (uintptr_t)ret_var.inner;
22021 if (ret_var.is_owned) {
22027 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
22028 LDKUserConfig ret_var = UserConfig_default();
22029 uint32_t ret_ref = 0;
22030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22033 ret_ref = (uintptr_t)ret_var.inner;
22034 if (ret_var.is_owned) {
22040 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
22041 LDKBestBlock this_obj_conv;
22042 this_obj_conv.inner = (void*)(this_obj & (~1));
22043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22045 BestBlock_free(this_obj_conv);
22048 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
22049 LDKBestBlock ret_var = BestBlock_clone(arg);
22050 uint32_t ret_ref = 0;
22051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22054 ret_ref = (uintptr_t)ret_var.inner;
22055 if (ret_var.is_owned) {
22060 uint32_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
22061 LDKBestBlock arg_conv;
22062 arg_conv.inner = (void*)(arg & (~1));
22063 arg_conv.is_owned = false;
22064 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22065 uint32_t ret_conv = BestBlock_clone_ptr(&arg_conv);
22069 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
22070 LDKBestBlock orig_conv;
22071 orig_conv.inner = (void*)(orig & (~1));
22072 orig_conv.is_owned = false;
22073 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22074 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
22075 uint32_t ret_ref = 0;
22076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22079 ret_ref = (uintptr_t)ret_var.inner;
22080 if (ret_var.is_owned) {
22086 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
22087 LDKNetwork network_conv = LDKNetwork_from_js(network);
22088 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
22089 uint32_t ret_ref = 0;
22090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22093 ret_ref = (uintptr_t)ret_var.inner;
22094 if (ret_var.is_owned) {
22100 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
22101 LDKThirtyTwoBytes block_hash_ref;
22102 CHECK(block_hash->arr_len == 32);
22103 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
22104 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
22105 uint32_t ret_ref = 0;
22106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22109 ret_ref = (uintptr_t)ret_var.inner;
22110 if (ret_var.is_owned) {
22116 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
22117 LDKBestBlock this_arg_conv;
22118 this_arg_conv.inner = (void*)(this_arg & (~1));
22119 this_arg_conv.is_owned = false;
22120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22121 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22122 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
22126 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
22127 LDKBestBlock this_arg_conv;
22128 this_arg_conv.inner = (void*)(this_arg & (~1));
22129 this_arg_conv.is_owned = false;
22130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22131 int32_t ret_conv = BestBlock_height(&this_arg_conv);
22135 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
22136 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
22137 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
22141 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
22142 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
22146 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
22147 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
22151 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
22152 if ((this_ptr & 1) != 0) return;
22153 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22154 CHECK_ACCESS(this_ptr_ptr);
22155 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
22156 FREE((void*)this_ptr);
22157 Access_free(this_ptr_conv);
22160 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
22161 if ((this_ptr & 1) != 0) return;
22162 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22163 CHECK_ACCESS(this_ptr_ptr);
22164 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
22165 FREE((void*)this_ptr);
22166 Listen_free(this_ptr_conv);
22169 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
22170 if ((this_ptr & 1) != 0) return;
22171 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22172 CHECK_ACCESS(this_ptr_ptr);
22173 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
22174 FREE((void*)this_ptr);
22175 Confirm_free(this_ptr_conv);
22178 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
22179 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
22180 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
22184 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
22185 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
22189 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
22190 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
22194 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
22195 if ((this_ptr & 1) != 0) return;
22196 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22197 CHECK_ACCESS(this_ptr_ptr);
22198 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
22199 FREE((void*)this_ptr);
22200 Watch_free(this_ptr_conv);
22203 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
22204 if ((this_ptr & 1) != 0) return;
22205 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22206 CHECK_ACCESS(this_ptr_ptr);
22207 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
22208 FREE((void*)this_ptr);
22209 Filter_free(this_ptr_conv);
22212 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
22213 LDKWatchedOutput this_obj_conv;
22214 this_obj_conv.inner = (void*)(this_obj & (~1));
22215 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22217 WatchedOutput_free(this_obj_conv);
22220 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
22221 LDKWatchedOutput this_ptr_conv;
22222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22223 this_ptr_conv.is_owned = false;
22224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22225 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22226 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
22230 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
22231 LDKWatchedOutput this_ptr_conv;
22232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22233 this_ptr_conv.is_owned = false;
22234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22235 LDKThirtyTwoBytes val_ref;
22236 CHECK(val->arr_len == 32);
22237 memcpy(val_ref.data, val->elems, 32); FREE(val);
22238 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
22241 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
22242 LDKWatchedOutput this_ptr_conv;
22243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22244 this_ptr_conv.is_owned = false;
22245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22246 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
22247 uint32_t ret_ref = 0;
22248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22251 ret_ref = (uintptr_t)ret_var.inner;
22252 if (ret_var.is_owned) {
22258 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
22259 LDKWatchedOutput this_ptr_conv;
22260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22261 this_ptr_conv.is_owned = false;
22262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22263 LDKOutPoint val_conv;
22264 val_conv.inner = (void*)(val & (~1));
22265 val_conv.is_owned = (val & 1) || (val == 0);
22266 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22267 val_conv = OutPoint_clone(&val_conv);
22268 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
22271 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
22272 LDKWatchedOutput this_ptr_conv;
22273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22274 this_ptr_conv.is_owned = false;
22275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22276 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
22277 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22278 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22282 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
22283 LDKWatchedOutput this_ptr_conv;
22284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22285 this_ptr_conv.is_owned = false;
22286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22287 LDKCVec_u8Z val_ref;
22288 val_ref.datalen = val->arr_len;
22289 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22290 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
22291 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
22294 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) {
22295 LDKThirtyTwoBytes block_hash_arg_ref;
22296 CHECK(block_hash_arg->arr_len == 32);
22297 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
22298 LDKOutPoint outpoint_arg_conv;
22299 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22300 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22301 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22302 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22303 LDKCVec_u8Z script_pubkey_arg_ref;
22304 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
22305 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22306 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
22307 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
22308 uint32_t ret_ref = 0;
22309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22312 ret_ref = (uintptr_t)ret_var.inner;
22313 if (ret_var.is_owned) {
22319 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
22320 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
22321 uint32_t ret_ref = 0;
22322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22325 ret_ref = (uintptr_t)ret_var.inner;
22326 if (ret_var.is_owned) {
22331 uint32_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
22332 LDKWatchedOutput arg_conv;
22333 arg_conv.inner = (void*)(arg & (~1));
22334 arg_conv.is_owned = false;
22335 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22336 uint32_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
22340 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
22341 LDKWatchedOutput orig_conv;
22342 orig_conv.inner = (void*)(orig & (~1));
22343 orig_conv.is_owned = false;
22344 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22345 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
22346 uint32_t ret_ref = 0;
22347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22350 ret_ref = (uintptr_t)ret_var.inner;
22351 if (ret_var.is_owned) {
22357 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
22358 LDKWatchedOutput o_conv;
22359 o_conv.inner = (void*)(o & (~1));
22360 o_conv.is_owned = false;
22361 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22362 int64_t ret_conv = WatchedOutput_hash(&o_conv);
22366 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
22367 if ((this_ptr & 1) != 0) return;
22368 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22369 CHECK_ACCESS(this_ptr_ptr);
22370 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
22371 FREE((void*)this_ptr);
22372 BroadcasterInterface_free(this_ptr_conv);
22375 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
22376 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
22377 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
22381 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
22382 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
22386 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
22387 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
22391 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
22392 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
22396 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
22397 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
22398 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
22399 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
22403 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_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 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
22408 FREE((void*)this_ptr);
22409 FeeEstimator_free(this_ptr_conv);
22412 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
22413 LDKMonitorUpdateId 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 MonitorUpdateId_free(this_obj_conv);
22420 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
22421 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
22422 uint32_t ret_ref = 0;
22423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22426 ret_ref = (uintptr_t)ret_var.inner;
22427 if (ret_var.is_owned) {
22432 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
22433 LDKMonitorUpdateId arg_conv;
22434 arg_conv.inner = (void*)(arg & (~1));
22435 arg_conv.is_owned = false;
22436 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22437 uint32_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
22441 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
22442 LDKMonitorUpdateId orig_conv;
22443 orig_conv.inner = (void*)(orig & (~1));
22444 orig_conv.is_owned = false;
22445 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22446 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
22447 uint32_t ret_ref = 0;
22448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22451 ret_ref = (uintptr_t)ret_var.inner;
22452 if (ret_var.is_owned) {
22458 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
22459 LDKMonitorUpdateId o_conv;
22460 o_conv.inner = (void*)(o & (~1));
22461 o_conv.is_owned = false;
22462 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22463 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
22467 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
22468 LDKMonitorUpdateId a_conv;
22469 a_conv.inner = (void*)(a & (~1));
22470 a_conv.is_owned = false;
22471 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22472 LDKMonitorUpdateId b_conv;
22473 b_conv.inner = (void*)(b & (~1));
22474 b_conv.is_owned = false;
22475 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22476 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
22480 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
22481 if ((this_ptr & 1) != 0) return;
22482 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22483 CHECK_ACCESS(this_ptr_ptr);
22484 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22485 FREE((void*)this_ptr);
22486 Persist_free(this_ptr_conv);
22489 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
22490 LDKLockedChannelMonitor this_obj_conv;
22491 this_obj_conv.inner = (void*)(this_obj & (~1));
22492 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22494 LockedChannelMonitor_free(this_obj_conv);
22497 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
22498 LDKChainMonitor this_obj_conv;
22499 this_obj_conv.inner = (void*)(this_obj & (~1));
22500 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22502 ChainMonitor_free(this_obj_conv);
22505 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) {
22506 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
22507 CHECK_ACCESS(chain_source_ptr);
22508 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22509 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
22510 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22511 // Manually implement clone for Java trait instances
22512 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22513 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22514 LDKFilter_JCalls_cloned(&chain_source_conv.some);
22517 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22518 CHECK_ACCESS(broadcaster_ptr);
22519 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22520 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22521 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22522 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22524 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22525 CHECK_ACCESS(logger_ptr);
22526 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22527 if (logger_conv.free == LDKLogger_JCalls_free) {
22528 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22529 LDKLogger_JCalls_cloned(&logger_conv);
22531 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
22532 CHECK_ACCESS(feeest_ptr);
22533 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22534 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22536 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22538 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
22539 CHECK_ACCESS(persister_ptr);
22540 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22541 if (persister_conv.free == LDKPersist_JCalls_free) {
22542 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22543 LDKPersist_JCalls_cloned(&persister_conv);
22545 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22546 uint32_t ret_ref = 0;
22547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22550 ret_ref = (uintptr_t)ret_var.inner;
22551 if (ret_var.is_owned) {
22557 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
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 LDKCVec_ChannelDetailsZ ignored_channels_constr;
22563 ignored_channels_constr.datalen = ignored_channels->arr_len;
22564 if (ignored_channels_constr.datalen > 0)
22565 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22567 ignored_channels_constr.data = NULL;
22568 uint32_t* ignored_channels_vals = ignored_channels->elems;
22569 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22570 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
22571 LDKChannelDetails ignored_channels_conv_16_conv;
22572 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
22573 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
22574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22575 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22576 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22578 FREE(ignored_channels);
22579 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22580 uint32_tArray ret_arr = NULL;
22581 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22582 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22583 for (size_t j = 0; j < ret_var.datalen; j++) {
22584 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22585 *ret_conv_9_copy = ret_var.data[j];
22586 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
22587 ret_arr_ptr[j] = ret_conv_9_ref;
22590 FREE(ret_var.data);
22594 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
22595 LDKChainMonitor this_arg_conv;
22596 this_arg_conv.inner = (void*)(this_arg & (~1));
22597 this_arg_conv.is_owned = false;
22598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22599 LDKOutPoint funding_txo_conv;
22600 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22601 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22602 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22603 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22604 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22605 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22606 return (uint32_t)ret_conv;
22609 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
22610 LDKChainMonitor this_arg_conv;
22611 this_arg_conv.inner = (void*)(this_arg & (~1));
22612 this_arg_conv.is_owned = false;
22613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22614 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22615 uint32_tArray ret_arr = NULL;
22616 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22617 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22618 for (size_t k = 0; k < ret_var.datalen; k++) {
22619 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22620 uint32_t ret_conv_10_ref = 0;
22621 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22622 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22624 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
22625 if (ret_conv_10_var.is_owned) {
22626 ret_conv_10_ref |= 1;
22628 ret_arr_ptr[k] = ret_conv_10_ref;
22631 FREE(ret_var.data);
22635 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) {
22636 LDKChainMonitor this_arg_conv;
22637 this_arg_conv.inner = (void*)(this_arg & (~1));
22638 this_arg_conv.is_owned = false;
22639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22640 LDKOutPoint funding_txo_conv;
22641 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22642 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22643 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22644 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22645 LDKMonitorUpdateId completed_update_id_conv;
22646 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
22647 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
22648 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22649 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22650 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22651 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22652 return (uint32_t)ret_conv;
22655 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
22656 LDKChainMonitor this_arg_conv;
22657 this_arg_conv.inner = (void*)(this_arg & (~1));
22658 this_arg_conv.is_owned = false;
22659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22660 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22661 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22662 return (uint32_t)ret_ret;
22665 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
22666 LDKChainMonitor this_arg_conv;
22667 this_arg_conv.inner = (void*)(this_arg & (~1));
22668 this_arg_conv.is_owned = false;
22669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22670 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22671 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22672 return (uint32_t)ret_ret;
22675 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
22676 LDKChainMonitor this_arg_conv;
22677 this_arg_conv.inner = (void*)(this_arg & (~1));
22678 this_arg_conv.is_owned = false;
22679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22680 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22681 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22682 return (uint32_t)ret_ret;
22685 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
22686 LDKChainMonitor this_arg_conv;
22687 this_arg_conv.inner = (void*)(this_arg & (~1));
22688 this_arg_conv.is_owned = false;
22689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22690 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22691 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22692 return (uint32_t)ret_ret;
22695 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
22696 LDKChannelMonitorUpdate this_obj_conv;
22697 this_obj_conv.inner = (void*)(this_obj & (~1));
22698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22700 ChannelMonitorUpdate_free(this_obj_conv);
22703 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
22704 LDKChannelMonitorUpdate this_ptr_conv;
22705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22706 this_ptr_conv.is_owned = false;
22707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22708 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22712 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
22713 LDKChannelMonitorUpdate this_ptr_conv;
22714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22715 this_ptr_conv.is_owned = false;
22716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22717 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22720 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22721 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22722 uint32_t ret_ref = 0;
22723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22726 ret_ref = (uintptr_t)ret_var.inner;
22727 if (ret_var.is_owned) {
22732 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
22733 LDKChannelMonitorUpdate arg_conv;
22734 arg_conv.inner = (void*)(arg & (~1));
22735 arg_conv.is_owned = false;
22736 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22737 uint32_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22741 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
22742 LDKChannelMonitorUpdate orig_conv;
22743 orig_conv.inner = (void*)(orig & (~1));
22744 orig_conv.is_owned = false;
22745 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22746 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22747 uint32_t ret_ref = 0;
22748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22751 ret_ref = (uintptr_t)ret_var.inner;
22752 if (ret_var.is_owned) {
22758 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
22759 LDKChannelMonitorUpdate obj_conv;
22760 obj_conv.inner = (void*)(obj & (~1));
22761 obj_conv.is_owned = false;
22762 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22763 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22764 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22765 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22766 CVec_u8Z_free(ret_var);
22770 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
22771 LDKu8slice ser_ref;
22772 ser_ref.datalen = ser->arr_len;
22773 ser_ref.data = ser->elems;
22774 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22775 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22777 return (uint32_t)ret_conv;
22780 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
22781 if ((this_ptr & 1) != 0) return;
22782 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22783 CHECK_ACCESS(this_ptr_ptr);
22784 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22785 FREE((void*)this_ptr);
22786 MonitorEvent_free(this_ptr_conv);
22789 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22790 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22791 *ret_copy = MonitorEvent_clone(arg);
22792 uint32_t ret_ref = (uintptr_t)ret_copy;
22795 uint32_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
22796 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
22797 uint32_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
22801 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
22802 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
22803 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22804 *ret_copy = MonitorEvent_clone(orig_conv);
22805 uint32_t ret_ref = (uintptr_t)ret_copy;
22809 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
22810 LDKHTLCUpdate a_conv;
22811 a_conv.inner = (void*)(a & (~1));
22812 a_conv.is_owned = (a & 1) || (a == 0);
22813 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22814 a_conv = HTLCUpdate_clone(&a_conv);
22815 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22816 *ret_copy = MonitorEvent_htlcevent(a_conv);
22817 uint32_t ret_ref = (uintptr_t)ret_copy;
22821 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
22822 LDKOutPoint a_conv;
22823 a_conv.inner = (void*)(a & (~1));
22824 a_conv.is_owned = (a & 1) || (a == 0);
22825 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22826 a_conv = OutPoint_clone(&a_conv);
22827 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22828 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22829 uint32_t ret_ref = (uintptr_t)ret_copy;
22833 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
22834 LDKOutPoint funding_txo_conv;
22835 funding_txo_conv.inner = (void*)(funding_txo & (~1));
22836 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22838 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22839 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22840 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22841 uint32_t ret_ref = (uintptr_t)ret_copy;
22845 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
22846 LDKOutPoint a_conv;
22847 a_conv.inner = (void*)(a & (~1));
22848 a_conv.is_owned = (a & 1) || (a == 0);
22849 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22850 a_conv = OutPoint_clone(&a_conv);
22851 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22852 *ret_copy = MonitorEvent_update_failed(a_conv);
22853 uint32_t ret_ref = (uintptr_t)ret_copy;
22857 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
22858 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
22859 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22860 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22861 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22862 CVec_u8Z_free(ret_var);
22866 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
22867 LDKu8slice ser_ref;
22868 ser_ref.datalen = ser->arr_len;
22869 ser_ref.data = ser->elems;
22870 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22871 *ret_conv = MonitorEvent_read(ser_ref);
22873 return (uint32_t)ret_conv;
22876 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
22877 LDKHTLCUpdate this_obj_conv;
22878 this_obj_conv.inner = (void*)(this_obj & (~1));
22879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22881 HTLCUpdate_free(this_obj_conv);
22884 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22885 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22886 uint32_t ret_ref = 0;
22887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22890 ret_ref = (uintptr_t)ret_var.inner;
22891 if (ret_var.is_owned) {
22896 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
22897 LDKHTLCUpdate arg_conv;
22898 arg_conv.inner = (void*)(arg & (~1));
22899 arg_conv.is_owned = false;
22900 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22901 uint32_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
22905 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
22906 LDKHTLCUpdate orig_conv;
22907 orig_conv.inner = (void*)(orig & (~1));
22908 orig_conv.is_owned = false;
22909 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22910 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22911 uint32_t ret_ref = 0;
22912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22915 ret_ref = (uintptr_t)ret_var.inner;
22916 if (ret_var.is_owned) {
22922 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
22923 LDKHTLCUpdate obj_conv;
22924 obj_conv.inner = (void*)(obj & (~1));
22925 obj_conv.is_owned = false;
22926 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22927 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22928 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22929 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22930 CVec_u8Z_free(ret_var);
22934 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22935 LDKu8slice ser_ref;
22936 ser_ref.datalen = ser->arr_len;
22937 ser_ref.data = ser->elems;
22938 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22939 *ret_conv = HTLCUpdate_read(ser_ref);
22941 return (uint32_t)ret_conv;
22944 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
22945 if ((this_ptr & 1) != 0) return;
22946 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22947 CHECK_ACCESS(this_ptr_ptr);
22948 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22949 FREE((void*)this_ptr);
22950 Balance_free(this_ptr_conv);
22953 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22954 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22955 *ret_copy = Balance_clone(arg);
22956 uint32_t ret_ref = (uintptr_t)ret_copy;
22959 uint32_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
22960 LDKBalance* arg_conv = (LDKBalance*)arg;
22961 uint32_t ret_conv = Balance_clone_ptr(arg_conv);
22965 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
22966 LDKBalance* orig_conv = (LDKBalance*)orig;
22967 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22968 *ret_copy = Balance_clone(orig_conv);
22969 uint32_t ret_ref = (uintptr_t)ret_copy;
22973 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22974 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22975 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22976 uint32_t ret_ref = (uintptr_t)ret_copy;
22980 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22981 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22982 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22983 uint32_t ret_ref = (uintptr_t)ret_copy;
22987 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22988 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22989 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22990 uint32_t ret_ref = (uintptr_t)ret_copy;
22994 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) {
22995 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22996 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22997 uint32_t ret_ref = (uintptr_t)ret_copy;
23001 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
23002 LDKBalance* a_conv = (LDKBalance*)a;
23003 LDKBalance* b_conv = (LDKBalance*)b;
23004 jboolean ret_conv = Balance_eq(a_conv, b_conv);
23008 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
23009 LDKChannelMonitor this_obj_conv;
23010 this_obj_conv.inner = (void*)(this_obj & (~1));
23011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23013 ChannelMonitor_free(this_obj_conv);
23016 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
23017 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
23018 uint32_t ret_ref = 0;
23019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23022 ret_ref = (uintptr_t)ret_var.inner;
23023 if (ret_var.is_owned) {
23028 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
23029 LDKChannelMonitor arg_conv;
23030 arg_conv.inner = (void*)(arg & (~1));
23031 arg_conv.is_owned = false;
23032 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23033 uint32_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
23037 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
23038 LDKChannelMonitor orig_conv;
23039 orig_conv.inner = (void*)(orig & (~1));
23040 orig_conv.is_owned = false;
23041 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23042 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
23043 uint32_t ret_ref = 0;
23044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23047 ret_ref = (uintptr_t)ret_var.inner;
23048 if (ret_var.is_owned) {
23054 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
23055 LDKChannelMonitor obj_conv;
23056 obj_conv.inner = (void*)(obj & (~1));
23057 obj_conv.is_owned = false;
23058 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23059 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
23060 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23061 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23062 CVec_u8Z_free(ret_var);
23066 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) {
23067 LDKChannelMonitor this_arg_conv;
23068 this_arg_conv.inner = (void*)(this_arg & (~1));
23069 this_arg_conv.is_owned = false;
23070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23071 LDKChannelMonitorUpdate updates_conv;
23072 updates_conv.inner = (void*)(updates & (~1));
23073 updates_conv.is_owned = false;
23074 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23075 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23076 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
23077 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
23078 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23079 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
23080 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
23081 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23082 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23083 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23084 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23085 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
23086 return (uint32_t)ret_conv;
23089 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
23090 LDKChannelMonitor this_arg_conv;
23091 this_arg_conv.inner = (void*)(this_arg & (~1));
23092 this_arg_conv.is_owned = false;
23093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23094 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
23098 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
23099 LDKChannelMonitor this_arg_conv;
23100 this_arg_conv.inner = (void*)(this_arg & (~1));
23101 this_arg_conv.is_owned = false;
23102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23103 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
23104 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
23105 return ((uint32_t)ret_conv);
23108 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
23109 LDKChannelMonitor this_arg_conv;
23110 this_arg_conv.inner = (void*)(this_arg & (~1));
23111 this_arg_conv.is_owned = false;
23112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23113 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
23114 uint32_tArray ret_arr = NULL;
23115 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23116 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23117 for (size_t o = 0; o < ret_var.datalen; o++) {
23118 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
23119 *ret_conv_40_conv = ret_var.data[o];
23120 ret_arr_ptr[o] = ((uint32_t)ret_conv_40_conv);
23123 FREE(ret_var.data);
23127 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
23128 LDKChannelMonitor this_arg_conv;
23129 this_arg_conv.inner = (void*)(this_arg & (~1));
23130 this_arg_conv.is_owned = false;
23131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23132 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
23133 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
23134 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
23135 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
23138 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) {
23139 LDKChannelMonitor this_arg_conv;
23140 this_arg_conv.inner = (void*)(this_arg & (~1));
23141 this_arg_conv.is_owned = false;
23142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23143 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
23144 uint32_tArray ret_arr = NULL;
23145 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23146 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23147 for (size_t o = 0; o < ret_var.datalen; o++) {
23148 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23149 *ret_conv_14_copy = ret_var.data[o];
23150 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
23151 ret_arr_ptr[o] = ret_conv_14_ref;
23154 FREE(ret_var.data);
23158 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
23159 LDKChannelMonitor this_arg_conv;
23160 this_arg_conv.inner = (void*)(this_arg & (~1));
23161 this_arg_conv.is_owned = false;
23162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23163 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
23164 uint32_tArray ret_arr = NULL;
23165 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23166 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23167 for (size_t h = 0; h < ret_var.datalen; h++) {
23168 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23169 *ret_conv_7_copy = ret_var.data[h];
23170 uint32_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
23171 ret_arr_ptr[h] = ret_conv_7_ref;
23174 FREE(ret_var.data);
23178 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) {
23179 LDKChannelMonitor this_arg_conv;
23180 this_arg_conv.inner = (void*)(this_arg & (~1));
23181 this_arg_conv.is_owned = false;
23182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23183 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23184 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
23185 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
23186 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
23187 ptrArray ret_arr = NULL;
23188 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23189 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23190 for (size_t m = 0; m < ret_var.datalen; m++) {
23191 LDKTransaction ret_conv_12_var = ret_var.data[m];
23192 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
23193 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
23194 Transaction_free(ret_conv_12_var);
23195 ret_arr_ptr[m] = ret_conv_12_arr;
23198 FREE(ret_var.data);
23202 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) {
23203 LDKChannelMonitor this_arg_conv;
23204 this_arg_conv.inner = (void*)(this_arg & (~1));
23205 this_arg_conv.is_owned = false;
23206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23207 unsigned char header_arr[80];
23208 CHECK(header->arr_len == 80);
23209 memcpy(header_arr, header->elems, 80); FREE(header);
23210 unsigned char (*header_ref)[80] = &header_arr;
23211 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23212 txdata_constr.datalen = txdata->arr_len;
23213 if (txdata_constr.datalen > 0)
23214 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23216 txdata_constr.data = NULL;
23217 uint32_t* txdata_vals = txdata->elems;
23218 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23219 uint32_t txdata_conv_28 = txdata_vals[c];
23220 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23221 CHECK_ACCESS(txdata_conv_28_ptr);
23222 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23223 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23224 txdata_constr.data[c] = txdata_conv_28_conv;
23227 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23228 CHECK_ACCESS(broadcaster_ptr);
23229 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23230 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23231 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23232 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23234 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23235 CHECK_ACCESS(fee_estimator_ptr);
23236 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23237 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23238 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23239 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23241 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23242 CHECK_ACCESS(logger_ptr);
23243 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23244 if (logger_conv.free == LDKLogger_JCalls_free) {
23245 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23246 LDKLogger_JCalls_cloned(&logger_conv);
23248 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);
23249 uint32_tArray ret_arr = NULL;
23250 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23251 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23252 for (size_t n = 0; n < ret_var.datalen; n++) {
23253 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23254 *ret_conv_39_conv = ret_var.data[n];
23255 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23258 FREE(ret_var.data);
23262 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) {
23263 LDKChannelMonitor this_arg_conv;
23264 this_arg_conv.inner = (void*)(this_arg & (~1));
23265 this_arg_conv.is_owned = false;
23266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23267 unsigned char header_arr[80];
23268 CHECK(header->arr_len == 80);
23269 memcpy(header_arr, header->elems, 80); FREE(header);
23270 unsigned char (*header_ref)[80] = &header_arr;
23271 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23272 CHECK_ACCESS(broadcaster_ptr);
23273 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23274 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23276 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23278 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23279 CHECK_ACCESS(fee_estimator_ptr);
23280 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23281 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23283 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23285 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23286 CHECK_ACCESS(logger_ptr);
23287 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23288 if (logger_conv.free == LDKLogger_JCalls_free) {
23289 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23290 LDKLogger_JCalls_cloned(&logger_conv);
23292 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23295 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) {
23296 LDKChannelMonitor this_arg_conv;
23297 this_arg_conv.inner = (void*)(this_arg & (~1));
23298 this_arg_conv.is_owned = false;
23299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23300 unsigned char header_arr[80];
23301 CHECK(header->arr_len == 80);
23302 memcpy(header_arr, header->elems, 80); FREE(header);
23303 unsigned char (*header_ref)[80] = &header_arr;
23304 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23305 txdata_constr.datalen = txdata->arr_len;
23306 if (txdata_constr.datalen > 0)
23307 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23309 txdata_constr.data = NULL;
23310 uint32_t* txdata_vals = txdata->elems;
23311 for (size_t c = 0; c < txdata_constr.datalen; c++) {
23312 uint32_t txdata_conv_28 = txdata_vals[c];
23313 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
23314 CHECK_ACCESS(txdata_conv_28_ptr);
23315 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23316 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
23317 txdata_constr.data[c] = txdata_conv_28_conv;
23320 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23321 CHECK_ACCESS(broadcaster_ptr);
23322 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23323 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23325 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23327 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23328 CHECK_ACCESS(fee_estimator_ptr);
23329 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23330 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23331 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23332 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23334 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23335 CHECK_ACCESS(logger_ptr);
23336 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23337 if (logger_conv.free == LDKLogger_JCalls_free) {
23338 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23339 LDKLogger_JCalls_cloned(&logger_conv);
23341 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);
23342 uint32_tArray ret_arr = NULL;
23343 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23344 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23345 for (size_t n = 0; n < ret_var.datalen; n++) {
23346 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23347 *ret_conv_39_conv = ret_var.data[n];
23348 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23351 FREE(ret_var.data);
23355 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) {
23356 LDKChannelMonitor this_arg_conv;
23357 this_arg_conv.inner = (void*)(this_arg & (~1));
23358 this_arg_conv.is_owned = false;
23359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23360 unsigned char txid_arr[32];
23361 CHECK(txid->arr_len == 32);
23362 memcpy(txid_arr, txid->elems, 32); FREE(txid);
23363 unsigned char (*txid_ref)[32] = &txid_arr;
23364 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23365 CHECK_ACCESS(broadcaster_ptr);
23366 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23367 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23368 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23369 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23371 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23372 CHECK_ACCESS(fee_estimator_ptr);
23373 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23374 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23375 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23376 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23378 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23379 CHECK_ACCESS(logger_ptr);
23380 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23381 if (logger_conv.free == LDKLogger_JCalls_free) {
23382 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23383 LDKLogger_JCalls_cloned(&logger_conv);
23385 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
23388 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) {
23389 LDKChannelMonitor this_arg_conv;
23390 this_arg_conv.inner = (void*)(this_arg & (~1));
23391 this_arg_conv.is_owned = false;
23392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23393 unsigned char header_arr[80];
23394 CHECK(header->arr_len == 80);
23395 memcpy(header_arr, header->elems, 80); FREE(header);
23396 unsigned char (*header_ref)[80] = &header_arr;
23397 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23398 CHECK_ACCESS(broadcaster_ptr);
23399 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23400 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23401 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23402 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23404 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
23405 CHECK_ACCESS(fee_estimator_ptr);
23406 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23407 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23408 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23409 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23411 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23412 CHECK_ACCESS(logger_ptr);
23413 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23414 if (logger_conv.free == LDKLogger_JCalls_free) {
23415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23416 LDKLogger_JCalls_cloned(&logger_conv);
23418 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23419 uint32_tArray ret_arr = NULL;
23420 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23421 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23422 for (size_t n = 0; n < ret_var.datalen; n++) {
23423 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23424 *ret_conv_39_conv = ret_var.data[n];
23425 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
23428 FREE(ret_var.data);
23432 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
23433 LDKChannelMonitor this_arg_conv;
23434 this_arg_conv.inner = (void*)(this_arg & (~1));
23435 this_arg_conv.is_owned = false;
23436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23437 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
23438 ptrArray ret_arr = NULL;
23439 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23440 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
23441 for (size_t m = 0; m < ret_var.datalen; m++) {
23442 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
23443 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
23444 ret_arr_ptr[m] = ret_conv_12_arr;
23447 FREE(ret_var.data);
23451 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
23452 LDKChannelMonitor this_arg_conv;
23453 this_arg_conv.inner = (void*)(this_arg & (~1));
23454 this_arg_conv.is_owned = false;
23455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23456 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
23457 uint32_t ret_ref = 0;
23458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23461 ret_ref = (uintptr_t)ret_var.inner;
23462 if (ret_var.is_owned) {
23468 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
23469 LDKChannelMonitor this_arg_conv;
23470 this_arg_conv.inner = (void*)(this_arg & (~1));
23471 this_arg_conv.is_owned = false;
23472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23473 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23474 uint32_tArray ret_arr = NULL;
23475 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
23476 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
23477 for (size_t j = 0; j < ret_var.datalen; j++) {
23478 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23479 *ret_conv_9_copy = ret_var.data[j];
23480 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
23481 ret_arr_ptr[j] = ret_conv_9_ref;
23484 FREE(ret_var.data);
23488 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
23489 LDKu8slice ser_ref;
23490 ser_ref.datalen = ser->arr_len;
23491 ser_ref.data = ser->elems;
23492 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
23493 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23494 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23495 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23496 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23498 return (uint32_t)ret_conv;
23501 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
23502 LDKOutPoint this_obj_conv;
23503 this_obj_conv.inner = (void*)(this_obj & (~1));
23504 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23506 OutPoint_free(this_obj_conv);
23509 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
23510 LDKOutPoint this_ptr_conv;
23511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23512 this_ptr_conv.is_owned = false;
23513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23514 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23515 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
23519 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
23520 LDKOutPoint this_ptr_conv;
23521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23522 this_ptr_conv.is_owned = false;
23523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23524 LDKThirtyTwoBytes val_ref;
23525 CHECK(val->arr_len == 32);
23526 memcpy(val_ref.data, val->elems, 32); FREE(val);
23527 OutPoint_set_txid(&this_ptr_conv, val_ref);
23530 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
23531 LDKOutPoint this_ptr_conv;
23532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23533 this_ptr_conv.is_owned = false;
23534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23535 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
23539 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
23540 LDKOutPoint this_ptr_conv;
23541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23542 this_ptr_conv.is_owned = false;
23543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23544 OutPoint_set_index(&this_ptr_conv, val);
23547 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
23548 LDKThirtyTwoBytes txid_arg_ref;
23549 CHECK(txid_arg->arr_len == 32);
23550 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
23551 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23552 uint32_t ret_ref = 0;
23553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23556 ret_ref = (uintptr_t)ret_var.inner;
23557 if (ret_var.is_owned) {
23563 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23564 LDKOutPoint ret_var = OutPoint_clone(arg);
23565 uint32_t ret_ref = 0;
23566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23569 ret_ref = (uintptr_t)ret_var.inner;
23570 if (ret_var.is_owned) {
23575 uint32_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
23576 LDKOutPoint arg_conv;
23577 arg_conv.inner = (void*)(arg & (~1));
23578 arg_conv.is_owned = false;
23579 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23580 uint32_t ret_conv = OutPoint_clone_ptr(&arg_conv);
23584 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
23585 LDKOutPoint orig_conv;
23586 orig_conv.inner = (void*)(orig & (~1));
23587 orig_conv.is_owned = false;
23588 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23589 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23590 uint32_t ret_ref = 0;
23591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23594 ret_ref = (uintptr_t)ret_var.inner;
23595 if (ret_var.is_owned) {
23601 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
23602 LDKOutPoint a_conv;
23603 a_conv.inner = (void*)(a & (~1));
23604 a_conv.is_owned = false;
23605 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23606 LDKOutPoint b_conv;
23607 b_conv.inner = (void*)(b & (~1));
23608 b_conv.is_owned = false;
23609 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23610 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
23614 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
23615 LDKOutPoint o_conv;
23616 o_conv.inner = (void*)(o & (~1));
23617 o_conv.is_owned = false;
23618 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23619 int64_t ret_conv = OutPoint_hash(&o_conv);
23623 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
23624 LDKOutPoint this_arg_conv;
23625 this_arg_conv.inner = (void*)(this_arg & (~1));
23626 this_arg_conv.is_owned = false;
23627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23628 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23629 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
23633 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
23634 LDKOutPoint obj_conv;
23635 obj_conv.inner = (void*)(obj & (~1));
23636 obj_conv.is_owned = false;
23637 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23638 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23639 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23640 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23641 CVec_u8Z_free(ret_var);
23645 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
23646 LDKu8slice ser_ref;
23647 ser_ref.datalen = ser->arr_len;
23648 ser_ref.data = ser->elems;
23649 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23650 *ret_conv = OutPoint_read(ser_ref);
23652 return (uint32_t)ret_conv;
23655 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
23656 LDKDelayedPaymentOutputDescriptor this_obj_conv;
23657 this_obj_conv.inner = (void*)(this_obj & (~1));
23658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23660 DelayedPaymentOutputDescriptor_free(this_obj_conv);
23663 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23664 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23666 this_ptr_conv.is_owned = false;
23667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23668 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23669 uint32_t ret_ref = 0;
23670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23673 ret_ref = (uintptr_t)ret_var.inner;
23674 if (ret_var.is_owned) {
23680 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23681 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23683 this_ptr_conv.is_owned = false;
23684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23685 LDKOutPoint val_conv;
23686 val_conv.inner = (void*)(val & (~1));
23687 val_conv.is_owned = (val & 1) || (val == 0);
23688 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23689 val_conv = OutPoint_clone(&val_conv);
23690 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23693 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
23694 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23696 this_ptr_conv.is_owned = false;
23697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23698 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23699 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23703 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23704 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23706 this_ptr_conv.is_owned = false;
23707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23708 LDKPublicKey val_ref;
23709 CHECK(val->arr_len == 33);
23710 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23711 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23714 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
23715 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23717 this_ptr_conv.is_owned = false;
23718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23719 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23723 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
23724 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23726 this_ptr_conv.is_owned = false;
23727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23728 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23731 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23732 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23734 this_ptr_conv.is_owned = false;
23735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23736 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23737 CHECK_ACCESS(val_ptr);
23738 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23739 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23740 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23743 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
23744 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23746 this_ptr_conv.is_owned = false;
23747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23748 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23749 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
23753 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
23754 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23756 this_ptr_conv.is_owned = false;
23757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23758 LDKPublicKey val_ref;
23759 CHECK(val->arr_len == 33);
23760 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23761 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23764 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23765 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23767 this_ptr_conv.is_owned = false;
23768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23769 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23770 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23774 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23775 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23777 this_ptr_conv.is_owned = false;
23778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23779 LDKThirtyTwoBytes val_ref;
23780 CHECK(val->arr_len == 32);
23781 memcpy(val_ref.data, val->elems, 32); FREE(val);
23782 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23785 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23786 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23788 this_ptr_conv.is_owned = false;
23789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23790 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23794 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23795 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23797 this_ptr_conv.is_owned = false;
23798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23799 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23802 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) {
23803 LDKOutPoint outpoint_arg_conv;
23804 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23805 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23806 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23807 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23808 LDKPublicKey per_commitment_point_arg_ref;
23809 CHECK(per_commitment_point_arg->arr_len == 33);
23810 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
23811 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23812 CHECK_ACCESS(output_arg_ptr);
23813 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23814 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23815 LDKPublicKey revocation_pubkey_arg_ref;
23816 CHECK(revocation_pubkey_arg->arr_len == 33);
23817 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
23818 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23819 CHECK(channel_keys_id_arg->arr_len == 32);
23820 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23821 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);
23822 uint32_t ret_ref = 0;
23823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23826 ret_ref = (uintptr_t)ret_var.inner;
23827 if (ret_var.is_owned) {
23833 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23834 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23835 uint32_t ret_ref = 0;
23836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23839 ret_ref = (uintptr_t)ret_var.inner;
23840 if (ret_var.is_owned) {
23845 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
23846 LDKDelayedPaymentOutputDescriptor arg_conv;
23847 arg_conv.inner = (void*)(arg & (~1));
23848 arg_conv.is_owned = false;
23849 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23850 uint32_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23854 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
23855 LDKDelayedPaymentOutputDescriptor orig_conv;
23856 orig_conv.inner = (void*)(orig & (~1));
23857 orig_conv.is_owned = false;
23858 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23859 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
23860 uint32_t ret_ref = 0;
23861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23864 ret_ref = (uintptr_t)ret_var.inner;
23865 if (ret_var.is_owned) {
23871 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
23872 LDKDelayedPaymentOutputDescriptor obj_conv;
23873 obj_conv.inner = (void*)(obj & (~1));
23874 obj_conv.is_owned = false;
23875 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23876 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23877 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23878 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23879 CVec_u8Z_free(ret_var);
23883 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
23884 LDKu8slice ser_ref;
23885 ser_ref.datalen = ser->arr_len;
23886 ser_ref.data = ser->elems;
23887 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23888 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23890 return (uint32_t)ret_conv;
23893 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
23894 LDKStaticPaymentOutputDescriptor this_obj_conv;
23895 this_obj_conv.inner = (void*)(this_obj & (~1));
23896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23898 StaticPaymentOutputDescriptor_free(this_obj_conv);
23901 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
23902 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23904 this_ptr_conv.is_owned = false;
23905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23906 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23907 uint32_t ret_ref = 0;
23908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23911 ret_ref = (uintptr_t)ret_var.inner;
23912 if (ret_var.is_owned) {
23918 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
23919 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23921 this_ptr_conv.is_owned = false;
23922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23923 LDKOutPoint val_conv;
23924 val_conv.inner = (void*)(val & (~1));
23925 val_conv.is_owned = (val & 1) || (val == 0);
23926 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23927 val_conv = OutPoint_clone(&val_conv);
23928 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23931 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
23932 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23934 this_ptr_conv.is_owned = false;
23935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23936 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
23937 CHECK_ACCESS(val_ptr);
23938 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23939 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
23940 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23943 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
23944 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23946 this_ptr_conv.is_owned = false;
23947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23948 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23949 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23953 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
23954 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23956 this_ptr_conv.is_owned = false;
23957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23958 LDKThirtyTwoBytes val_ref;
23959 CHECK(val->arr_len == 32);
23960 memcpy(val_ref.data, val->elems, 32); FREE(val);
23961 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23964 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
23965 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23967 this_ptr_conv.is_owned = false;
23968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23969 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23973 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
23974 LDKStaticPaymentOutputDescriptor this_ptr_conv;
23975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23976 this_ptr_conv.is_owned = false;
23977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23978 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23981 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) {
23982 LDKOutPoint outpoint_arg_conv;
23983 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23984 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23985 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23986 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23987 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
23988 CHECK_ACCESS(output_arg_ptr);
23989 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23990 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
23991 LDKThirtyTwoBytes channel_keys_id_arg_ref;
23992 CHECK(channel_keys_id_arg->arr_len == 32);
23993 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23994 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23995 uint32_t ret_ref = 0;
23996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23999 ret_ref = (uintptr_t)ret_var.inner;
24000 if (ret_var.is_owned) {
24006 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
24007 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
24008 uint32_t ret_ref = 0;
24009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24012 ret_ref = (uintptr_t)ret_var.inner;
24013 if (ret_var.is_owned) {
24018 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
24019 LDKStaticPaymentOutputDescriptor arg_conv;
24020 arg_conv.inner = (void*)(arg & (~1));
24021 arg_conv.is_owned = false;
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24023 uint32_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
24027 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
24028 LDKStaticPaymentOutputDescriptor orig_conv;
24029 orig_conv.inner = (void*)(orig & (~1));
24030 orig_conv.is_owned = false;
24031 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24032 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
24033 uint32_t ret_ref = 0;
24034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24037 ret_ref = (uintptr_t)ret_var.inner;
24038 if (ret_var.is_owned) {
24044 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
24045 LDKStaticPaymentOutputDescriptor obj_conv;
24046 obj_conv.inner = (void*)(obj & (~1));
24047 obj_conv.is_owned = false;
24048 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24049 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
24050 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24051 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24052 CVec_u8Z_free(ret_var);
24056 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
24057 LDKu8slice ser_ref;
24058 ser_ref.datalen = ser->arr_len;
24059 ser_ref.data = ser->elems;
24060 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24061 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
24063 return (uint32_t)ret_conv;
24066 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_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 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
24071 FREE((void*)this_ptr);
24072 SpendableOutputDescriptor_free(this_ptr_conv);
24075 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
24076 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24077 *ret_copy = SpendableOutputDescriptor_clone(arg);
24078 uint32_t ret_ref = (uintptr_t)ret_copy;
24081 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
24082 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
24083 uint32_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
24087 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
24088 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
24089 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24090 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
24091 uint32_t ret_ref = (uintptr_t)ret_copy;
24095 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
24096 LDKOutPoint outpoint_conv;
24097 outpoint_conv.inner = (void*)(outpoint & (~1));
24098 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
24099 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
24100 outpoint_conv = OutPoint_clone(&outpoint_conv);
24101 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
24102 CHECK_ACCESS(output_ptr);
24103 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
24104 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
24105 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24106 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
24107 uint32_t ret_ref = (uintptr_t)ret_copy;
24111 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
24112 LDKDelayedPaymentOutputDescriptor a_conv;
24113 a_conv.inner = (void*)(a & (~1));
24114 a_conv.is_owned = (a & 1) || (a == 0);
24115 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24116 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
24117 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24118 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
24119 uint32_t ret_ref = (uintptr_t)ret_copy;
24123 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
24124 LDKStaticPaymentOutputDescriptor a_conv;
24125 a_conv.inner = (void*)(a & (~1));
24126 a_conv.is_owned = (a & 1) || (a == 0);
24127 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24128 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
24129 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
24130 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
24131 uint32_t ret_ref = (uintptr_t)ret_copy;
24135 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
24136 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
24137 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
24138 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24139 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24140 CVec_u8Z_free(ret_var);
24144 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
24145 LDKu8slice ser_ref;
24146 ser_ref.datalen = ser->arr_len;
24147 ser_ref.data = ser->elems;
24148 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
24149 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
24151 return (uint32_t)ret_conv;
24154 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
24155 if ((this_ptr & 1) != 0) return;
24156 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24157 CHECK_ACCESS(this_ptr_ptr);
24158 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
24159 FREE((void*)this_ptr);
24160 BaseSign_free(this_ptr_conv);
24163 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
24164 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24165 *ret_ret = Sign_clone(arg);
24166 return (uint32_t)ret_ret;
24168 uint32_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
24169 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
24170 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
24171 LDKSign* arg_conv = (LDKSign*)arg_ptr;
24172 uint32_t ret_conv = Sign_clone_ptr(arg_conv);
24176 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
24177 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
24178 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
24179 LDKSign* orig_conv = (LDKSign*)orig_ptr;
24180 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24181 *ret_ret = Sign_clone(orig_conv);
24182 return (uint32_t)ret_ret;
24185 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
24186 if ((this_ptr & 1) != 0) return;
24187 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24188 CHECK_ACCESS(this_ptr_ptr);
24189 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
24190 FREE((void*)this_ptr);
24191 Sign_free(this_ptr_conv);
24194 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
24195 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
24196 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
24200 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
24201 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
24205 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
24206 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
24210 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
24211 if ((this_ptr & 1) != 0) return;
24212 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24213 CHECK_ACCESS(this_ptr_ptr);
24214 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
24215 FREE((void*)this_ptr);
24216 KeysInterface_free(this_ptr_conv);
24219 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
24220 LDKInMemorySigner this_obj_conv;
24221 this_obj_conv.inner = (void*)(this_obj & (~1));
24222 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24224 InMemorySigner_free(this_obj_conv);
24227 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
24228 LDKInMemorySigner this_ptr_conv;
24229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24230 this_ptr_conv.is_owned = false;
24231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24232 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24233 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
24237 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
24238 LDKInMemorySigner this_ptr_conv;
24239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24240 this_ptr_conv.is_owned = false;
24241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24242 LDKSecretKey val_ref;
24243 CHECK(val->arr_len == 32);
24244 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24245 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
24248 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
24249 LDKInMemorySigner this_ptr_conv;
24250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24251 this_ptr_conv.is_owned = false;
24252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24253 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24254 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
24258 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
24259 LDKInMemorySigner this_ptr_conv;
24260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24261 this_ptr_conv.is_owned = false;
24262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24263 LDKSecretKey val_ref;
24264 CHECK(val->arr_len == 32);
24265 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24266 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
24269 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
24270 LDKInMemorySigner this_ptr_conv;
24271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24272 this_ptr_conv.is_owned = false;
24273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24274 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24275 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
24279 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
24280 LDKInMemorySigner this_ptr_conv;
24281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24282 this_ptr_conv.is_owned = false;
24283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24284 LDKSecretKey val_ref;
24285 CHECK(val->arr_len == 32);
24286 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24287 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
24290 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
24291 LDKInMemorySigner this_ptr_conv;
24292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24293 this_ptr_conv.is_owned = false;
24294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24295 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24296 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
24300 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) {
24301 LDKInMemorySigner this_ptr_conv;
24302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24303 this_ptr_conv.is_owned = false;
24304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24305 LDKSecretKey val_ref;
24306 CHECK(val->arr_len == 32);
24307 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24308 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
24311 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
24312 LDKInMemorySigner this_ptr_conv;
24313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24314 this_ptr_conv.is_owned = false;
24315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24316 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24317 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
24321 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
24322 LDKInMemorySigner this_ptr_conv;
24323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24324 this_ptr_conv.is_owned = false;
24325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24326 LDKSecretKey val_ref;
24327 CHECK(val->arr_len == 32);
24328 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24329 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
24332 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
24333 LDKInMemorySigner this_ptr_conv;
24334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24335 this_ptr_conv.is_owned = false;
24336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24337 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24338 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
24342 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
24343 LDKInMemorySigner this_ptr_conv;
24344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24345 this_ptr_conv.is_owned = false;
24346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24347 LDKThirtyTwoBytes val_ref;
24348 CHECK(val->arr_len == 32);
24349 memcpy(val_ref.data, val->elems, 32); FREE(val);
24350 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
24353 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
24354 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
24355 uint32_t ret_ref = 0;
24356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24359 ret_ref = (uintptr_t)ret_var.inner;
24360 if (ret_var.is_owned) {
24365 uint32_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
24366 LDKInMemorySigner arg_conv;
24367 arg_conv.inner = (void*)(arg & (~1));
24368 arg_conv.is_owned = false;
24369 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24370 uint32_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
24374 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
24375 LDKInMemorySigner orig_conv;
24376 orig_conv.inner = (void*)(orig & (~1));
24377 orig_conv.is_owned = false;
24378 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24379 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
24380 uint32_t ret_ref = 0;
24381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24384 ret_ref = (uintptr_t)ret_var.inner;
24385 if (ret_var.is_owned) {
24391 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) {
24392 LDKSecretKey node_secret_ref;
24393 CHECK(node_secret->arr_len == 32);
24394 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
24395 LDKSecretKey funding_key_ref;
24396 CHECK(funding_key->arr_len == 32);
24397 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
24398 LDKSecretKey revocation_base_key_ref;
24399 CHECK(revocation_base_key->arr_len == 32);
24400 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
24401 LDKSecretKey payment_key_ref;
24402 CHECK(payment_key->arr_len == 32);
24403 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
24404 LDKSecretKey delayed_payment_base_key_ref;
24405 CHECK(delayed_payment_base_key->arr_len == 32);
24406 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
24407 LDKSecretKey htlc_base_key_ref;
24408 CHECK(htlc_base_key->arr_len == 32);
24409 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
24410 LDKThirtyTwoBytes commitment_seed_ref;
24411 CHECK(commitment_seed->arr_len == 32);
24412 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
24413 LDKThirtyTwoBytes channel_keys_id_ref;
24414 CHECK(channel_keys_id->arr_len == 32);
24415 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
24416 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);
24417 uint32_t ret_ref = 0;
24418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24421 ret_ref = (uintptr_t)ret_var.inner;
24422 if (ret_var.is_owned) {
24428 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
24429 LDKInMemorySigner this_arg_conv;
24430 this_arg_conv.inner = (void*)(this_arg & (~1));
24431 this_arg_conv.is_owned = false;
24432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24433 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
24434 uint32_t ret_ref = 0;
24435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24438 ret_ref = (uintptr_t)ret_var.inner;
24439 if (ret_var.is_owned) {
24445 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
24446 LDKInMemorySigner this_arg_conv;
24447 this_arg_conv.inner = (void*)(this_arg & (~1));
24448 this_arg_conv.is_owned = false;
24449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24450 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
24454 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
24455 LDKInMemorySigner this_arg_conv;
24456 this_arg_conv.inner = (void*)(this_arg & (~1));
24457 this_arg_conv.is_owned = false;
24458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24459 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
24463 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
24464 LDKInMemorySigner this_arg_conv;
24465 this_arg_conv.inner = (void*)(this_arg & (~1));
24466 this_arg_conv.is_owned = false;
24467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24468 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
24472 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
24473 LDKInMemorySigner this_arg_conv;
24474 this_arg_conv.inner = (void*)(this_arg & (~1));
24475 this_arg_conv.is_owned = false;
24476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24477 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24478 uint32_t ret_ref = 0;
24479 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24480 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24482 ret_ref = (uintptr_t)ret_var.inner;
24483 if (ret_var.is_owned) {
24489 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
24490 LDKInMemorySigner this_arg_conv;
24491 this_arg_conv.inner = (void*)(this_arg & (~1));
24492 this_arg_conv.is_owned = false;
24493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24494 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24495 uint32_t ret_ref = 0;
24496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24499 ret_ref = (uintptr_t)ret_var.inner;
24500 if (ret_var.is_owned) {
24506 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
24507 LDKInMemorySigner this_arg_conv;
24508 this_arg_conv.inner = (void*)(this_arg & (~1));
24509 this_arg_conv.is_owned = false;
24510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24511 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
24515 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) {
24516 LDKInMemorySigner this_arg_conv;
24517 this_arg_conv.inner = (void*)(this_arg & (~1));
24518 this_arg_conv.is_owned = false;
24519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24520 LDKTransaction spend_tx_ref;
24521 spend_tx_ref.datalen = spend_tx->arr_len;
24522 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24523 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24524 spend_tx_ref.data_is_owned = true;
24525 LDKStaticPaymentOutputDescriptor descriptor_conv;
24526 descriptor_conv.inner = (void*)(descriptor & (~1));
24527 descriptor_conv.is_owned = false;
24528 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24529 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24530 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24531 return (uint32_t)ret_conv;
24534 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) {
24535 LDKInMemorySigner 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 LDKTransaction spend_tx_ref;
24540 spend_tx_ref.datalen = spend_tx->arr_len;
24541 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24542 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24543 spend_tx_ref.data_is_owned = true;
24544 LDKDelayedPaymentOutputDescriptor descriptor_conv;
24545 descriptor_conv.inner = (void*)(descriptor & (~1));
24546 descriptor_conv.is_owned = false;
24547 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24548 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24549 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24550 return (uint32_t)ret_conv;
24553 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
24554 LDKInMemorySigner this_arg_conv;
24555 this_arg_conv.inner = (void*)(this_arg & (~1));
24556 this_arg_conv.is_owned = false;
24557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24558 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24559 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24560 return (uint32_t)ret_ret;
24563 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
24564 LDKInMemorySigner this_arg_conv;
24565 this_arg_conv.inner = (void*)(this_arg & (~1));
24566 this_arg_conv.is_owned = false;
24567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24568 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24569 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24570 return (uint32_t)ret_ret;
24573 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
24574 LDKInMemorySigner obj_conv;
24575 obj_conv.inner = (void*)(obj & (~1));
24576 obj_conv.is_owned = false;
24577 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24578 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24579 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24580 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24581 CVec_u8Z_free(ret_var);
24585 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
24586 LDKu8slice ser_ref;
24587 ser_ref.datalen = ser->arr_len;
24588 ser_ref.data = ser->elems;
24589 LDKSecretKey arg_ref;
24590 CHECK(arg->arr_len == 32);
24591 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
24592 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24593 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
24595 return (uint32_t)ret_conv;
24598 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
24599 LDKKeysManager this_obj_conv;
24600 this_obj_conv.inner = (void*)(this_obj & (~1));
24601 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24603 KeysManager_free(this_obj_conv);
24606 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
24607 unsigned char seed_arr[32];
24608 CHECK(seed->arr_len == 32);
24609 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24610 unsigned char (*seed_ref)[32] = &seed_arr;
24611 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24612 uint32_t ret_ref = 0;
24613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24616 ret_ref = (uintptr_t)ret_var.inner;
24617 if (ret_var.is_owned) {
24623 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) {
24624 LDKKeysManager this_arg_conv;
24625 this_arg_conv.inner = (void*)(this_arg & (~1));
24626 this_arg_conv.is_owned = false;
24627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24628 unsigned char params_arr[32];
24629 CHECK(params->arr_len == 32);
24630 memcpy(params_arr, params->elems, 32); FREE(params);
24631 unsigned char (*params_ref)[32] = ¶ms_arr;
24632 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24633 uint32_t ret_ref = 0;
24634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24637 ret_ref = (uintptr_t)ret_var.inner;
24638 if (ret_var.is_owned) {
24644 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) {
24645 LDKKeysManager this_arg_conv;
24646 this_arg_conv.inner = (void*)(this_arg & (~1));
24647 this_arg_conv.is_owned = false;
24648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24649 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24650 descriptors_constr.datalen = descriptors->arr_len;
24651 if (descriptors_constr.datalen > 0)
24652 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24654 descriptors_constr.data = NULL;
24655 uint32_t* descriptors_vals = descriptors->elems;
24656 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24657 uint32_t descriptors_conv_27 = descriptors_vals[b];
24658 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24659 CHECK_ACCESS(descriptors_conv_27_ptr);
24660 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24661 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24662 descriptors_constr.data[b] = descriptors_conv_27_conv;
24665 LDKCVec_TxOutZ outputs_constr;
24666 outputs_constr.datalen = outputs->arr_len;
24667 if (outputs_constr.datalen > 0)
24668 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24670 outputs_constr.data = NULL;
24671 uint32_t* outputs_vals = outputs->elems;
24672 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24673 uint32_t outputs_conv_7 = outputs_vals[h];
24674 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24675 CHECK_ACCESS(outputs_conv_7_ptr);
24676 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24677 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24678 outputs_constr.data[h] = outputs_conv_7_conv;
24681 LDKCVec_u8Z change_destination_script_ref;
24682 change_destination_script_ref.datalen = change_destination_script->arr_len;
24683 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24684 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24685 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24686 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24687 return (uint32_t)ret_conv;
24690 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
24691 LDKKeysManager this_arg_conv;
24692 this_arg_conv.inner = (void*)(this_arg & (~1));
24693 this_arg_conv.is_owned = false;
24694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24695 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24696 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24697 return (uint32_t)ret_ret;
24700 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
24701 LDKPhantomKeysManager this_obj_conv;
24702 this_obj_conv.inner = (void*)(this_obj & (~1));
24703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24705 PhantomKeysManager_free(this_obj_conv);
24708 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
24709 LDKPhantomKeysManager this_arg_conv;
24710 this_arg_conv.inner = (void*)(this_arg & (~1));
24711 this_arg_conv.is_owned = false;
24712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24713 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24714 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
24715 return (uint32_t)ret_ret;
24718 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) {
24719 unsigned char seed_arr[32];
24720 CHECK(seed->arr_len == 32);
24721 memcpy(seed_arr, seed->elems, 32); FREE(seed);
24722 unsigned char (*seed_ref)[32] = &seed_arr;
24723 unsigned char cross_node_seed_arr[32];
24724 CHECK(cross_node_seed->arr_len == 32);
24725 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
24726 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
24727 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
24728 uint32_t ret_ref = 0;
24729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24732 ret_ref = (uintptr_t)ret_var.inner;
24733 if (ret_var.is_owned) {
24739 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) {
24740 LDKPhantomKeysManager this_arg_conv;
24741 this_arg_conv.inner = (void*)(this_arg & (~1));
24742 this_arg_conv.is_owned = false;
24743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24744 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24745 descriptors_constr.datalen = descriptors->arr_len;
24746 if (descriptors_constr.datalen > 0)
24747 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24749 descriptors_constr.data = NULL;
24750 uint32_t* descriptors_vals = descriptors->elems;
24751 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24752 uint32_t descriptors_conv_27 = descriptors_vals[b];
24753 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
24754 CHECK_ACCESS(descriptors_conv_27_ptr);
24755 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24756 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
24757 descriptors_constr.data[b] = descriptors_conv_27_conv;
24760 LDKCVec_TxOutZ outputs_constr;
24761 outputs_constr.datalen = outputs->arr_len;
24762 if (outputs_constr.datalen > 0)
24763 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24765 outputs_constr.data = NULL;
24766 uint32_t* outputs_vals = outputs->elems;
24767 for (size_t h = 0; h < outputs_constr.datalen; h++) {
24768 uint32_t outputs_conv_7 = outputs_vals[h];
24769 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
24770 CHECK_ACCESS(outputs_conv_7_ptr);
24771 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24772 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
24773 outputs_constr.data[h] = outputs_conv_7_conv;
24776 LDKCVec_u8Z change_destination_script_ref;
24777 change_destination_script_ref.datalen = change_destination_script->arr_len;
24778 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24779 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24780 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24781 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24782 return (uint32_t)ret_conv;
24785 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) {
24786 LDKPhantomKeysManager this_arg_conv;
24787 this_arg_conv.inner = (void*)(this_arg & (~1));
24788 this_arg_conv.is_owned = false;
24789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24790 unsigned char params_arr[32];
24791 CHECK(params->arr_len == 32);
24792 memcpy(params_arr, params->elems, 32); FREE(params);
24793 unsigned char (*params_ref)[32] = ¶ms_arr;
24794 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24795 uint32_t ret_ref = 0;
24796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24799 ret_ref = (uintptr_t)ret_var.inner;
24800 if (ret_var.is_owned) {
24806 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
24807 LDKChannelManager this_obj_conv;
24808 this_obj_conv.inner = (void*)(this_obj & (~1));
24809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24811 ChannelManager_free(this_obj_conv);
24814 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
24815 LDKChainParameters this_obj_conv;
24816 this_obj_conv.inner = (void*)(this_obj & (~1));
24817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24819 ChainParameters_free(this_obj_conv);
24822 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
24823 LDKChainParameters this_ptr_conv;
24824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24825 this_ptr_conv.is_owned = false;
24826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24827 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
24831 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
24832 LDKChainParameters this_ptr_conv;
24833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24834 this_ptr_conv.is_owned = false;
24835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24836 LDKNetwork val_conv = LDKNetwork_from_js(val);
24837 ChainParameters_set_network(&this_ptr_conv, val_conv);
24840 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
24841 LDKChainParameters this_ptr_conv;
24842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24843 this_ptr_conv.is_owned = false;
24844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24845 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24846 uint32_t ret_ref = 0;
24847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24850 ret_ref = (uintptr_t)ret_var.inner;
24851 if (ret_var.is_owned) {
24857 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
24858 LDKChainParameters this_ptr_conv;
24859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24860 this_ptr_conv.is_owned = false;
24861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24862 LDKBestBlock val_conv;
24863 val_conv.inner = (void*)(val & (~1));
24864 val_conv.is_owned = (val & 1) || (val == 0);
24865 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24866 val_conv = BestBlock_clone(&val_conv);
24867 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24870 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
24871 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
24872 LDKBestBlock best_block_arg_conv;
24873 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
24874 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
24875 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24876 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24877 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24878 uint32_t ret_ref = 0;
24879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24882 ret_ref = (uintptr_t)ret_var.inner;
24883 if (ret_var.is_owned) {
24889 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24890 LDKChainParameters ret_var = ChainParameters_clone(arg);
24891 uint32_t ret_ref = 0;
24892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24895 ret_ref = (uintptr_t)ret_var.inner;
24896 if (ret_var.is_owned) {
24901 uint32_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
24902 LDKChainParameters arg_conv;
24903 arg_conv.inner = (void*)(arg & (~1));
24904 arg_conv.is_owned = false;
24905 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24906 uint32_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
24910 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
24911 LDKChainParameters orig_conv;
24912 orig_conv.inner = (void*)(orig & (~1));
24913 orig_conv.is_owned = false;
24914 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24915 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24916 uint32_t ret_ref = 0;
24917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24920 ret_ref = (uintptr_t)ret_var.inner;
24921 if (ret_var.is_owned) {
24927 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
24928 LDKCounterpartyForwardingInfo this_obj_conv;
24929 this_obj_conv.inner = (void*)(this_obj & (~1));
24930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24932 CounterpartyForwardingInfo_free(this_obj_conv);
24935 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
24936 LDKCounterpartyForwardingInfo this_ptr_conv;
24937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24938 this_ptr_conv.is_owned = false;
24939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24940 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24944 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
24945 LDKCounterpartyForwardingInfo this_ptr_conv;
24946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24947 this_ptr_conv.is_owned = false;
24948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24949 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24952 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
24953 LDKCounterpartyForwardingInfo 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 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24961 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
24962 LDKCounterpartyForwardingInfo this_ptr_conv;
24963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24964 this_ptr_conv.is_owned = false;
24965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24966 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24969 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
24970 LDKCounterpartyForwardingInfo this_ptr_conv;
24971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24972 this_ptr_conv.is_owned = false;
24973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24974 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24978 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
24979 LDKCounterpartyForwardingInfo this_ptr_conv;
24980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24981 this_ptr_conv.is_owned = false;
24982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24983 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24986 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) {
24987 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24988 uint32_t ret_ref = 0;
24989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24992 ret_ref = (uintptr_t)ret_var.inner;
24993 if (ret_var.is_owned) {
24999 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
25000 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
25001 uint32_t ret_ref = 0;
25002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25005 ret_ref = (uintptr_t)ret_var.inner;
25006 if (ret_var.is_owned) {
25011 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
25012 LDKCounterpartyForwardingInfo arg_conv;
25013 arg_conv.inner = (void*)(arg & (~1));
25014 arg_conv.is_owned = false;
25015 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25016 uint32_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
25020 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
25021 LDKCounterpartyForwardingInfo orig_conv;
25022 orig_conv.inner = (void*)(orig & (~1));
25023 orig_conv.is_owned = false;
25024 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25025 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
25026 uint32_t ret_ref = 0;
25027 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25028 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25030 ret_ref = (uintptr_t)ret_var.inner;
25031 if (ret_var.is_owned) {
25037 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
25038 LDKChannelCounterparty this_obj_conv;
25039 this_obj_conv.inner = (void*)(this_obj & (~1));
25040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25042 ChannelCounterparty_free(this_obj_conv);
25045 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
25046 LDKChannelCounterparty this_ptr_conv;
25047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25048 this_ptr_conv.is_owned = false;
25049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25050 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25051 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
25055 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
25056 LDKChannelCounterparty this_ptr_conv;
25057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25058 this_ptr_conv.is_owned = false;
25059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25060 LDKPublicKey val_ref;
25061 CHECK(val->arr_len == 33);
25062 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25063 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
25066 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
25067 LDKChannelCounterparty this_ptr_conv;
25068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25069 this_ptr_conv.is_owned = false;
25070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25071 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
25072 uint32_t ret_ref = 0;
25073 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25074 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25076 ret_ref = (uintptr_t)ret_var.inner;
25077 if (ret_var.is_owned) {
25083 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
25084 LDKChannelCounterparty this_ptr_conv;
25085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25086 this_ptr_conv.is_owned = false;
25087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25088 LDKInitFeatures val_conv;
25089 val_conv.inner = (void*)(val & (~1));
25090 val_conv.is_owned = (val & 1) || (val == 0);
25091 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25092 val_conv = InitFeatures_clone(&val_conv);
25093 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
25096 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25097 LDKChannelCounterparty this_ptr_conv;
25098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25099 this_ptr_conv.is_owned = false;
25100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25101 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
25105 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
25106 LDKChannelCounterparty this_ptr_conv;
25107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25108 this_ptr_conv.is_owned = false;
25109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25110 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
25113 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
25114 LDKChannelCounterparty this_ptr_conv;
25115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25116 this_ptr_conv.is_owned = false;
25117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25118 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
25119 uint32_t ret_ref = 0;
25120 if ((uintptr_t)ret_var.inner > 4096) {
25121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25124 ret_ref = (uintptr_t)ret_var.inner;
25125 if (ret_var.is_owned) {
25132 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
25133 LDKChannelCounterparty this_ptr_conv;
25134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25135 this_ptr_conv.is_owned = false;
25136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25137 LDKCounterpartyForwardingInfo val_conv;
25138 val_conv.inner = (void*)(val & (~1));
25139 val_conv.is_owned = (val & 1) || (val == 0);
25140 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25141 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
25142 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
25145 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint32_t this_ptr) {
25146 LDKChannelCounterparty this_ptr_conv;
25147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25148 this_ptr_conv.is_owned = false;
25149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25150 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25151 *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
25152 uint32_t ret_ref = (uintptr_t)ret_copy;
25156 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) {
25157 LDKChannelCounterparty this_ptr_conv;
25158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25159 this_ptr_conv.is_owned = false;
25160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25161 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25162 CHECK_ACCESS(val_ptr);
25163 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25164 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25165 ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25168 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint32_t this_ptr) {
25169 LDKChannelCounterparty this_ptr_conv;
25170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25171 this_ptr_conv.is_owned = false;
25172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25173 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25174 *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
25175 uint32_t ret_ref = (uintptr_t)ret_copy;
25179 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) {
25180 LDKChannelCounterparty this_ptr_conv;
25181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25182 this_ptr_conv.is_owned = false;
25183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25184 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25185 CHECK_ACCESS(val_ptr);
25186 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25187 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25188 ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25191 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) {
25192 LDKPublicKey node_id_arg_ref;
25193 CHECK(node_id_arg->arr_len == 33);
25194 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
25195 LDKInitFeatures features_arg_conv;
25196 features_arg_conv.inner = (void*)(features_arg & (~1));
25197 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25198 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
25199 features_arg_conv = InitFeatures_clone(&features_arg_conv);
25200 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
25201 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
25202 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
25203 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
25204 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
25205 void* outbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1);
25206 CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
25207 LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
25208 outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_minimum_msat_arg) & ~1));
25209 void* outbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1);
25210 CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
25211 LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
25212 outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_htlc_maximum_msat_arg) & ~1));
25213 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);
25214 uint32_t ret_ref = 0;
25215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25216 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25218 ret_ref = (uintptr_t)ret_var.inner;
25219 if (ret_var.is_owned) {
25225 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
25226 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
25227 uint32_t ret_ref = 0;
25228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25231 ret_ref = (uintptr_t)ret_var.inner;
25232 if (ret_var.is_owned) {
25237 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
25238 LDKChannelCounterparty arg_conv;
25239 arg_conv.inner = (void*)(arg & (~1));
25240 arg_conv.is_owned = false;
25241 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25242 uint32_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
25246 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
25247 LDKChannelCounterparty orig_conv;
25248 orig_conv.inner = (void*)(orig & (~1));
25249 orig_conv.is_owned = false;
25250 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25251 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
25252 uint32_t ret_ref = 0;
25253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25256 ret_ref = (uintptr_t)ret_var.inner;
25257 if (ret_var.is_owned) {
25263 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
25264 LDKChannelDetails this_obj_conv;
25265 this_obj_conv.inner = (void*)(this_obj & (~1));
25266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25268 ChannelDetails_free(this_obj_conv);
25271 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
25272 LDKChannelDetails this_ptr_conv;
25273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25274 this_ptr_conv.is_owned = false;
25275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25276 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25277 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
25281 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25282 LDKChannelDetails this_ptr_conv;
25283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25284 this_ptr_conv.is_owned = false;
25285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25286 LDKThirtyTwoBytes val_ref;
25287 CHECK(val->arr_len == 32);
25288 memcpy(val_ref.data, val->elems, 32); FREE(val);
25289 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
25292 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
25293 LDKChannelDetails this_ptr_conv;
25294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25295 this_ptr_conv.is_owned = false;
25296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25297 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
25298 uint32_t ret_ref = 0;
25299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25302 ret_ref = (uintptr_t)ret_var.inner;
25303 if (ret_var.is_owned) {
25309 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
25310 LDKChannelDetails this_ptr_conv;
25311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25312 this_ptr_conv.is_owned = false;
25313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25314 LDKChannelCounterparty val_conv;
25315 val_conv.inner = (void*)(val & (~1));
25316 val_conv.is_owned = (val & 1) || (val == 0);
25317 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25318 val_conv = ChannelCounterparty_clone(&val_conv);
25319 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
25322 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
25323 LDKChannelDetails this_ptr_conv;
25324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25325 this_ptr_conv.is_owned = false;
25326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25327 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
25328 uint32_t ret_ref = 0;
25329 if ((uintptr_t)ret_var.inner > 4096) {
25330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25333 ret_ref = (uintptr_t)ret_var.inner;
25334 if (ret_var.is_owned) {
25341 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
25342 LDKChannelDetails this_ptr_conv;
25343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25344 this_ptr_conv.is_owned = false;
25345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25346 LDKOutPoint val_conv;
25347 val_conv.inner = (void*)(val & (~1));
25348 val_conv.is_owned = (val & 1) || (val == 0);
25349 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25350 val_conv = OutPoint_clone(&val_conv);
25351 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
25354 uint32_t __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint32_t this_ptr) {
25355 LDKChannelDetails this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25359 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
25360 uint32_t ret_ref = 0;
25361 if ((uintptr_t)ret_var.inner > 4096) {
25362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25365 ret_ref = (uintptr_t)ret_var.inner;
25366 if (ret_var.is_owned) {
25373 void __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint32_t this_ptr, uint32_t val) {
25374 LDKChannelDetails this_ptr_conv;
25375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25376 this_ptr_conv.is_owned = false;
25377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25378 LDKChannelTypeFeatures val_conv;
25379 val_conv.inner = (void*)(val & (~1));
25380 val_conv.is_owned = (val & 1) || (val == 0);
25381 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25382 val_conv = ChannelTypeFeatures_clone(&val_conv);
25383 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
25386 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
25387 LDKChannelDetails this_ptr_conv;
25388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25389 this_ptr_conv.is_owned = false;
25390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25391 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25392 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
25393 uint32_t ret_ref = (uintptr_t)ret_copy;
25397 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
25398 LDKChannelDetails this_ptr_conv;
25399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25400 this_ptr_conv.is_owned = false;
25401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25402 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25403 CHECK_ACCESS(val_ptr);
25404 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25405 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25406 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
25409 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint32_t this_ptr) {
25410 LDKChannelDetails this_ptr_conv;
25411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25412 this_ptr_conv.is_owned = false;
25413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25414 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25415 *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
25416 uint32_t ret_ref = (uintptr_t)ret_copy;
25420 void __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25421 LDKChannelDetails this_ptr_conv;
25422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25423 this_ptr_conv.is_owned = false;
25424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25425 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25426 CHECK_ACCESS(val_ptr);
25427 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25428 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25429 ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
25432 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint32_t this_ptr) {
25433 LDKChannelDetails this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25437 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25438 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
25439 uint32_t ret_ref = (uintptr_t)ret_copy;
25443 void __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint32_t this_ptr, uint32_t val) {
25444 LDKChannelDetails this_ptr_conv;
25445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25446 this_ptr_conv.is_owned = false;
25447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25448 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25449 CHECK_ACCESS(val_ptr);
25450 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25451 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25452 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
25455 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
25456 LDKChannelDetails this_ptr_conv;
25457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25458 this_ptr_conv.is_owned = false;
25459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25460 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
25464 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
25465 LDKChannelDetails this_ptr_conv;
25466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25467 this_ptr_conv.is_owned = false;
25468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25469 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
25472 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
25473 LDKChannelDetails this_ptr_conv;
25474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25475 this_ptr_conv.is_owned = false;
25476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25477 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25478 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
25479 uint32_t ret_ref = (uintptr_t)ret_copy;
25483 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
25484 LDKChannelDetails this_ptr_conv;
25485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25486 this_ptr_conv.is_owned = false;
25487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25488 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25489 CHECK_ACCESS(val_ptr);
25490 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25491 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25492 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
25495 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
25496 LDKChannelDetails this_ptr_conv;
25497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25498 this_ptr_conv.is_owned = false;
25499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25500 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
25504 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
25505 LDKChannelDetails this_ptr_conv;
25506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25507 this_ptr_conv.is_owned = false;
25508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25509 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
25512 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
25513 LDKChannelDetails this_ptr_conv;
25514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25515 this_ptr_conv.is_owned = false;
25516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25517 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
25521 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_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 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
25529 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
25530 LDKChannelDetails this_ptr_conv;
25531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25532 this_ptr_conv.is_owned = false;
25533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25534 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
25538 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25539 LDKChannelDetails this_ptr_conv;
25540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25541 this_ptr_conv.is_owned = false;
25542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25543 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
25546 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) {
25547 LDKChannelDetails this_ptr_conv;
25548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25549 this_ptr_conv.is_owned = false;
25550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25551 int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
25555 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) {
25556 LDKChannelDetails this_ptr_conv;
25557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25558 this_ptr_conv.is_owned = false;
25559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25560 ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
25563 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
25564 LDKChannelDetails this_ptr_conv;
25565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25566 this_ptr_conv.is_owned = false;
25567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25568 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
25572 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
25573 LDKChannelDetails this_ptr_conv;
25574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25575 this_ptr_conv.is_owned = false;
25576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25577 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
25580 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
25581 LDKChannelDetails this_ptr_conv;
25582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25583 this_ptr_conv.is_owned = false;
25584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25585 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25586 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
25587 uint32_t ret_ref = (uintptr_t)ret_copy;
25591 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
25592 LDKChannelDetails this_ptr_conv;
25593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25594 this_ptr_conv.is_owned = false;
25595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25596 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25597 CHECK_ACCESS(val_ptr);
25598 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25599 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
25600 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25603 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
25604 LDKChannelDetails this_ptr_conv;
25605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25606 this_ptr_conv.is_owned = false;
25607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25608 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25609 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25610 uint32_t ret_ref = (uintptr_t)ret_copy;
25614 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) {
25615 LDKChannelDetails this_ptr_conv;
25616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25617 this_ptr_conv.is_owned = false;
25618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25619 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25620 CHECK_ACCESS(val_ptr);
25621 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25622 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
25623 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25626 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
25627 LDKChannelDetails this_ptr_conv;
25628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25629 this_ptr_conv.is_owned = false;
25630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25631 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
25635 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean 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 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25643 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint32_t this_ptr) {
25644 LDKChannelDetails this_ptr_conv;
25645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25646 this_ptr_conv.is_owned = false;
25647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25648 jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
25652 void __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint32_t this_ptr, jboolean val) {
25653 LDKChannelDetails this_ptr_conv;
25654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25655 this_ptr_conv.is_owned = false;
25656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25657 ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
25660 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
25661 LDKChannelDetails this_ptr_conv;
25662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25663 this_ptr_conv.is_owned = false;
25664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25665 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
25669 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
25670 LDKChannelDetails this_ptr_conv;
25671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25672 this_ptr_conv.is_owned = false;
25673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25674 ChannelDetails_set_is_usable(&this_ptr_conv, val);
25677 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
25678 LDKChannelDetails this_ptr_conv;
25679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25680 this_ptr_conv.is_owned = false;
25681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25682 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
25686 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
25687 LDKChannelDetails this_ptr_conv;
25688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25689 this_ptr_conv.is_owned = false;
25690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25691 ChannelDetails_set_is_public(&this_ptr_conv, val);
25694 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint32_t this_ptr) {
25695 LDKChannelDetails this_ptr_conv;
25696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25697 this_ptr_conv.is_owned = false;
25698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25699 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25700 *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
25701 uint32_t ret_ref = (uintptr_t)ret_copy;
25705 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) {
25706 LDKChannelDetails this_ptr_conv;
25707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25708 this_ptr_conv.is_owned = false;
25709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25710 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25711 CHECK_ACCESS(val_ptr);
25712 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25713 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25714 ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25717 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint32_t this_ptr) {
25718 LDKChannelDetails this_ptr_conv;
25719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25720 this_ptr_conv.is_owned = false;
25721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25722 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25723 *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
25724 uint32_t ret_ref = (uintptr_t)ret_copy;
25728 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) {
25729 LDKChannelDetails this_ptr_conv;
25730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25731 this_ptr_conv.is_owned = false;
25732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25733 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25734 CHECK_ACCESS(val_ptr);
25735 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25736 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
25737 ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25740 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) {
25741 LDKThirtyTwoBytes channel_id_arg_ref;
25742 CHECK(channel_id_arg->arr_len == 32);
25743 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25744 LDKChannelCounterparty counterparty_arg_conv;
25745 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
25746 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
25747 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25748 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25749 LDKOutPoint funding_txo_arg_conv;
25750 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
25751 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
25752 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25753 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25754 LDKChannelTypeFeatures channel_type_arg_conv;
25755 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
25756 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
25758 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
25759 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
25760 CHECK_ACCESS(short_channel_id_arg_ptr);
25761 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25762 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
25763 void* outbound_scid_alias_arg_ptr = (void*)(((uintptr_t)outbound_scid_alias_arg) & ~1);
25764 CHECK_ACCESS(outbound_scid_alias_arg_ptr);
25765 LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
25766 outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)outbound_scid_alias_arg) & ~1));
25767 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
25768 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
25769 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
25770 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
25771 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
25772 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25773 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25774 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
25775 CHECK_ACCESS(confirmations_required_arg_ptr);
25776 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25777 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
25778 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
25779 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25780 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25781 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
25782 void* inbound_htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1);
25783 CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
25784 LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
25785 inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_minimum_msat_arg) & ~1));
25786 void* inbound_htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1);
25787 CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
25788 LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
25789 inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_htlc_maximum_msat_arg) & ~1));
25790 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);
25791 uint32_t ret_ref = 0;
25792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25795 ret_ref = (uintptr_t)ret_var.inner;
25796 if (ret_var.is_owned) {
25802 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25803 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25804 uint32_t ret_ref = 0;
25805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25808 ret_ref = (uintptr_t)ret_var.inner;
25809 if (ret_var.is_owned) {
25814 uint32_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
25815 LDKChannelDetails arg_conv;
25816 arg_conv.inner = (void*)(arg & (~1));
25817 arg_conv.is_owned = false;
25818 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25819 uint32_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
25823 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
25824 LDKChannelDetails orig_conv;
25825 orig_conv.inner = (void*)(orig & (~1));
25826 orig_conv.is_owned = false;
25827 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25828 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25829 uint32_t ret_ref = 0;
25830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25833 ret_ref = (uintptr_t)ret_var.inner;
25834 if (ret_var.is_owned) {
25840 uint32_t __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint32_t this_arg) {
25841 LDKChannelDetails this_arg_conv;
25842 this_arg_conv.inner = (void*)(this_arg & (~1));
25843 this_arg_conv.is_owned = false;
25844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25845 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25846 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
25847 uint32_t ret_ref = (uintptr_t)ret_copy;
25851 uint32_t __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint32_t this_arg) {
25852 LDKChannelDetails this_arg_conv;
25853 this_arg_conv.inner = (void*)(this_arg & (~1));
25854 this_arg_conv.is_owned = false;
25855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25856 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25857 *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
25858 uint32_t ret_ref = (uintptr_t)ret_copy;
25862 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
25863 if ((this_ptr & 1) != 0) return;
25864 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25865 CHECK_ACCESS(this_ptr_ptr);
25866 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25867 FREE((void*)this_ptr);
25868 PaymentSendFailure_free(this_ptr_conv);
25871 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25872 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25873 *ret_copy = PaymentSendFailure_clone(arg);
25874 uint32_t ret_ref = (uintptr_t)ret_copy;
25877 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
25878 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
25879 uint32_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
25883 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
25884 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
25885 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25886 *ret_copy = PaymentSendFailure_clone(orig_conv);
25887 uint32_t ret_ref = (uintptr_t)ret_copy;
25891 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
25892 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
25893 CHECK_ACCESS(a_ptr);
25894 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25895 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
25896 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25897 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25898 uint32_t ret_ref = (uintptr_t)ret_copy;
25902 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
25903 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25904 a_constr.datalen = a->arr_len;
25905 if (a_constr.datalen > 0)
25906 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25908 a_constr.data = NULL;
25909 uint32_t* a_vals = a->elems;
25910 for (size_t w = 0; w < a_constr.datalen; w++) {
25911 uint32_t a_conv_22 = a_vals[w];
25912 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
25913 CHECK_ACCESS(a_conv_22_ptr);
25914 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25915 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
25916 a_constr.data[w] = a_conv_22_conv;
25919 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25920 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25921 uint32_t ret_ref = (uintptr_t)ret_copy;
25925 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
25926 LDKCVec_APIErrorZ a_constr;
25927 a_constr.datalen = a->arr_len;
25928 if (a_constr.datalen > 0)
25929 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25931 a_constr.data = NULL;
25932 uint32_t* a_vals = a->elems;
25933 for (size_t k = 0; k < a_constr.datalen; k++) {
25934 uint32_t a_conv_10 = a_vals[k];
25935 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
25936 CHECK_ACCESS(a_conv_10_ptr);
25937 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25938 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
25939 a_constr.data[k] = a_conv_10_conv;
25942 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25943 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25944 uint32_t ret_ref = (uintptr_t)ret_copy;
25948 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) {
25949 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25950 results_constr.datalen = results->arr_len;
25951 if (results_constr.datalen > 0)
25952 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25954 results_constr.data = NULL;
25955 uint32_t* results_vals = results->elems;
25956 for (size_t w = 0; w < results_constr.datalen; w++) {
25957 uint32_t results_conv_22 = results_vals[w];
25958 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
25959 CHECK_ACCESS(results_conv_22_ptr);
25960 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25961 results_constr.data[w] = results_conv_22_conv;
25964 LDKRouteParameters failed_paths_retry_conv;
25965 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
25966 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
25967 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25968 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25969 LDKThirtyTwoBytes payment_id_ref;
25970 CHECK(payment_id->arr_len == 32);
25971 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25972 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25973 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25974 uint32_t ret_ref = (uintptr_t)ret_copy;
25978 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
25979 LDKPhantomRouteHints this_obj_conv;
25980 this_obj_conv.inner = (void*)(this_obj & (~1));
25981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25983 PhantomRouteHints_free(this_obj_conv);
25986 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
25987 LDKPhantomRouteHints this_ptr_conv;
25988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25989 this_ptr_conv.is_owned = false;
25990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25991 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
25992 uint32_tArray ret_arr = NULL;
25993 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
25994 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
25995 for (size_t q = 0; q < ret_var.datalen; q++) {
25996 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25997 uint32_t ret_conv_16_ref = 0;
25998 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25999 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26001 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26002 if (ret_conv_16_var.is_owned) {
26003 ret_conv_16_ref |= 1;
26005 ret_arr_ptr[q] = ret_conv_16_ref;
26008 FREE(ret_var.data);
26012 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
26013 LDKPhantomRouteHints this_ptr_conv;
26014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26015 this_ptr_conv.is_owned = false;
26016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26017 LDKCVec_ChannelDetailsZ val_constr;
26018 val_constr.datalen = val->arr_len;
26019 if (val_constr.datalen > 0)
26020 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26022 val_constr.data = NULL;
26023 uint32_t* val_vals = val->elems;
26024 for (size_t q = 0; q < val_constr.datalen; q++) {
26025 uint32_t val_conv_16 = val_vals[q];
26026 LDKChannelDetails val_conv_16_conv;
26027 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
26028 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
26029 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
26030 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
26031 val_constr.data[q] = val_conv_16_conv;
26034 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
26037 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
26038 LDKPhantomRouteHints this_ptr_conv;
26039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26040 this_ptr_conv.is_owned = false;
26041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26042 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
26046 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
26047 LDKPhantomRouteHints this_ptr_conv;
26048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26049 this_ptr_conv.is_owned = false;
26050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26051 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
26054 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
26055 LDKPhantomRouteHints this_ptr_conv;
26056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26057 this_ptr_conv.is_owned = false;
26058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26059 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26060 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
26064 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
26065 LDKPhantomRouteHints this_ptr_conv;
26066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26067 this_ptr_conv.is_owned = false;
26068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26069 LDKPublicKey val_ref;
26070 CHECK(val->arr_len == 33);
26071 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26072 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
26075 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) {
26076 LDKCVec_ChannelDetailsZ channels_arg_constr;
26077 channels_arg_constr.datalen = channels_arg->arr_len;
26078 if (channels_arg_constr.datalen > 0)
26079 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26081 channels_arg_constr.data = NULL;
26082 uint32_t* channels_arg_vals = channels_arg->elems;
26083 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
26084 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
26085 LDKChannelDetails channels_arg_conv_16_conv;
26086 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
26087 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
26088 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
26089 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
26090 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
26092 FREE(channels_arg);
26093 LDKPublicKey real_node_pubkey_arg_ref;
26094 CHECK(real_node_pubkey_arg->arr_len == 33);
26095 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
26096 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
26097 uint32_t ret_ref = 0;
26098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26101 ret_ref = (uintptr_t)ret_var.inner;
26102 if (ret_var.is_owned) {
26108 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
26109 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
26110 uint32_t ret_ref = 0;
26111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26114 ret_ref = (uintptr_t)ret_var.inner;
26115 if (ret_var.is_owned) {
26120 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
26121 LDKPhantomRouteHints arg_conv;
26122 arg_conv.inner = (void*)(arg & (~1));
26123 arg_conv.is_owned = false;
26124 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26125 uint32_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
26129 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
26130 LDKPhantomRouteHints orig_conv;
26131 orig_conv.inner = (void*)(orig & (~1));
26132 orig_conv.is_owned = false;
26133 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26134 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
26135 uint32_t ret_ref = 0;
26136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26139 ret_ref = (uintptr_t)ret_var.inner;
26140 if (ret_var.is_owned) {
26146 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) {
26147 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
26148 CHECK_ACCESS(fee_est_ptr);
26149 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
26150 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
26151 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26152 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
26154 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
26155 CHECK_ACCESS(chain_monitor_ptr);
26156 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26157 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26158 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26159 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26161 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
26162 CHECK_ACCESS(tx_broadcaster_ptr);
26163 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26164 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26165 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26166 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26168 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26169 CHECK_ACCESS(logger_ptr);
26170 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26171 if (logger_conv.free == LDKLogger_JCalls_free) {
26172 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26173 LDKLogger_JCalls_cloned(&logger_conv);
26175 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26176 CHECK_ACCESS(keys_manager_ptr);
26177 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26178 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26179 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26180 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26182 LDKUserConfig config_conv;
26183 config_conv.inner = (void*)(config & (~1));
26184 config_conv.is_owned = (config & 1) || (config == 0);
26185 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26186 config_conv = UserConfig_clone(&config_conv);
26187 LDKChainParameters params_conv;
26188 params_conv.inner = (void*)(params & (~1));
26189 params_conv.is_owned = (params & 1) || (params == 0);
26190 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
26191 params_conv = ChainParameters_clone(¶ms_conv);
26192 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
26193 uint32_t ret_ref = 0;
26194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26197 ret_ref = (uintptr_t)ret_var.inner;
26198 if (ret_var.is_owned) {
26204 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
26205 LDKChannelManager this_arg_conv;
26206 this_arg_conv.inner = (void*)(this_arg & (~1));
26207 this_arg_conv.is_owned = false;
26208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26209 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
26210 uint32_t ret_ref = 0;
26211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26214 ret_ref = (uintptr_t)ret_var.inner;
26215 if (ret_var.is_owned) {
26221 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) {
26222 LDKChannelManager this_arg_conv;
26223 this_arg_conv.inner = (void*)(this_arg & (~1));
26224 this_arg_conv.is_owned = false;
26225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26226 LDKPublicKey their_network_key_ref;
26227 CHECK(their_network_key->arr_len == 33);
26228 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
26229 LDKUserConfig override_config_conv;
26230 override_config_conv.inner = (void*)(override_config & (~1));
26231 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
26232 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
26233 override_config_conv = UserConfig_clone(&override_config_conv);
26234 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
26235 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
26236 return (uint32_t)ret_conv;
26239 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
26240 LDKChannelManager this_arg_conv;
26241 this_arg_conv.inner = (void*)(this_arg & (~1));
26242 this_arg_conv.is_owned = false;
26243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26244 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
26245 uint32_tArray ret_arr = NULL;
26246 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26247 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26248 for (size_t q = 0; q < ret_var.datalen; q++) {
26249 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26250 uint32_t ret_conv_16_ref = 0;
26251 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26252 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26254 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26255 if (ret_conv_16_var.is_owned) {
26256 ret_conv_16_ref |= 1;
26258 ret_arr_ptr[q] = ret_conv_16_ref;
26261 FREE(ret_var.data);
26265 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
26266 LDKChannelManager this_arg_conv;
26267 this_arg_conv.inner = (void*)(this_arg & (~1));
26268 this_arg_conv.is_owned = false;
26269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26270 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
26271 uint32_tArray ret_arr = NULL;
26272 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
26273 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
26274 for (size_t q = 0; q < ret_var.datalen; q++) {
26275 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26276 uint32_t ret_conv_16_ref = 0;
26277 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26278 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26280 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26281 if (ret_conv_16_var.is_owned) {
26282 ret_conv_16_ref |= 1;
26284 ret_arr_ptr[q] = ret_conv_16_ref;
26287 FREE(ret_var.data);
26291 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) {
26292 LDKChannelManager this_arg_conv;
26293 this_arg_conv.inner = (void*)(this_arg & (~1));
26294 this_arg_conv.is_owned = false;
26295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26296 unsigned char channel_id_arr[32];
26297 CHECK(channel_id->arr_len == 32);
26298 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26299 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26300 LDKPublicKey counterparty_node_id_ref;
26301 CHECK(counterparty_node_id->arr_len == 33);
26302 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26303 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26304 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26305 return (uint32_t)ret_conv;
26308 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) {
26309 LDKChannelManager this_arg_conv;
26310 this_arg_conv.inner = (void*)(this_arg & (~1));
26311 this_arg_conv.is_owned = false;
26312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26313 unsigned char channel_id_arr[32];
26314 CHECK(channel_id->arr_len == 32);
26315 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26316 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26317 LDKPublicKey counterparty_node_id_ref;
26318 CHECK(counterparty_node_id->arr_len == 33);
26319 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26320 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26321 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
26322 return (uint32_t)ret_conv;
26325 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) {
26326 LDKChannelManager this_arg_conv;
26327 this_arg_conv.inner = (void*)(this_arg & (~1));
26328 this_arg_conv.is_owned = false;
26329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26330 unsigned char channel_id_arr[32];
26331 CHECK(channel_id->arr_len == 32);
26332 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26333 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26334 LDKPublicKey counterparty_node_id_ref;
26335 CHECK(counterparty_node_id->arr_len == 33);
26336 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26337 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26338 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26339 return (uint32_t)ret_conv;
26342 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
26343 LDKChannelManager this_arg_conv;
26344 this_arg_conv.inner = (void*)(this_arg & (~1));
26345 this_arg_conv.is_owned = false;
26346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26347 ChannelManager_force_close_all_channels(&this_arg_conv);
26350 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) {
26351 LDKChannelManager this_arg_conv;
26352 this_arg_conv.inner = (void*)(this_arg & (~1));
26353 this_arg_conv.is_owned = false;
26354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26355 LDKRoute route_conv;
26356 route_conv.inner = (void*)(route & (~1));
26357 route_conv.is_owned = false;
26358 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26359 LDKThirtyTwoBytes payment_hash_ref;
26360 CHECK(payment_hash->arr_len == 32);
26361 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26362 LDKThirtyTwoBytes payment_secret_ref;
26363 CHECK(payment_secret->arr_len == 32);
26364 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26365 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
26366 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
26367 return (uint32_t)ret_conv;
26370 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
26371 LDKChannelManager this_arg_conv;
26372 this_arg_conv.inner = (void*)(this_arg & (~1));
26373 this_arg_conv.is_owned = false;
26374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26375 LDKRoute route_conv;
26376 route_conv.inner = (void*)(route & (~1));
26377 route_conv.is_owned = false;
26378 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26379 LDKThirtyTwoBytes payment_id_ref;
26380 CHECK(payment_id->arr_len == 32);
26381 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26382 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
26383 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
26384 return (uint32_t)ret_conv;
26387 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
26388 LDKChannelManager this_arg_conv;
26389 this_arg_conv.inner = (void*)(this_arg & (~1));
26390 this_arg_conv.is_owned = false;
26391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26392 LDKThirtyTwoBytes payment_id_ref;
26393 CHECK(payment_id->arr_len == 32);
26394 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26395 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
26398 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) {
26399 LDKChannelManager this_arg_conv;
26400 this_arg_conv.inner = (void*)(this_arg & (~1));
26401 this_arg_conv.is_owned = false;
26402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26403 LDKRoute route_conv;
26404 route_conv.inner = (void*)(route & (~1));
26405 route_conv.is_owned = false;
26406 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26407 LDKThirtyTwoBytes payment_preimage_ref;
26408 CHECK(payment_preimage->arr_len == 32);
26409 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26410 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
26411 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
26412 return (uint32_t)ret_conv;
26415 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) {
26416 LDKChannelManager this_arg_conv;
26417 this_arg_conv.inner = (void*)(this_arg & (~1));
26418 this_arg_conv.is_owned = false;
26419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26420 unsigned char temporary_channel_id_arr[32];
26421 CHECK(temporary_channel_id->arr_len == 32);
26422 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26423 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26424 LDKPublicKey counterparty_node_id_ref;
26425 CHECK(counterparty_node_id->arr_len == 33);
26426 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26427 LDKTransaction funding_transaction_ref;
26428 funding_transaction_ref.datalen = funding_transaction->arr_len;
26429 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
26430 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
26431 funding_transaction_ref.data_is_owned = true;
26432 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26433 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
26434 return (uint32_t)ret_conv;
26437 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) {
26438 LDKChannelManager this_arg_conv;
26439 this_arg_conv.inner = (void*)(this_arg & (~1));
26440 this_arg_conv.is_owned = false;
26441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26442 LDKThreeBytes rgb_ref;
26443 CHECK(rgb->arr_len == 3);
26444 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
26445 LDKThirtyTwoBytes alias_ref;
26446 CHECK(alias->arr_len == 32);
26447 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
26448 LDKCVec_NetAddressZ addresses_constr;
26449 addresses_constr.datalen = addresses->arr_len;
26450 if (addresses_constr.datalen > 0)
26451 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26453 addresses_constr.data = NULL;
26454 uint32_t* addresses_vals = addresses->elems;
26455 for (size_t m = 0; m < addresses_constr.datalen; m++) {
26456 uint32_t addresses_conv_12 = addresses_vals[m];
26457 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
26458 CHECK_ACCESS(addresses_conv_12_ptr);
26459 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
26460 addresses_constr.data[m] = addresses_conv_12_conv;
26463 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
26466 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
26467 LDKChannelManager this_arg_conv;
26468 this_arg_conv.inner = (void*)(this_arg & (~1));
26469 this_arg_conv.is_owned = false;
26470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26471 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
26474 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
26475 LDKChannelManager this_arg_conv;
26476 this_arg_conv.inner = (void*)(this_arg & (~1));
26477 this_arg_conv.is_owned = false;
26478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26479 ChannelManager_timer_tick_occurred(&this_arg_conv);
26482 void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
26483 LDKChannelManager this_arg_conv;
26484 this_arg_conv.inner = (void*)(this_arg & (~1));
26485 this_arg_conv.is_owned = false;
26486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26487 unsigned char payment_hash_arr[32];
26488 CHECK(payment_hash->arr_len == 32);
26489 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
26490 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
26491 ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
26494 void __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
26495 LDKChannelManager this_arg_conv;
26496 this_arg_conv.inner = (void*)(this_arg & (~1));
26497 this_arg_conv.is_owned = false;
26498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26499 LDKThirtyTwoBytes payment_preimage_ref;
26500 CHECK(payment_preimage->arr_len == 32);
26501 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26502 ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
26505 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
26506 LDKChannelManager this_arg_conv;
26507 this_arg_conv.inner = (void*)(this_arg & (~1));
26508 this_arg_conv.is_owned = false;
26509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26510 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26511 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
26515 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) {
26516 LDKChannelManager this_arg_conv;
26517 this_arg_conv.inner = (void*)(this_arg & (~1));
26518 this_arg_conv.is_owned = false;
26519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26520 unsigned char temporary_channel_id_arr[32];
26521 CHECK(temporary_channel_id->arr_len == 32);
26522 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26523 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26524 LDKPublicKey counterparty_node_id_ref;
26525 CHECK(counterparty_node_id->arr_len == 33);
26526 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26527 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26528 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26529 return (uint32_t)ret_conv;
26532 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) {
26533 LDKChannelManager this_arg_conv;
26534 this_arg_conv.inner = (void*)(this_arg & (~1));
26535 this_arg_conv.is_owned = false;
26536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26537 unsigned char temporary_channel_id_arr[32];
26538 CHECK(temporary_channel_id->arr_len == 32);
26539 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26540 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26541 LDKPublicKey counterparty_node_id_ref;
26542 CHECK(counterparty_node_id->arr_len == 33);
26543 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26544 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26545 *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26546 return (uint32_t)ret_conv;
26549 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) {
26550 LDKChannelManager this_arg_conv;
26551 this_arg_conv.inner = (void*)(this_arg & (~1));
26552 this_arg_conv.is_owned = false;
26553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26554 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26555 CHECK_ACCESS(min_value_msat_ptr);
26556 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26557 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26558 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26559 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26560 return (uint32_t)ret_conv;
26563 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) {
26564 LDKChannelManager this_arg_conv;
26565 this_arg_conv.inner = (void*)(this_arg & (~1));
26566 this_arg_conv.is_owned = false;
26567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26568 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26569 CHECK_ACCESS(min_value_msat_ptr);
26570 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26571 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26572 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
26573 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26574 return (uint32_t)ret_conv;
26577 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) {
26578 LDKChannelManager this_arg_conv;
26579 this_arg_conv.inner = (void*)(this_arg & (~1));
26580 this_arg_conv.is_owned = false;
26581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26582 LDKThirtyTwoBytes payment_hash_ref;
26583 CHECK(payment_hash->arr_len == 32);
26584 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26585 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26586 CHECK_ACCESS(min_value_msat_ptr);
26587 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26588 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26589 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26590 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26591 return (uint32_t)ret_conv;
26594 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) {
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 LDKThirtyTwoBytes payment_hash_ref;
26600 CHECK(payment_hash->arr_len == 32);
26601 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26602 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
26603 CHECK_ACCESS(min_value_msat_ptr);
26604 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26605 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
26606 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
26607 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26608 return (uint32_t)ret_conv;
26611 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) {
26612 LDKChannelManager this_arg_conv;
26613 this_arg_conv.inner = (void*)(this_arg & (~1));
26614 this_arg_conv.is_owned = false;
26615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26616 LDKThirtyTwoBytes payment_hash_ref;
26617 CHECK(payment_hash->arr_len == 32);
26618 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26619 LDKThirtyTwoBytes payment_secret_ref;
26620 CHECK(payment_secret->arr_len == 32);
26621 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26622 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
26623 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
26624 return (uint32_t)ret_conv;
26627 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
26628 LDKChannelManager this_arg_conv;
26629 this_arg_conv.inner = (void*)(this_arg & (~1));
26630 this_arg_conv.is_owned = false;
26631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26632 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
26636 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
26637 LDKChannelManager this_arg_conv;
26638 this_arg_conv.inner = (void*)(this_arg & (~1));
26639 this_arg_conv.is_owned = false;
26640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26641 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
26642 uint32_t ret_ref = 0;
26643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26646 ret_ref = (uintptr_t)ret_var.inner;
26647 if (ret_var.is_owned) {
26653 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
26654 LDKChannelManager this_arg_conv;
26655 this_arg_conv.inner = (void*)(this_arg & (~1));
26656 this_arg_conv.is_owned = false;
26657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26658 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26659 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
26660 return (uint32_t)ret_ret;
26663 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
26664 LDKChannelManager this_arg_conv;
26665 this_arg_conv.inner = (void*)(this_arg & (~1));
26666 this_arg_conv.is_owned = false;
26667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26668 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26669 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
26670 return (uint32_t)ret_ret;
26673 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
26674 LDKChannelManager this_arg_conv;
26675 this_arg_conv.inner = (void*)(this_arg & (~1));
26676 this_arg_conv.is_owned = false;
26677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26678 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26679 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
26680 return (uint32_t)ret_ret;
26683 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
26684 LDKChannelManager this_arg_conv;
26685 this_arg_conv.inner = (void*)(this_arg & (~1));
26686 this_arg_conv.is_owned = false;
26687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26688 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26689 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
26690 return (uint32_t)ret_ret;
26693 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
26694 LDKChannelManager this_arg_conv;
26695 this_arg_conv.inner = (void*)(this_arg & (~1));
26696 this_arg_conv.is_owned = false;
26697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26698 ChannelManager_await_persistable_update(&this_arg_conv);
26701 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
26702 LDKChannelManager this_arg_conv;
26703 this_arg_conv.inner = (void*)(this_arg & (~1));
26704 this_arg_conv.is_owned = false;
26705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26706 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
26707 uint32_t ret_ref = 0;
26708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26711 ret_ref = (uintptr_t)ret_var.inner;
26712 if (ret_var.is_owned) {
26718 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
26719 LDKChannelManager this_arg_conv;
26720 this_arg_conv.inner = (void*)(this_arg & (~1));
26721 this_arg_conv.is_owned = false;
26722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26723 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26724 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
26725 return (uint32_t)ret_ret;
26728 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
26729 LDKCounterpartyForwardingInfo obj_conv;
26730 obj_conv.inner = (void*)(obj & (~1));
26731 obj_conv.is_owned = false;
26732 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26733 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
26734 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26735 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26736 CVec_u8Z_free(ret_var);
26740 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
26741 LDKu8slice ser_ref;
26742 ser_ref.datalen = ser->arr_len;
26743 ser_ref.data = ser->elems;
26744 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26745 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
26747 return (uint32_t)ret_conv;
26750 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
26751 LDKChannelCounterparty obj_conv;
26752 obj_conv.inner = (void*)(obj & (~1));
26753 obj_conv.is_owned = false;
26754 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26755 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
26756 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26757 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26758 CVec_u8Z_free(ret_var);
26762 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
26763 LDKu8slice ser_ref;
26764 ser_ref.datalen = ser->arr_len;
26765 ser_ref.data = ser->elems;
26766 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26767 *ret_conv = ChannelCounterparty_read(ser_ref);
26769 return (uint32_t)ret_conv;
26772 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
26773 LDKChannelDetails obj_conv;
26774 obj_conv.inner = (void*)(obj & (~1));
26775 obj_conv.is_owned = false;
26776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26777 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
26778 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26779 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26780 CVec_u8Z_free(ret_var);
26784 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
26785 LDKu8slice ser_ref;
26786 ser_ref.datalen = ser->arr_len;
26787 ser_ref.data = ser->elems;
26788 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26789 *ret_conv = ChannelDetails_read(ser_ref);
26791 return (uint32_t)ret_conv;
26794 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
26795 LDKPhantomRouteHints obj_conv;
26796 obj_conv.inner = (void*)(obj & (~1));
26797 obj_conv.is_owned = false;
26798 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26799 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
26800 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26801 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26802 CVec_u8Z_free(ret_var);
26806 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
26807 LDKu8slice ser_ref;
26808 ser_ref.datalen = ser->arr_len;
26809 ser_ref.data = ser->elems;
26810 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26811 *ret_conv = PhantomRouteHints_read(ser_ref);
26813 return (uint32_t)ret_conv;
26816 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
26817 LDKChannelManager obj_conv;
26818 obj_conv.inner = (void*)(obj & (~1));
26819 obj_conv.is_owned = false;
26820 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26821 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
26822 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26823 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26824 CVec_u8Z_free(ret_var);
26828 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
26829 LDKChannelManagerReadArgs this_obj_conv;
26830 this_obj_conv.inner = (void*)(this_obj & (~1));
26831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26833 ChannelManagerReadArgs_free(this_obj_conv);
26836 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
26837 LDKChannelManagerReadArgs this_ptr_conv;
26838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26839 this_ptr_conv.is_owned = false;
26840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26841 // WARNING: This object doesn't live past this scope, needs clone!
26842 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
26846 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
26847 LDKChannelManagerReadArgs this_ptr_conv;
26848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26849 this_ptr_conv.is_owned = false;
26850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26851 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26852 CHECK_ACCESS(val_ptr);
26853 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
26854 if (val_conv.free == LDKKeysInterface_JCalls_free) {
26855 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26856 LDKKeysInterface_JCalls_cloned(&val_conv);
26858 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
26861 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
26862 LDKChannelManagerReadArgs this_ptr_conv;
26863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26864 this_ptr_conv.is_owned = false;
26865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26866 // WARNING: This object doesn't live past this scope, needs clone!
26867 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
26871 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
26872 LDKChannelManagerReadArgs this_ptr_conv;
26873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26874 this_ptr_conv.is_owned = false;
26875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26876 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26877 CHECK_ACCESS(val_ptr);
26878 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
26879 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
26880 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26881 LDKFeeEstimator_JCalls_cloned(&val_conv);
26883 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
26886 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
26887 LDKChannelManagerReadArgs this_ptr_conv;
26888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26889 this_ptr_conv.is_owned = false;
26890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26891 // WARNING: This object doesn't live past this scope, needs clone!
26892 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
26896 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
26897 LDKChannelManagerReadArgs this_ptr_conv;
26898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26899 this_ptr_conv.is_owned = false;
26900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26901 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26902 CHECK_ACCESS(val_ptr);
26903 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
26904 if (val_conv.free == LDKWatch_JCalls_free) {
26905 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26906 LDKWatch_JCalls_cloned(&val_conv);
26908 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
26911 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
26912 LDKChannelManagerReadArgs this_ptr_conv;
26913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26914 this_ptr_conv.is_owned = false;
26915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26916 // WARNING: This object doesn't live past this scope, needs clone!
26917 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
26921 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
26922 LDKChannelManagerReadArgs this_ptr_conv;
26923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26924 this_ptr_conv.is_owned = false;
26925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26926 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26927 CHECK_ACCESS(val_ptr);
26928 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
26929 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
26930 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26931 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
26933 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
26936 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
26937 LDKChannelManagerReadArgs this_ptr_conv;
26938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26939 this_ptr_conv.is_owned = false;
26940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26941 // WARNING: This object doesn't live past this scope, needs clone!
26942 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
26946 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
26947 LDKChannelManagerReadArgs this_ptr_conv;
26948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26949 this_ptr_conv.is_owned = false;
26950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26951 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26952 CHECK_ACCESS(val_ptr);
26953 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
26954 if (val_conv.free == LDKLogger_JCalls_free) {
26955 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26956 LDKLogger_JCalls_cloned(&val_conv);
26958 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
26961 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
26962 LDKChannelManagerReadArgs this_ptr_conv;
26963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26964 this_ptr_conv.is_owned = false;
26965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26966 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
26967 uint32_t ret_ref = 0;
26968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26971 ret_ref = (uintptr_t)ret_var.inner;
26972 if (ret_var.is_owned) {
26978 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
26979 LDKChannelManagerReadArgs this_ptr_conv;
26980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26981 this_ptr_conv.is_owned = false;
26982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26983 LDKUserConfig val_conv;
26984 val_conv.inner = (void*)(val & (~1));
26985 val_conv.is_owned = (val & 1) || (val == 0);
26986 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26987 val_conv = UserConfig_clone(&val_conv);
26988 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
26991 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) {
26992 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26993 CHECK_ACCESS(keys_manager_ptr);
26994 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26995 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26996 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26997 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26999 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27000 CHECK_ACCESS(fee_estimator_ptr);
27001 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27002 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27004 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27006 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
27007 CHECK_ACCESS(chain_monitor_ptr);
27008 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27009 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27010 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27011 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27013 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
27014 CHECK_ACCESS(tx_broadcaster_ptr);
27015 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27016 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27017 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27018 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27020 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27021 CHECK_ACCESS(logger_ptr);
27022 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27023 if (logger_conv.free == LDKLogger_JCalls_free) {
27024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27025 LDKLogger_JCalls_cloned(&logger_conv);
27027 LDKUserConfig default_config_conv;
27028 default_config_conv.inner = (void*)(default_config & (~1));
27029 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
27030 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
27031 default_config_conv = UserConfig_clone(&default_config_conv);
27032 LDKCVec_ChannelMonitorZ channel_monitors_constr;
27033 channel_monitors_constr.datalen = channel_monitors->arr_len;
27034 if (channel_monitors_constr.datalen > 0)
27035 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
27037 channel_monitors_constr.data = NULL;
27038 uint32_t* channel_monitors_vals = channel_monitors->elems;
27039 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
27040 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
27041 LDKChannelMonitor channel_monitors_conv_16_conv;
27042 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
27043 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
27045 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
27047 FREE(channel_monitors);
27048 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);
27049 uint32_t ret_ref = 0;
27050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27053 ret_ref = (uintptr_t)ret_var.inner;
27054 if (ret_var.is_owned) {
27060 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
27061 LDKu8slice ser_ref;
27062 ser_ref.datalen = ser->arr_len;
27063 ser_ref.data = ser->elems;
27064 LDKChannelManagerReadArgs arg_conv;
27065 arg_conv.inner = (void*)(arg & (~1));
27066 arg_conv.is_owned = (arg & 1) || (arg == 0);
27067 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27068 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
27069 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
27070 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
27072 return (uint32_t)ret_conv;
27075 void __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint32_t this_obj) {
27076 LDKExpandedKey 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 ExpandedKey_free(this_obj_conv);
27083 uint32_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
27084 unsigned char key_material_arr[32];
27085 CHECK(key_material->arr_len == 32);
27086 memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
27087 unsigned char (*key_material_ref)[32] = &key_material_arr;
27088 LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
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 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) {
27101 LDKExpandedKey keys_conv;
27102 keys_conv.inner = (void*)(keys & (~1));
27103 keys_conv.is_owned = false;
27104 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27105 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27106 CHECK_ACCESS(min_value_msat_ptr);
27107 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27108 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27109 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
27110 if (!(keys_manager & 1)) { CHECK_ACCESS(keys_manager_ptr); }
27111 LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
27112 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27113 *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
27114 return (uint32_t)ret_conv;
27117 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) {
27118 LDKExpandedKey keys_conv;
27119 keys_conv.inner = (void*)(keys & (~1));
27120 keys_conv.is_owned = false;
27121 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
27122 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27123 CHECK_ACCESS(min_value_msat_ptr);
27124 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27125 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27126 LDKThirtyTwoBytes payment_hash_ref;
27127 CHECK(payment_hash->arr_len == 32);
27128 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27129 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27130 *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
27131 return (uint32_t)ret_conv;
27134 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
27135 LDKDecodeError this_obj_conv;
27136 this_obj_conv.inner = (void*)(this_obj & (~1));
27137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27139 DecodeError_free(this_obj_conv);
27142 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
27143 LDKDecodeError ret_var = DecodeError_clone(arg);
27144 uint32_t ret_ref = 0;
27145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27148 ret_ref = (uintptr_t)ret_var.inner;
27149 if (ret_var.is_owned) {
27154 uint32_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
27155 LDKDecodeError arg_conv;
27156 arg_conv.inner = (void*)(arg & (~1));
27157 arg_conv.is_owned = false;
27158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27159 uint32_t ret_conv = DecodeError_clone_ptr(&arg_conv);
27163 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
27164 LDKDecodeError orig_conv;
27165 orig_conv.inner = (void*)(orig & (~1));
27166 orig_conv.is_owned = false;
27167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27168 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
27169 uint32_t ret_ref = 0;
27170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27173 ret_ref = (uintptr_t)ret_var.inner;
27174 if (ret_var.is_owned) {
27180 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
27181 LDKInit this_obj_conv;
27182 this_obj_conv.inner = (void*)(this_obj & (~1));
27183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27185 Init_free(this_obj_conv);
27188 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
27189 LDKInit this_ptr_conv;
27190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27191 this_ptr_conv.is_owned = false;
27192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27193 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
27194 uint32_t ret_ref = 0;
27195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27198 ret_ref = (uintptr_t)ret_var.inner;
27199 if (ret_var.is_owned) {
27205 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
27206 LDKInit this_ptr_conv;
27207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27208 this_ptr_conv.is_owned = false;
27209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27210 LDKInitFeatures val_conv;
27211 val_conv.inner = (void*)(val & (~1));
27212 val_conv.is_owned = (val & 1) || (val == 0);
27213 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27214 val_conv = InitFeatures_clone(&val_conv);
27215 Init_set_features(&this_ptr_conv, val_conv);
27218 uint32_t __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint32_t this_ptr) {
27219 LDKInit this_ptr_conv;
27220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27221 this_ptr_conv.is_owned = false;
27222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27223 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
27224 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
27225 uint32_t ret_ref = (uintptr_t)ret_copy;
27229 void __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint32_t this_ptr, uint32_t val) {
27230 LDKInit this_ptr_conv;
27231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27232 this_ptr_conv.is_owned = false;
27233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27234 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27235 CHECK_ACCESS(val_ptr);
27236 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
27237 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
27238 Init_set_remote_network_address(&this_ptr_conv, val_conv);
27241 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg, uint32_t remote_network_address_arg) {
27242 LDKInitFeatures features_arg_conv;
27243 features_arg_conv.inner = (void*)(features_arg & (~1));
27244 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27245 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27246 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27247 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
27248 CHECK_ACCESS(remote_network_address_arg_ptr);
27249 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
27250 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
27251 uint32_t ret_ref = 0;
27252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27255 ret_ref = (uintptr_t)ret_var.inner;
27256 if (ret_var.is_owned) {
27262 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
27263 LDKInit ret_var = Init_clone(arg);
27264 uint32_t ret_ref = 0;
27265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27268 ret_ref = (uintptr_t)ret_var.inner;
27269 if (ret_var.is_owned) {
27274 uint32_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
27276 arg_conv.inner = (void*)(arg & (~1));
27277 arg_conv.is_owned = false;
27278 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27279 uint32_t ret_conv = Init_clone_ptr(&arg_conv);
27283 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
27285 orig_conv.inner = (void*)(orig & (~1));
27286 orig_conv.is_owned = false;
27287 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27288 LDKInit ret_var = Init_clone(&orig_conv);
27289 uint32_t ret_ref = 0;
27290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27293 ret_ref = (uintptr_t)ret_var.inner;
27294 if (ret_var.is_owned) {
27300 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
27301 LDKErrorMessage this_obj_conv;
27302 this_obj_conv.inner = (void*)(this_obj & (~1));
27303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27305 ErrorMessage_free(this_obj_conv);
27308 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
27309 LDKErrorMessage this_ptr_conv;
27310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27311 this_ptr_conv.is_owned = false;
27312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27313 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27314 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
27318 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27319 LDKErrorMessage this_ptr_conv;
27320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27321 this_ptr_conv.is_owned = false;
27322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27323 LDKThirtyTwoBytes val_ref;
27324 CHECK(val->arr_len == 32);
27325 memcpy(val_ref.data, val->elems, 32); FREE(val);
27326 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
27329 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
27330 LDKErrorMessage this_ptr_conv;
27331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27332 this_ptr_conv.is_owned = false;
27333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27334 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
27335 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27340 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
27341 LDKErrorMessage this_ptr_conv;
27342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27343 this_ptr_conv.is_owned = false;
27344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27345 LDKStr val_conv = str_ref_to_owned_c(val);
27346 ErrorMessage_set_data(&this_ptr_conv, val_conv);
27349 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27350 LDKThirtyTwoBytes channel_id_arg_ref;
27351 CHECK(channel_id_arg->arr_len == 32);
27352 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27353 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27354 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
27355 uint32_t ret_ref = 0;
27356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27359 ret_ref = (uintptr_t)ret_var.inner;
27360 if (ret_var.is_owned) {
27366 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
27367 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
27368 uint32_t ret_ref = 0;
27369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27372 ret_ref = (uintptr_t)ret_var.inner;
27373 if (ret_var.is_owned) {
27378 uint32_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
27379 LDKErrorMessage arg_conv;
27380 arg_conv.inner = (void*)(arg & (~1));
27381 arg_conv.is_owned = false;
27382 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27383 uint32_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
27387 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
27388 LDKErrorMessage orig_conv;
27389 orig_conv.inner = (void*)(orig & (~1));
27390 orig_conv.is_owned = false;
27391 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27392 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
27393 uint32_t ret_ref = 0;
27394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27397 ret_ref = (uintptr_t)ret_var.inner;
27398 if (ret_var.is_owned) {
27404 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
27405 LDKWarningMessage this_obj_conv;
27406 this_obj_conv.inner = (void*)(this_obj & (~1));
27407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27409 WarningMessage_free(this_obj_conv);
27412 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
27413 LDKWarningMessage this_ptr_conv;
27414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27415 this_ptr_conv.is_owned = false;
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27417 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27418 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
27422 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27423 LDKWarningMessage this_ptr_conv;
27424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27425 this_ptr_conv.is_owned = false;
27426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27427 LDKThirtyTwoBytes val_ref;
27428 CHECK(val->arr_len == 32);
27429 memcpy(val_ref.data, val->elems, 32); FREE(val);
27430 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
27433 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
27434 LDKWarningMessage this_ptr_conv;
27435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27436 this_ptr_conv.is_owned = false;
27437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27438 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
27439 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27444 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
27445 LDKWarningMessage this_ptr_conv;
27446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27447 this_ptr_conv.is_owned = false;
27448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27449 LDKStr val_conv = str_ref_to_owned_c(val);
27450 WarningMessage_set_data(&this_ptr_conv, val_conv);
27453 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27454 LDKThirtyTwoBytes channel_id_arg_ref;
27455 CHECK(channel_id_arg->arr_len == 32);
27456 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27457 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27458 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
27459 uint32_t ret_ref = 0;
27460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27463 ret_ref = (uintptr_t)ret_var.inner;
27464 if (ret_var.is_owned) {
27470 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
27471 LDKWarningMessage ret_var = WarningMessage_clone(arg);
27472 uint32_t ret_ref = 0;
27473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27476 ret_ref = (uintptr_t)ret_var.inner;
27477 if (ret_var.is_owned) {
27482 uint32_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
27483 LDKWarningMessage arg_conv;
27484 arg_conv.inner = (void*)(arg & (~1));
27485 arg_conv.is_owned = false;
27486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27487 uint32_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
27491 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
27492 LDKWarningMessage orig_conv;
27493 orig_conv.inner = (void*)(orig & (~1));
27494 orig_conv.is_owned = false;
27495 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27496 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
27497 uint32_t ret_ref = 0;
27498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27501 ret_ref = (uintptr_t)ret_var.inner;
27502 if (ret_var.is_owned) {
27508 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
27509 LDKPing this_obj_conv;
27510 this_obj_conv.inner = (void*)(this_obj & (~1));
27511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27513 Ping_free(this_obj_conv);
27516 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
27517 LDKPing this_ptr_conv;
27518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27519 this_ptr_conv.is_owned = false;
27520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27521 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
27525 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
27526 LDKPing this_ptr_conv;
27527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27528 this_ptr_conv.is_owned = false;
27529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27530 Ping_set_ponglen(&this_ptr_conv, val);
27533 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
27534 LDKPing this_ptr_conv;
27535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27536 this_ptr_conv.is_owned = false;
27537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27538 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
27542 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
27543 LDKPing this_ptr_conv;
27544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27545 this_ptr_conv.is_owned = false;
27546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27547 Ping_set_byteslen(&this_ptr_conv, val);
27550 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
27551 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27552 uint32_t ret_ref = 0;
27553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27556 ret_ref = (uintptr_t)ret_var.inner;
27557 if (ret_var.is_owned) {
27563 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27564 LDKPing ret_var = Ping_clone(arg);
27565 uint32_t ret_ref = 0;
27566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27569 ret_ref = (uintptr_t)ret_var.inner;
27570 if (ret_var.is_owned) {
27575 uint32_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
27577 arg_conv.inner = (void*)(arg & (~1));
27578 arg_conv.is_owned = false;
27579 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27580 uint32_t ret_conv = Ping_clone_ptr(&arg_conv);
27584 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
27586 orig_conv.inner = (void*)(orig & (~1));
27587 orig_conv.is_owned = false;
27588 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27589 LDKPing ret_var = Ping_clone(&orig_conv);
27590 uint32_t ret_ref = 0;
27591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27594 ret_ref = (uintptr_t)ret_var.inner;
27595 if (ret_var.is_owned) {
27601 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
27602 LDKPong this_obj_conv;
27603 this_obj_conv.inner = (void*)(this_obj & (~1));
27604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27606 Pong_free(this_obj_conv);
27609 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
27610 LDKPong this_ptr_conv;
27611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27612 this_ptr_conv.is_owned = false;
27613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27614 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
27618 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
27619 LDKPong this_ptr_conv;
27620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27621 this_ptr_conv.is_owned = false;
27622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27623 Pong_set_byteslen(&this_ptr_conv, val);
27626 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
27627 LDKPong ret_var = Pong_new(byteslen_arg);
27628 uint32_t ret_ref = 0;
27629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27632 ret_ref = (uintptr_t)ret_var.inner;
27633 if (ret_var.is_owned) {
27639 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27640 LDKPong ret_var = Pong_clone(arg);
27641 uint32_t ret_ref = 0;
27642 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27643 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27645 ret_ref = (uintptr_t)ret_var.inner;
27646 if (ret_var.is_owned) {
27651 uint32_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
27653 arg_conv.inner = (void*)(arg & (~1));
27654 arg_conv.is_owned = false;
27655 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27656 uint32_t ret_conv = Pong_clone_ptr(&arg_conv);
27660 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
27662 orig_conv.inner = (void*)(orig & (~1));
27663 orig_conv.is_owned = false;
27664 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27665 LDKPong ret_var = Pong_clone(&orig_conv);
27666 uint32_t ret_ref = 0;
27667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27670 ret_ref = (uintptr_t)ret_var.inner;
27671 if (ret_var.is_owned) {
27677 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
27678 LDKOpenChannel this_obj_conv;
27679 this_obj_conv.inner = (void*)(this_obj & (~1));
27680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27682 OpenChannel_free(this_obj_conv);
27685 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
27686 LDKOpenChannel this_ptr_conv;
27687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27688 this_ptr_conv.is_owned = false;
27689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27690 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27691 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
27695 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
27696 LDKOpenChannel this_ptr_conv;
27697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27698 this_ptr_conv.is_owned = false;
27699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27700 LDKThirtyTwoBytes val_ref;
27701 CHECK(val->arr_len == 32);
27702 memcpy(val_ref.data, val->elems, 32); FREE(val);
27703 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
27706 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
27707 LDKOpenChannel this_ptr_conv;
27708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27709 this_ptr_conv.is_owned = false;
27710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27711 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27712 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27716 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray 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 LDKThirtyTwoBytes val_ref;
27722 CHECK(val->arr_len == 32);
27723 memcpy(val_ref.data, val->elems, 32); FREE(val);
27724 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27727 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
27728 LDKOpenChannel this_ptr_conv;
27729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27730 this_ptr_conv.is_owned = false;
27731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27732 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
27736 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
27737 LDKOpenChannel this_ptr_conv;
27738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27739 this_ptr_conv.is_owned = false;
27740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27741 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
27744 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
27745 LDKOpenChannel this_ptr_conv;
27746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27747 this_ptr_conv.is_owned = false;
27748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27749 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
27753 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
27754 LDKOpenChannel this_ptr_conv;
27755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27756 this_ptr_conv.is_owned = false;
27757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27758 OpenChannel_set_push_msat(&this_ptr_conv, val);
27761 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
27762 LDKOpenChannel this_ptr_conv;
27763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27764 this_ptr_conv.is_owned = false;
27765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27766 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
27770 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
27771 LDKOpenChannel this_ptr_conv;
27772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27773 this_ptr_conv.is_owned = false;
27774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27775 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27778 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) {
27779 LDKOpenChannel this_ptr_conv;
27780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27781 this_ptr_conv.is_owned = false;
27782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27783 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27787 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) {
27788 LDKOpenChannel this_ptr_conv;
27789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27790 this_ptr_conv.is_owned = false;
27791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27792 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27795 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
27796 LDKOpenChannel this_ptr_conv;
27797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27798 this_ptr_conv.is_owned = false;
27799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27800 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27804 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
27805 LDKOpenChannel this_ptr_conv;
27806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27807 this_ptr_conv.is_owned = false;
27808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27809 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27812 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
27813 LDKOpenChannel this_ptr_conv;
27814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27815 this_ptr_conv.is_owned = false;
27816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27817 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
27821 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
27822 LDKOpenChannel this_ptr_conv;
27823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27824 this_ptr_conv.is_owned = false;
27825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27826 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27829 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
27830 LDKOpenChannel this_ptr_conv;
27831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27832 this_ptr_conv.is_owned = false;
27833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27834 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
27838 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
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 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
27846 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
27847 LDKOpenChannel this_ptr_conv;
27848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27849 this_ptr_conv.is_owned = false;
27850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27851 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
27855 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
27856 LDKOpenChannel this_ptr_conv;
27857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27858 this_ptr_conv.is_owned = false;
27859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27860 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
27863 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
27864 LDKOpenChannel this_ptr_conv;
27865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27866 this_ptr_conv.is_owned = false;
27867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27868 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
27872 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
27873 LDKOpenChannel this_ptr_conv;
27874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27875 this_ptr_conv.is_owned = false;
27876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27877 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27880 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(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_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27890 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(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_funding_pubkey(&this_ptr_conv, val_ref);
27901 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(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_tArray ret_arr = init_int8_tArray(33, __LINE__);
27907 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27911 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
27912 LDKOpenChannel this_ptr_conv;
27913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27914 this_ptr_conv.is_owned = false;
27915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27916 LDKPublicKey val_ref;
27917 CHECK(val->arr_len == 33);
27918 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27919 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27922 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
27923 LDKOpenChannel this_ptr_conv;
27924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27925 this_ptr_conv.is_owned = false;
27926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27927 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27928 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27932 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
27933 LDKOpenChannel this_ptr_conv;
27934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27935 this_ptr_conv.is_owned = false;
27936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27937 LDKPublicKey val_ref;
27938 CHECK(val->arr_len == 33);
27939 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27940 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
27943 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
27944 LDKOpenChannel this_ptr_conv;
27945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27946 this_ptr_conv.is_owned = false;
27947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27948 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27949 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27953 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
27954 LDKOpenChannel this_ptr_conv;
27955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27956 this_ptr_conv.is_owned = false;
27957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27958 LDKPublicKey val_ref;
27959 CHECK(val->arr_len == 33);
27960 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27961 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27964 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
27965 LDKOpenChannel this_ptr_conv;
27966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27967 this_ptr_conv.is_owned = false;
27968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27969 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27970 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27974 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
27975 LDKOpenChannel this_ptr_conv;
27976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27977 this_ptr_conv.is_owned = false;
27978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27979 LDKPublicKey val_ref;
27980 CHECK(val->arr_len == 33);
27981 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27982 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27985 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
27986 LDKOpenChannel this_ptr_conv;
27987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27988 this_ptr_conv.is_owned = false;
27989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27990 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27991 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27995 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) {
27996 LDKOpenChannel this_ptr_conv;
27997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27998 this_ptr_conv.is_owned = false;
27999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28000 LDKPublicKey val_ref;
28001 CHECK(val->arr_len == 33);
28002 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28003 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28006 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
28007 LDKOpenChannel 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 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
28015 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
28016 LDKOpenChannel this_ptr_conv;
28017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28018 this_ptr_conv.is_owned = false;
28019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28020 OpenChannel_set_channel_flags(&this_ptr_conv, val);
28023 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
28024 LDKOpenChannel this_ptr_conv;
28025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28026 this_ptr_conv.is_owned = false;
28027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28028 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
28029 uint32_t ret_ref = 0;
28030 if ((uintptr_t)ret_var.inner > 4096) {
28031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28034 ret_ref = (uintptr_t)ret_var.inner;
28035 if (ret_var.is_owned) {
28042 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
28043 LDKOpenChannel this_ptr_conv;
28044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28045 this_ptr_conv.is_owned = false;
28046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28047 LDKChannelTypeFeatures val_conv;
28048 val_conv.inner = (void*)(val & (~1));
28049 val_conv.is_owned = (val & 1) || (val == 0);
28050 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28051 val_conv = ChannelTypeFeatures_clone(&val_conv);
28052 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
28055 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
28056 LDKOpenChannel ret_var = OpenChannel_clone(arg);
28057 uint32_t ret_ref = 0;
28058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28061 ret_ref = (uintptr_t)ret_var.inner;
28062 if (ret_var.is_owned) {
28067 uint32_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
28068 LDKOpenChannel arg_conv;
28069 arg_conv.inner = (void*)(arg & (~1));
28070 arg_conv.is_owned = false;
28071 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28072 uint32_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
28076 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
28077 LDKOpenChannel orig_conv;
28078 orig_conv.inner = (void*)(orig & (~1));
28079 orig_conv.is_owned = false;
28080 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28081 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
28082 uint32_t ret_ref = 0;
28083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28086 ret_ref = (uintptr_t)ret_var.inner;
28087 if (ret_var.is_owned) {
28093 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
28094 LDKAcceptChannel this_obj_conv;
28095 this_obj_conv.inner = (void*)(this_obj & (~1));
28096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28098 AcceptChannel_free(this_obj_conv);
28101 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
28102 LDKAcceptChannel this_ptr_conv;
28103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28104 this_ptr_conv.is_owned = false;
28105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28106 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28107 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28111 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray 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 LDKThirtyTwoBytes val_ref;
28117 CHECK(val->arr_len == 32);
28118 memcpy(val_ref.data, val->elems, 32); FREE(val);
28119 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28122 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
28123 LDKAcceptChannel this_ptr_conv;
28124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28125 this_ptr_conv.is_owned = false;
28126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28127 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
28131 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
28132 LDKAcceptChannel this_ptr_conv;
28133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28134 this_ptr_conv.is_owned = false;
28135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28136 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28139 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) {
28140 LDKAcceptChannel this_ptr_conv;
28141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28142 this_ptr_conv.is_owned = false;
28143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28144 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28148 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) {
28149 LDKAcceptChannel this_ptr_conv;
28150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28151 this_ptr_conv.is_owned = false;
28152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28153 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28156 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
28157 LDKAcceptChannel this_ptr_conv;
28158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28159 this_ptr_conv.is_owned = false;
28160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28161 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28165 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
28166 LDKAcceptChannel this_ptr_conv;
28167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28168 this_ptr_conv.is_owned = false;
28169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28170 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28173 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
28174 LDKAcceptChannel this_ptr_conv;
28175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28176 this_ptr_conv.is_owned = false;
28177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28178 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
28182 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
28183 LDKAcceptChannel this_ptr_conv;
28184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28185 this_ptr_conv.is_owned = false;
28186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28187 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28190 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
28191 LDKAcceptChannel this_ptr_conv;
28192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28193 this_ptr_conv.is_owned = false;
28194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28195 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
28199 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
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 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
28207 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
28208 LDKAcceptChannel this_ptr_conv;
28209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28210 this_ptr_conv.is_owned = false;
28211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28212 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
28216 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
28217 LDKAcceptChannel this_ptr_conv;
28218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28219 this_ptr_conv.is_owned = false;
28220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28221 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
28224 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
28225 LDKAcceptChannel this_ptr_conv;
28226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28227 this_ptr_conv.is_owned = false;
28228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28229 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
28233 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
28234 LDKAcceptChannel this_ptr_conv;
28235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28236 this_ptr_conv.is_owned = false;
28237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28238 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28241 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(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_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28251 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(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_funding_pubkey(&this_ptr_conv, val_ref);
28262 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28268 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28272 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28273 LDKAcceptChannel this_ptr_conv;
28274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28275 this_ptr_conv.is_owned = false;
28276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28277 LDKPublicKey val_ref;
28278 CHECK(val->arr_len == 33);
28279 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28280 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28283 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
28284 LDKAcceptChannel this_ptr_conv;
28285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28286 this_ptr_conv.is_owned = false;
28287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28288 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28289 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28293 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28294 LDKAcceptChannel this_ptr_conv;
28295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28296 this_ptr_conv.is_owned = false;
28297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28298 LDKPublicKey val_ref;
28299 CHECK(val->arr_len == 33);
28300 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28301 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
28304 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
28305 LDKAcceptChannel this_ptr_conv;
28306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28307 this_ptr_conv.is_owned = false;
28308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28309 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28310 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28314 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28315 LDKAcceptChannel this_ptr_conv;
28316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28317 this_ptr_conv.is_owned = false;
28318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28319 LDKPublicKey val_ref;
28320 CHECK(val->arr_len == 33);
28321 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28322 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28325 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
28326 LDKAcceptChannel this_ptr_conv;
28327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28328 this_ptr_conv.is_owned = false;
28329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28330 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28331 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28335 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28336 LDKAcceptChannel this_ptr_conv;
28337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28338 this_ptr_conv.is_owned = false;
28339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28340 LDKPublicKey val_ref;
28341 CHECK(val->arr_len == 33);
28342 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28343 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28346 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
28347 LDKAcceptChannel this_ptr_conv;
28348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28349 this_ptr_conv.is_owned = false;
28350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28351 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28352 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28356 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) {
28357 LDKAcceptChannel this_ptr_conv;
28358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28359 this_ptr_conv.is_owned = false;
28360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28361 LDKPublicKey val_ref;
28362 CHECK(val->arr_len == 33);
28363 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28364 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28367 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
28368 LDKAcceptChannel this_ptr_conv;
28369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28370 this_ptr_conv.is_owned = false;
28371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28372 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
28373 uint32_t ret_ref = 0;
28374 if ((uintptr_t)ret_var.inner > 4096) {
28375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28378 ret_ref = (uintptr_t)ret_var.inner;
28379 if (ret_var.is_owned) {
28386 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
28387 LDKAcceptChannel this_ptr_conv;
28388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28389 this_ptr_conv.is_owned = false;
28390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28391 LDKChannelTypeFeatures val_conv;
28392 val_conv.inner = (void*)(val & (~1));
28393 val_conv.is_owned = (val & 1) || (val == 0);
28394 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28395 val_conv = ChannelTypeFeatures_clone(&val_conv);
28396 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
28399 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28400 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
28401 uint32_t ret_ref = 0;
28402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28405 ret_ref = (uintptr_t)ret_var.inner;
28406 if (ret_var.is_owned) {
28411 uint32_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
28412 LDKAcceptChannel arg_conv;
28413 arg_conv.inner = (void*)(arg & (~1));
28414 arg_conv.is_owned = false;
28415 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28416 uint32_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
28420 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
28421 LDKAcceptChannel orig_conv;
28422 orig_conv.inner = (void*)(orig & (~1));
28423 orig_conv.is_owned = false;
28424 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28425 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28426 uint32_t ret_ref = 0;
28427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28430 ret_ref = (uintptr_t)ret_var.inner;
28431 if (ret_var.is_owned) {
28437 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
28438 LDKFundingCreated this_obj_conv;
28439 this_obj_conv.inner = (void*)(this_obj & (~1));
28440 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28442 FundingCreated_free(this_obj_conv);
28445 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
28446 LDKFundingCreated this_ptr_conv;
28447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28448 this_ptr_conv.is_owned = false;
28449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28450 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28451 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
28455 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
28456 LDKFundingCreated this_ptr_conv;
28457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28458 this_ptr_conv.is_owned = false;
28459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28460 LDKThirtyTwoBytes val_ref;
28461 CHECK(val->arr_len == 32);
28462 memcpy(val_ref.data, val->elems, 32); FREE(val);
28463 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28466 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
28467 LDKFundingCreated this_ptr_conv;
28468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28469 this_ptr_conv.is_owned = false;
28470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28471 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28472 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
28476 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
28477 LDKFundingCreated this_ptr_conv;
28478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28479 this_ptr_conv.is_owned = false;
28480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28481 LDKThirtyTwoBytes val_ref;
28482 CHECK(val->arr_len == 32);
28483 memcpy(val_ref.data, val->elems, 32); FREE(val);
28484 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28487 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
28488 LDKFundingCreated this_ptr_conv;
28489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28490 this_ptr_conv.is_owned = false;
28491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28492 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
28496 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
28497 LDKFundingCreated this_ptr_conv;
28498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28499 this_ptr_conv.is_owned = false;
28500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28501 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28504 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
28505 LDKFundingCreated this_ptr_conv;
28506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28507 this_ptr_conv.is_owned = false;
28508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28509 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28510 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
28514 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
28515 LDKFundingCreated this_ptr_conv;
28516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28517 this_ptr_conv.is_owned = false;
28518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28519 LDKSignature val_ref;
28520 CHECK(val->arr_len == 64);
28521 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28522 FundingCreated_set_signature(&this_ptr_conv, val_ref);
28525 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) {
28526 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28527 CHECK(temporary_channel_id_arg->arr_len == 32);
28528 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
28529 LDKThirtyTwoBytes funding_txid_arg_ref;
28530 CHECK(funding_txid_arg->arr_len == 32);
28531 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
28532 LDKSignature signature_arg_ref;
28533 CHECK(signature_arg->arr_len == 64);
28534 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28535 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28536 uint32_t ret_ref = 0;
28537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28540 ret_ref = (uintptr_t)ret_var.inner;
28541 if (ret_var.is_owned) {
28547 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28548 LDKFundingCreated ret_var = FundingCreated_clone(arg);
28549 uint32_t ret_ref = 0;
28550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28553 ret_ref = (uintptr_t)ret_var.inner;
28554 if (ret_var.is_owned) {
28559 uint32_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
28560 LDKFundingCreated arg_conv;
28561 arg_conv.inner = (void*)(arg & (~1));
28562 arg_conv.is_owned = false;
28563 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28564 uint32_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
28568 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
28569 LDKFundingCreated orig_conv;
28570 orig_conv.inner = (void*)(orig & (~1));
28571 orig_conv.is_owned = false;
28572 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28573 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28574 uint32_t ret_ref = 0;
28575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28578 ret_ref = (uintptr_t)ret_var.inner;
28579 if (ret_var.is_owned) {
28585 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
28586 LDKFundingSigned this_obj_conv;
28587 this_obj_conv.inner = (void*)(this_obj & (~1));
28588 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28590 FundingSigned_free(this_obj_conv);
28593 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
28594 LDKFundingSigned this_ptr_conv;
28595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28596 this_ptr_conv.is_owned = false;
28597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28598 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28599 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
28603 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28604 LDKFundingSigned this_ptr_conv;
28605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28606 this_ptr_conv.is_owned = false;
28607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28608 LDKThirtyTwoBytes val_ref;
28609 CHECK(val->arr_len == 32);
28610 memcpy(val_ref.data, val->elems, 32); FREE(val);
28611 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28614 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
28615 LDKFundingSigned this_ptr_conv;
28616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28617 this_ptr_conv.is_owned = false;
28618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28619 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28620 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28624 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28625 LDKFundingSigned this_ptr_conv;
28626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28627 this_ptr_conv.is_owned = false;
28628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28629 LDKSignature val_ref;
28630 CHECK(val->arr_len == 64);
28631 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28632 FundingSigned_set_signature(&this_ptr_conv, val_ref);
28635 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
28636 LDKThirtyTwoBytes channel_id_arg_ref;
28637 CHECK(channel_id_arg->arr_len == 32);
28638 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28639 LDKSignature signature_arg_ref;
28640 CHECK(signature_arg->arr_len == 64);
28641 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28642 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28643 uint32_t ret_ref = 0;
28644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28647 ret_ref = (uintptr_t)ret_var.inner;
28648 if (ret_var.is_owned) {
28654 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28655 LDKFundingSigned ret_var = FundingSigned_clone(arg);
28656 uint32_t ret_ref = 0;
28657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28660 ret_ref = (uintptr_t)ret_var.inner;
28661 if (ret_var.is_owned) {
28666 uint32_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
28667 LDKFundingSigned arg_conv;
28668 arg_conv.inner = (void*)(arg & (~1));
28669 arg_conv.is_owned = false;
28670 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28671 uint32_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
28675 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
28676 LDKFundingSigned orig_conv;
28677 orig_conv.inner = (void*)(orig & (~1));
28678 orig_conv.is_owned = false;
28679 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28680 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28681 uint32_t ret_ref = 0;
28682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28685 ret_ref = (uintptr_t)ret_var.inner;
28686 if (ret_var.is_owned) {
28692 void __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint32_t this_obj) {
28693 LDKChannelReady this_obj_conv;
28694 this_obj_conv.inner = (void*)(this_obj & (~1));
28695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28697 ChannelReady_free(this_obj_conv);
28700 int8_tArray __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint32_t this_ptr) {
28701 LDKChannelReady this_ptr_conv;
28702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28703 this_ptr_conv.is_owned = false;
28704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28705 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28706 memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
28710 void __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28711 LDKChannelReady this_ptr_conv;
28712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28713 this_ptr_conv.is_owned = false;
28714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28715 LDKThirtyTwoBytes val_ref;
28716 CHECK(val->arr_len == 32);
28717 memcpy(val_ref.data, val->elems, 32); FREE(val);
28718 ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
28721 int8_tArray __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint32_t this_ptr) {
28722 LDKChannelReady this_ptr_conv;
28723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28724 this_ptr_conv.is_owned = false;
28725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28726 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28727 memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28731 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) {
28732 LDKChannelReady this_ptr_conv;
28733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28734 this_ptr_conv.is_owned = false;
28735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28736 LDKPublicKey val_ref;
28737 CHECK(val->arr_len == 33);
28738 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28739 ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28742 uint32_t __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint32_t this_ptr) {
28743 LDKChannelReady this_ptr_conv;
28744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28745 this_ptr_conv.is_owned = false;
28746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28747 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28748 *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
28749 uint32_t ret_ref = (uintptr_t)ret_copy;
28753 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) {
28754 LDKChannelReady this_ptr_conv;
28755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28756 this_ptr_conv.is_owned = false;
28757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28758 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28759 CHECK_ACCESS(val_ptr);
28760 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28761 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28762 ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
28765 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) {
28766 LDKThirtyTwoBytes channel_id_arg_ref;
28767 CHECK(channel_id_arg->arr_len == 32);
28768 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28769 LDKPublicKey next_per_commitment_point_arg_ref;
28770 CHECK(next_per_commitment_point_arg->arr_len == 33);
28771 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28772 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
28773 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
28774 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
28775 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
28776 LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
28777 uint32_t ret_ref = 0;
28778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28781 ret_ref = (uintptr_t)ret_var.inner;
28782 if (ret_var.is_owned) {
28788 static inline uintptr_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
28789 LDKChannelReady ret_var = ChannelReady_clone(arg);
28790 uint32_t ret_ref = 0;
28791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28794 ret_ref = (uintptr_t)ret_var.inner;
28795 if (ret_var.is_owned) {
28800 uint32_t __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint32_t arg) {
28801 LDKChannelReady arg_conv;
28802 arg_conv.inner = (void*)(arg & (~1));
28803 arg_conv.is_owned = false;
28804 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28805 uint32_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
28809 uint32_t __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint32_t orig) {
28810 LDKChannelReady orig_conv;
28811 orig_conv.inner = (void*)(orig & (~1));
28812 orig_conv.is_owned = false;
28813 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28814 LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
28815 uint32_t ret_ref = 0;
28816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28819 ret_ref = (uintptr_t)ret_var.inner;
28820 if (ret_var.is_owned) {
28826 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
28827 LDKShutdown this_obj_conv;
28828 this_obj_conv.inner = (void*)(this_obj & (~1));
28829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28831 Shutdown_free(this_obj_conv);
28834 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
28835 LDKShutdown this_ptr_conv;
28836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28837 this_ptr_conv.is_owned = false;
28838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28840 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
28844 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28845 LDKShutdown this_ptr_conv;
28846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28847 this_ptr_conv.is_owned = false;
28848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28849 LDKThirtyTwoBytes val_ref;
28850 CHECK(val->arr_len == 32);
28851 memcpy(val_ref.data, val->elems, 32); FREE(val);
28852 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
28855 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
28856 LDKShutdown this_ptr_conv;
28857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28858 this_ptr_conv.is_owned = false;
28859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28860 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
28861 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28862 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28866 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
28867 LDKShutdown this_ptr_conv;
28868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28869 this_ptr_conv.is_owned = false;
28870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28871 LDKCVec_u8Z val_ref;
28872 val_ref.datalen = val->arr_len;
28873 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
28874 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
28875 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
28878 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
28879 LDKThirtyTwoBytes channel_id_arg_ref;
28880 CHECK(channel_id_arg->arr_len == 32);
28881 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28882 LDKCVec_u8Z scriptpubkey_arg_ref;
28883 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
28884 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
28885 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
28886 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
28887 uint32_t ret_ref = 0;
28888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28891 ret_ref = (uintptr_t)ret_var.inner;
28892 if (ret_var.is_owned) {
28898 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
28899 LDKShutdown ret_var = Shutdown_clone(arg);
28900 uint32_t ret_ref = 0;
28901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28904 ret_ref = (uintptr_t)ret_var.inner;
28905 if (ret_var.is_owned) {
28910 uint32_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
28911 LDKShutdown arg_conv;
28912 arg_conv.inner = (void*)(arg & (~1));
28913 arg_conv.is_owned = false;
28914 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28915 uint32_t ret_conv = Shutdown_clone_ptr(&arg_conv);
28919 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
28920 LDKShutdown orig_conv;
28921 orig_conv.inner = (void*)(orig & (~1));
28922 orig_conv.is_owned = false;
28923 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28924 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
28925 uint32_t ret_ref = 0;
28926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28929 ret_ref = (uintptr_t)ret_var.inner;
28930 if (ret_var.is_owned) {
28936 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
28937 LDKClosingSignedFeeRange this_obj_conv;
28938 this_obj_conv.inner = (void*)(this_obj & (~1));
28939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28941 ClosingSignedFeeRange_free(this_obj_conv);
28944 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
28945 LDKClosingSignedFeeRange this_ptr_conv;
28946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28947 this_ptr_conv.is_owned = false;
28948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28949 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
28953 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
28954 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
28961 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
28962 LDKClosingSignedFeeRange this_ptr_conv;
28963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28964 this_ptr_conv.is_owned = false;
28965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28966 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
28970 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
28971 LDKClosingSignedFeeRange 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 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
28978 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
28979 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
28980 uint32_t ret_ref = 0;
28981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28984 ret_ref = (uintptr_t)ret_var.inner;
28985 if (ret_var.is_owned) {
28991 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
28992 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
28993 uint32_t ret_ref = 0;
28994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28997 ret_ref = (uintptr_t)ret_var.inner;
28998 if (ret_var.is_owned) {
29003 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
29004 LDKClosingSignedFeeRange arg_conv;
29005 arg_conv.inner = (void*)(arg & (~1));
29006 arg_conv.is_owned = false;
29007 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29008 uint32_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
29012 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
29013 LDKClosingSignedFeeRange orig_conv;
29014 orig_conv.inner = (void*)(orig & (~1));
29015 orig_conv.is_owned = false;
29016 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29017 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
29018 uint32_t ret_ref = 0;
29019 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29020 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29021 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29022 ret_ref = (uintptr_t)ret_var.inner;
29023 if (ret_var.is_owned) {
29029 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
29030 LDKClosingSigned this_obj_conv;
29031 this_obj_conv.inner = (void*)(this_obj & (~1));
29032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29034 ClosingSigned_free(this_obj_conv);
29037 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
29038 LDKClosingSigned this_ptr_conv;
29039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29040 this_ptr_conv.is_owned = false;
29041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29042 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29043 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
29047 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29048 LDKClosingSigned this_ptr_conv;
29049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29050 this_ptr_conv.is_owned = false;
29051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29052 LDKThirtyTwoBytes val_ref;
29053 CHECK(val->arr_len == 32);
29054 memcpy(val_ref.data, val->elems, 32); FREE(val);
29055 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
29058 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
29059 LDKClosingSigned this_ptr_conv;
29060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29061 this_ptr_conv.is_owned = false;
29062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29063 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
29067 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
29068 LDKClosingSigned this_ptr_conv;
29069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29070 this_ptr_conv.is_owned = false;
29071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29072 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
29075 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
29076 LDKClosingSigned this_ptr_conv;
29077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29078 this_ptr_conv.is_owned = false;
29079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29080 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29081 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
29085 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29086 LDKClosingSigned this_ptr_conv;
29087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29088 this_ptr_conv.is_owned = false;
29089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29090 LDKSignature val_ref;
29091 CHECK(val->arr_len == 64);
29092 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29093 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
29096 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
29097 LDKClosingSigned this_ptr_conv;
29098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29099 this_ptr_conv.is_owned = false;
29100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29101 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
29102 uint32_t ret_ref = 0;
29103 if ((uintptr_t)ret_var.inner > 4096) {
29104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29107 ret_ref = (uintptr_t)ret_var.inner;
29108 if (ret_var.is_owned) {
29115 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
29116 LDKClosingSigned this_ptr_conv;
29117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29118 this_ptr_conv.is_owned = false;
29119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29120 LDKClosingSignedFeeRange val_conv;
29121 val_conv.inner = (void*)(val & (~1));
29122 val_conv.is_owned = (val & 1) || (val == 0);
29123 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29124 val_conv = ClosingSignedFeeRange_clone(&val_conv);
29125 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
29128 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) {
29129 LDKThirtyTwoBytes channel_id_arg_ref;
29130 CHECK(channel_id_arg->arr_len == 32);
29131 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29132 LDKSignature signature_arg_ref;
29133 CHECK(signature_arg->arr_len == 64);
29134 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29135 LDKClosingSignedFeeRange fee_range_arg_conv;
29136 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
29137 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
29138 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
29139 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
29140 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
29141 uint32_t ret_ref = 0;
29142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29145 ret_ref = (uintptr_t)ret_var.inner;
29146 if (ret_var.is_owned) {
29152 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
29153 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
29154 uint32_t ret_ref = 0;
29155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29158 ret_ref = (uintptr_t)ret_var.inner;
29159 if (ret_var.is_owned) {
29164 uint32_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
29165 LDKClosingSigned arg_conv;
29166 arg_conv.inner = (void*)(arg & (~1));
29167 arg_conv.is_owned = false;
29168 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29169 uint32_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
29173 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
29174 LDKClosingSigned orig_conv;
29175 orig_conv.inner = (void*)(orig & (~1));
29176 orig_conv.is_owned = false;
29177 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29178 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
29179 uint32_t ret_ref = 0;
29180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29183 ret_ref = (uintptr_t)ret_var.inner;
29184 if (ret_var.is_owned) {
29190 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
29191 LDKUpdateAddHTLC this_obj_conv;
29192 this_obj_conv.inner = (void*)(this_obj & (~1));
29193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29195 UpdateAddHTLC_free(this_obj_conv);
29198 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
29199 LDKUpdateAddHTLC this_ptr_conv;
29200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29201 this_ptr_conv.is_owned = false;
29202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29203 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29204 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
29208 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29209 LDKUpdateAddHTLC this_ptr_conv;
29210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29211 this_ptr_conv.is_owned = false;
29212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29213 LDKThirtyTwoBytes val_ref;
29214 CHECK(val->arr_len == 32);
29215 memcpy(val_ref.data, val->elems, 32); FREE(val);
29216 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
29219 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
29220 LDKUpdateAddHTLC this_ptr_conv;
29221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29222 this_ptr_conv.is_owned = false;
29223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29224 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
29228 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29229 LDKUpdateAddHTLC this_ptr_conv;
29230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29231 this_ptr_conv.is_owned = false;
29232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29233 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
29236 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
29237 LDKUpdateAddHTLC this_ptr_conv;
29238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29239 this_ptr_conv.is_owned = false;
29240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29241 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
29245 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
29246 LDKUpdateAddHTLC this_ptr_conv;
29247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29248 this_ptr_conv.is_owned = false;
29249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29250 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
29253 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
29254 LDKUpdateAddHTLC 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29259 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
29263 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29264 LDKUpdateAddHTLC this_ptr_conv;
29265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29266 this_ptr_conv.is_owned = false;
29267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29268 LDKThirtyTwoBytes val_ref;
29269 CHECK(val->arr_len == 32);
29270 memcpy(val_ref.data, val->elems, 32); FREE(val);
29271 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
29274 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
29275 LDKUpdateAddHTLC this_ptr_conv;
29276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29277 this_ptr_conv.is_owned = false;
29278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29279 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
29283 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29284 LDKUpdateAddHTLC this_ptr_conv;
29285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29286 this_ptr_conv.is_owned = false;
29287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29288 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
29291 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
29292 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
29293 uint32_t ret_ref = 0;
29294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29297 ret_ref = (uintptr_t)ret_var.inner;
29298 if (ret_var.is_owned) {
29303 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
29304 LDKUpdateAddHTLC arg_conv;
29305 arg_conv.inner = (void*)(arg & (~1));
29306 arg_conv.is_owned = false;
29307 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29308 uint32_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
29312 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
29313 LDKUpdateAddHTLC orig_conv;
29314 orig_conv.inner = (void*)(orig & (~1));
29315 orig_conv.is_owned = false;
29316 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29317 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
29318 uint32_t ret_ref = 0;
29319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29322 ret_ref = (uintptr_t)ret_var.inner;
29323 if (ret_var.is_owned) {
29329 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
29330 LDKUpdateFulfillHTLC this_obj_conv;
29331 this_obj_conv.inner = (void*)(this_obj & (~1));
29332 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29334 UpdateFulfillHTLC_free(this_obj_conv);
29337 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
29338 LDKUpdateFulfillHTLC this_ptr_conv;
29339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29340 this_ptr_conv.is_owned = false;
29341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29342 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29343 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
29347 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29348 LDKUpdateFulfillHTLC this_ptr_conv;
29349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29350 this_ptr_conv.is_owned = false;
29351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29352 LDKThirtyTwoBytes val_ref;
29353 CHECK(val->arr_len == 32);
29354 memcpy(val_ref.data, val->elems, 32); FREE(val);
29355 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
29358 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
29359 LDKUpdateFulfillHTLC this_ptr_conv;
29360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29361 this_ptr_conv.is_owned = false;
29362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29363 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
29367 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29368 LDKUpdateFulfillHTLC this_ptr_conv;
29369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29370 this_ptr_conv.is_owned = false;
29371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29372 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
29375 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
29376 LDKUpdateFulfillHTLC this_ptr_conv;
29377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29378 this_ptr_conv.is_owned = false;
29379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29380 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29381 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
29385 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
29386 LDKUpdateFulfillHTLC this_ptr_conv;
29387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29388 this_ptr_conv.is_owned = false;
29389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29390 LDKThirtyTwoBytes val_ref;
29391 CHECK(val->arr_len == 32);
29392 memcpy(val_ref.data, val->elems, 32); FREE(val);
29393 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
29396 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) {
29397 LDKThirtyTwoBytes channel_id_arg_ref;
29398 CHECK(channel_id_arg->arr_len == 32);
29399 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29400 LDKThirtyTwoBytes payment_preimage_arg_ref;
29401 CHECK(payment_preimage_arg->arr_len == 32);
29402 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
29403 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
29404 uint32_t ret_ref = 0;
29405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29408 ret_ref = (uintptr_t)ret_var.inner;
29409 if (ret_var.is_owned) {
29415 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
29416 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
29417 uint32_t ret_ref = 0;
29418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29421 ret_ref = (uintptr_t)ret_var.inner;
29422 if (ret_var.is_owned) {
29427 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
29428 LDKUpdateFulfillHTLC arg_conv;
29429 arg_conv.inner = (void*)(arg & (~1));
29430 arg_conv.is_owned = false;
29431 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29432 uint32_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
29436 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
29437 LDKUpdateFulfillHTLC orig_conv;
29438 orig_conv.inner = (void*)(orig & (~1));
29439 orig_conv.is_owned = false;
29440 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29441 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
29442 uint32_t ret_ref = 0;
29443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29446 ret_ref = (uintptr_t)ret_var.inner;
29447 if (ret_var.is_owned) {
29453 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
29454 LDKUpdateFailHTLC this_obj_conv;
29455 this_obj_conv.inner = (void*)(this_obj & (~1));
29456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29458 UpdateFailHTLC_free(this_obj_conv);
29461 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
29462 LDKUpdateFailHTLC 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29467 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
29471 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29472 LDKUpdateFailHTLC this_ptr_conv;
29473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29474 this_ptr_conv.is_owned = false;
29475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29476 LDKThirtyTwoBytes val_ref;
29477 CHECK(val->arr_len == 32);
29478 memcpy(val_ref.data, val->elems, 32); FREE(val);
29479 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29482 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
29483 LDKUpdateFailHTLC this_ptr_conv;
29484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29485 this_ptr_conv.is_owned = false;
29486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29487 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29491 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29492 LDKUpdateFailHTLC this_ptr_conv;
29493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29494 this_ptr_conv.is_owned = false;
29495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29496 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29499 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29500 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29501 uint32_t ret_ref = 0;
29502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29505 ret_ref = (uintptr_t)ret_var.inner;
29506 if (ret_var.is_owned) {
29511 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
29512 LDKUpdateFailHTLC arg_conv;
29513 arg_conv.inner = (void*)(arg & (~1));
29514 arg_conv.is_owned = false;
29515 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29516 uint32_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
29520 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
29521 LDKUpdateFailHTLC orig_conv;
29522 orig_conv.inner = (void*)(orig & (~1));
29523 orig_conv.is_owned = false;
29524 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29525 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29526 uint32_t ret_ref = 0;
29527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29530 ret_ref = (uintptr_t)ret_var.inner;
29531 if (ret_var.is_owned) {
29537 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
29538 LDKUpdateFailMalformedHTLC this_obj_conv;
29539 this_obj_conv.inner = (void*)(this_obj & (~1));
29540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29542 UpdateFailMalformedHTLC_free(this_obj_conv);
29545 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
29546 LDKUpdateFailMalformedHTLC this_ptr_conv;
29547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29548 this_ptr_conv.is_owned = false;
29549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29550 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29551 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
29555 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29556 LDKUpdateFailMalformedHTLC this_ptr_conv;
29557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29558 this_ptr_conv.is_owned = false;
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29560 LDKThirtyTwoBytes val_ref;
29561 CHECK(val->arr_len == 32);
29562 memcpy(val_ref.data, val->elems, 32); FREE(val);
29563 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29566 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
29567 LDKUpdateFailMalformedHTLC this_ptr_conv;
29568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29569 this_ptr_conv.is_owned = false;
29570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29571 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29575 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
29576 LDKUpdateFailMalformedHTLC this_ptr_conv;
29577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29578 this_ptr_conv.is_owned = false;
29579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29580 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29583 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
29584 LDKUpdateFailMalformedHTLC 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 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29592 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
29593 LDKUpdateFailMalformedHTLC this_ptr_conv;
29594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29595 this_ptr_conv.is_owned = false;
29596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29597 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29600 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29601 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29602 uint32_t ret_ref = 0;
29603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29606 ret_ref = (uintptr_t)ret_var.inner;
29607 if (ret_var.is_owned) {
29612 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
29613 LDKUpdateFailMalformedHTLC arg_conv;
29614 arg_conv.inner = (void*)(arg & (~1));
29615 arg_conv.is_owned = false;
29616 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29617 uint32_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29621 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
29622 LDKUpdateFailMalformedHTLC orig_conv;
29623 orig_conv.inner = (void*)(orig & (~1));
29624 orig_conv.is_owned = false;
29625 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29626 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
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 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
29639 LDKCommitmentSigned this_obj_conv;
29640 this_obj_conv.inner = (void*)(this_obj & (~1));
29641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29643 CommitmentSigned_free(this_obj_conv);
29646 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
29647 LDKCommitmentSigned this_ptr_conv;
29648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29649 this_ptr_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29651 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29652 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
29656 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29657 LDKCommitmentSigned this_ptr_conv;
29658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29659 this_ptr_conv.is_owned = false;
29660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29661 LDKThirtyTwoBytes val_ref;
29662 CHECK(val->arr_len == 32);
29663 memcpy(val_ref.data, val->elems, 32); FREE(val);
29664 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29667 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
29668 LDKCommitmentSigned this_ptr_conv;
29669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29670 this_ptr_conv.is_owned = false;
29671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29672 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29673 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
29677 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
29678 LDKCommitmentSigned this_ptr_conv;
29679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29680 this_ptr_conv.is_owned = false;
29681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29682 LDKSignature val_ref;
29683 CHECK(val->arr_len == 64);
29684 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29685 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29688 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
29689 LDKCommitmentSigned this_ptr_conv;
29690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29691 this_ptr_conv.is_owned = false;
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29693 LDKCVec_SignatureZ val_constr;
29694 val_constr.datalen = val->arr_len;
29695 if (val_constr.datalen > 0)
29696 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29698 val_constr.data = NULL;
29699 int8_tArray* val_vals = (void*) val->elems;
29700 for (size_t m = 0; m < val_constr.datalen; m++) {
29701 int8_tArray val_conv_12 = val_vals[m];
29702 LDKSignature val_conv_12_ref;
29703 CHECK(val_conv_12->arr_len == 64);
29704 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
29705 val_constr.data[m] = val_conv_12_ref;
29708 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29711 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
29712 LDKThirtyTwoBytes channel_id_arg_ref;
29713 CHECK(channel_id_arg->arr_len == 32);
29714 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29715 LDKSignature signature_arg_ref;
29716 CHECK(signature_arg->arr_len == 64);
29717 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29718 LDKCVec_SignatureZ htlc_signatures_arg_constr;
29719 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
29720 if (htlc_signatures_arg_constr.datalen > 0)
29721 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29723 htlc_signatures_arg_constr.data = NULL;
29724 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
29725 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
29726 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
29727 LDKSignature htlc_signatures_arg_conv_12_ref;
29728 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
29729 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
29730 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
29732 FREE(htlc_signatures_arg);
29733 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
29734 uint32_t ret_ref = 0;
29735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29738 ret_ref = (uintptr_t)ret_var.inner;
29739 if (ret_var.is_owned) {
29745 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
29746 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
29747 uint32_t ret_ref = 0;
29748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29751 ret_ref = (uintptr_t)ret_var.inner;
29752 if (ret_var.is_owned) {
29757 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
29758 LDKCommitmentSigned arg_conv;
29759 arg_conv.inner = (void*)(arg & (~1));
29760 arg_conv.is_owned = false;
29761 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29762 uint32_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
29766 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
29767 LDKCommitmentSigned orig_conv;
29768 orig_conv.inner = (void*)(orig & (~1));
29769 orig_conv.is_owned = false;
29770 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29771 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
29772 uint32_t ret_ref = 0;
29773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29776 ret_ref = (uintptr_t)ret_var.inner;
29777 if (ret_var.is_owned) {
29783 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
29784 LDKRevokeAndACK this_obj_conv;
29785 this_obj_conv.inner = (void*)(this_obj & (~1));
29786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29788 RevokeAndACK_free(this_obj_conv);
29791 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
29792 LDKRevokeAndACK this_ptr_conv;
29793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29794 this_ptr_conv.is_owned = false;
29795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29796 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29797 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
29801 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29802 LDKRevokeAndACK this_ptr_conv;
29803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29804 this_ptr_conv.is_owned = false;
29805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29806 LDKThirtyTwoBytes val_ref;
29807 CHECK(val->arr_len == 32);
29808 memcpy(val_ref.data, val->elems, 32); FREE(val);
29809 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
29812 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
29813 LDKRevokeAndACK this_ptr_conv;
29814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29815 this_ptr_conv.is_owned = false;
29816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29817 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29818 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
29822 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
29823 LDKRevokeAndACK this_ptr_conv;
29824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29825 this_ptr_conv.is_owned = false;
29826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29827 LDKThirtyTwoBytes val_ref;
29828 CHECK(val->arr_len == 32);
29829 memcpy(val_ref.data, val->elems, 32); FREE(val);
29830 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
29833 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
29834 LDKRevokeAndACK this_ptr_conv;
29835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29836 this_ptr_conv.is_owned = false;
29837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29838 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29839 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29843 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) {
29844 LDKRevokeAndACK this_ptr_conv;
29845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29846 this_ptr_conv.is_owned = false;
29847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29848 LDKPublicKey val_ref;
29849 CHECK(val->arr_len == 33);
29850 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29851 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29854 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) {
29855 LDKThirtyTwoBytes channel_id_arg_ref;
29856 CHECK(channel_id_arg->arr_len == 32);
29857 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29858 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
29859 CHECK(per_commitment_secret_arg->arr_len == 32);
29860 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
29861 LDKPublicKey next_per_commitment_point_arg_ref;
29862 CHECK(next_per_commitment_point_arg->arr_len == 33);
29863 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29864 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
29865 uint32_t ret_ref = 0;
29866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29869 ret_ref = (uintptr_t)ret_var.inner;
29870 if (ret_var.is_owned) {
29876 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
29877 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
29878 uint32_t ret_ref = 0;
29879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29882 ret_ref = (uintptr_t)ret_var.inner;
29883 if (ret_var.is_owned) {
29888 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
29889 LDKRevokeAndACK arg_conv;
29890 arg_conv.inner = (void*)(arg & (~1));
29891 arg_conv.is_owned = false;
29892 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29893 uint32_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
29897 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
29898 LDKRevokeAndACK orig_conv;
29899 orig_conv.inner = (void*)(orig & (~1));
29900 orig_conv.is_owned = false;
29901 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29902 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
29903 uint32_t ret_ref = 0;
29904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29907 ret_ref = (uintptr_t)ret_var.inner;
29908 if (ret_var.is_owned) {
29914 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
29915 LDKUpdateFee this_obj_conv;
29916 this_obj_conv.inner = (void*)(this_obj & (~1));
29917 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29919 UpdateFee_free(this_obj_conv);
29922 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
29923 LDKUpdateFee this_ptr_conv;
29924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29925 this_ptr_conv.is_owned = false;
29926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29927 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29928 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
29932 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
29933 LDKUpdateFee this_ptr_conv;
29934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29935 this_ptr_conv.is_owned = false;
29936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29937 LDKThirtyTwoBytes val_ref;
29938 CHECK(val->arr_len == 32);
29939 memcpy(val_ref.data, val->elems, 32); FREE(val);
29940 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
29943 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
29944 LDKUpdateFee this_ptr_conv;
29945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29946 this_ptr_conv.is_owned = false;
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29948 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
29952 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
29953 LDKUpdateFee this_ptr_conv;
29954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29955 this_ptr_conv.is_owned = false;
29956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29957 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
29960 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
29961 LDKThirtyTwoBytes channel_id_arg_ref;
29962 CHECK(channel_id_arg->arr_len == 32);
29963 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29964 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
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 UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
29977 LDKUpdateFee ret_var = UpdateFee_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_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
29989 LDKUpdateFee 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 = UpdateFee_clone_ptr(&arg_conv);
29997 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
29998 LDKUpdateFee 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 LDKUpdateFee ret_var = UpdateFee_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_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
30015 LDKDataLossProtect 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 DataLossProtect_free(this_obj_conv);
30022 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) {
30023 LDKDataLossProtect 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, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
30032 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) {
30033 LDKDataLossProtect 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 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
30043 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) {
30044 LDKDataLossProtect 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30049 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30053 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) {
30054 LDKDataLossProtect this_ptr_conv;
30055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30056 this_ptr_conv.is_owned = false;
30057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30058 LDKPublicKey val_ref;
30059 CHECK(val->arr_len == 33);
30060 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30061 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
30064 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) {
30065 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
30066 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
30067 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
30068 LDKPublicKey my_current_per_commitment_point_arg_ref;
30069 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
30070 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);
30071 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
30072 uint32_t ret_ref = 0;
30073 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30074 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30076 ret_ref = (uintptr_t)ret_var.inner;
30077 if (ret_var.is_owned) {
30083 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
30084 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
30085 uint32_t ret_ref = 0;
30086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30089 ret_ref = (uintptr_t)ret_var.inner;
30090 if (ret_var.is_owned) {
30095 uint32_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
30096 LDKDataLossProtect arg_conv;
30097 arg_conv.inner = (void*)(arg & (~1));
30098 arg_conv.is_owned = false;
30099 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30100 uint32_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
30104 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
30105 LDKDataLossProtect orig_conv;
30106 orig_conv.inner = (void*)(orig & (~1));
30107 orig_conv.is_owned = false;
30108 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30109 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
30110 uint32_t ret_ref = 0;
30111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30114 ret_ref = (uintptr_t)ret_var.inner;
30115 if (ret_var.is_owned) {
30121 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
30122 LDKChannelReestablish this_obj_conv;
30123 this_obj_conv.inner = (void*)(this_obj & (~1));
30124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30126 ChannelReestablish_free(this_obj_conv);
30129 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
30130 LDKChannelReestablish this_ptr_conv;
30131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30132 this_ptr_conv.is_owned = false;
30133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30134 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30135 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
30139 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30140 LDKChannelReestablish this_ptr_conv;
30141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30142 this_ptr_conv.is_owned = false;
30143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30144 LDKThirtyTwoBytes val_ref;
30145 CHECK(val->arr_len == 32);
30146 memcpy(val_ref.data, val->elems, 32); FREE(val);
30147 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
30150 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
30151 LDKChannelReestablish this_ptr_conv;
30152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30153 this_ptr_conv.is_owned = false;
30154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30155 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
30159 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) {
30160 LDKChannelReestablish this_ptr_conv;
30161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30162 this_ptr_conv.is_owned = false;
30163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30164 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
30167 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
30168 LDKChannelReestablish this_ptr_conv;
30169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30170 this_ptr_conv.is_owned = false;
30171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30172 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
30176 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) {
30177 LDKChannelReestablish this_ptr_conv;
30178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30179 this_ptr_conv.is_owned = false;
30180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30181 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
30184 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
30185 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
30186 uint32_t ret_ref = 0;
30187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30190 ret_ref = (uintptr_t)ret_var.inner;
30191 if (ret_var.is_owned) {
30196 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
30197 LDKChannelReestablish arg_conv;
30198 arg_conv.inner = (void*)(arg & (~1));
30199 arg_conv.is_owned = false;
30200 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30201 uint32_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
30205 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
30206 LDKChannelReestablish orig_conv;
30207 orig_conv.inner = (void*)(orig & (~1));
30208 orig_conv.is_owned = false;
30209 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30210 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
30211 uint32_t ret_ref = 0;
30212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30215 ret_ref = (uintptr_t)ret_var.inner;
30216 if (ret_var.is_owned) {
30222 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
30223 LDKAnnouncementSignatures this_obj_conv;
30224 this_obj_conv.inner = (void*)(this_obj & (~1));
30225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30227 AnnouncementSignatures_free(this_obj_conv);
30230 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
30231 LDKAnnouncementSignatures this_ptr_conv;
30232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30233 this_ptr_conv.is_owned = false;
30234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30235 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30236 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
30240 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
30241 LDKAnnouncementSignatures this_ptr_conv;
30242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30243 this_ptr_conv.is_owned = false;
30244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30245 LDKThirtyTwoBytes val_ref;
30246 CHECK(val->arr_len == 32);
30247 memcpy(val_ref.data, val->elems, 32); FREE(val);
30248 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
30251 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
30252 LDKAnnouncementSignatures this_ptr_conv;
30253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30254 this_ptr_conv.is_owned = false;
30255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30256 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
30260 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30261 LDKAnnouncementSignatures this_ptr_conv;
30262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30263 this_ptr_conv.is_owned = false;
30264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30265 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
30268 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
30269 LDKAnnouncementSignatures this_ptr_conv;
30270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30271 this_ptr_conv.is_owned = false;
30272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30273 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30274 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
30278 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
30279 LDKAnnouncementSignatures this_ptr_conv;
30280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30281 this_ptr_conv.is_owned = false;
30282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30283 LDKSignature val_ref;
30284 CHECK(val->arr_len == 64);
30285 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30286 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
30289 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
30290 LDKAnnouncementSignatures this_ptr_conv;
30291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30292 this_ptr_conv.is_owned = false;
30293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30294 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30295 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
30299 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
30300 LDKAnnouncementSignatures this_ptr_conv;
30301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30302 this_ptr_conv.is_owned = false;
30303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30304 LDKSignature val_ref;
30305 CHECK(val->arr_len == 64);
30306 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30307 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
30310 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) {
30311 LDKThirtyTwoBytes channel_id_arg_ref;
30312 CHECK(channel_id_arg->arr_len == 32);
30313 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30314 LDKSignature node_signature_arg_ref;
30315 CHECK(node_signature_arg->arr_len == 64);
30316 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
30317 LDKSignature bitcoin_signature_arg_ref;
30318 CHECK(bitcoin_signature_arg->arr_len == 64);
30319 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
30320 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
30321 uint32_t ret_ref = 0;
30322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30325 ret_ref = (uintptr_t)ret_var.inner;
30326 if (ret_var.is_owned) {
30332 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
30333 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
30334 uint32_t ret_ref = 0;
30335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30338 ret_ref = (uintptr_t)ret_var.inner;
30339 if (ret_var.is_owned) {
30344 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
30345 LDKAnnouncementSignatures arg_conv;
30346 arg_conv.inner = (void*)(arg & (~1));
30347 arg_conv.is_owned = false;
30348 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30349 uint32_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
30353 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
30354 LDKAnnouncementSignatures orig_conv;
30355 orig_conv.inner = (void*)(orig & (~1));
30356 orig_conv.is_owned = false;
30357 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30358 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
30359 uint32_t ret_ref = 0;
30360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30363 ret_ref = (uintptr_t)ret_var.inner;
30364 if (ret_var.is_owned) {
30370 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
30371 if ((this_ptr & 1) != 0) return;
30372 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30373 CHECK_ACCESS(this_ptr_ptr);
30374 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
30375 FREE((void*)this_ptr);
30376 NetAddress_free(this_ptr_conv);
30379 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
30380 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30381 *ret_copy = NetAddress_clone(arg);
30382 uint32_t ret_ref = (uintptr_t)ret_copy;
30385 uint32_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
30386 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
30387 uint32_t ret_conv = NetAddress_clone_ptr(arg_conv);
30391 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
30392 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
30393 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30394 *ret_copy = NetAddress_clone(orig_conv);
30395 uint32_t ret_ref = (uintptr_t)ret_copy;
30399 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
30400 LDKFourBytes addr_ref;
30401 CHECK(addr->arr_len == 4);
30402 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
30403 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30404 *ret_copy = NetAddress_ipv4(addr_ref, port);
30405 uint32_t ret_ref = (uintptr_t)ret_copy;
30409 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
30410 LDKSixteenBytes addr_ref;
30411 CHECK(addr->arr_len == 16);
30412 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
30413 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30414 *ret_copy = NetAddress_ipv6(addr_ref, port);
30415 uint32_t ret_ref = (uintptr_t)ret_copy;
30419 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
30420 LDKTwelveBytes a_ref;
30421 CHECK(a->arr_len == 12);
30422 memcpy(a_ref.data, a->elems, 12); FREE(a);
30423 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30424 *ret_copy = NetAddress_onion_v2(a_ref);
30425 uint32_t ret_ref = (uintptr_t)ret_copy;
30429 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) {
30430 LDKThirtyTwoBytes ed25519_pubkey_ref;
30431 CHECK(ed25519_pubkey->arr_len == 32);
30432 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
30433 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30434 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
30435 uint32_t ret_ref = (uintptr_t)ret_copy;
30439 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
30440 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
30441 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
30442 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30443 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30444 CVec_u8Z_free(ret_var);
30448 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
30449 LDKu8slice ser_ref;
30450 ser_ref.datalen = ser->arr_len;
30451 ser_ref.data = ser->elems;
30452 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
30453 *ret_conv = NetAddress_read(ser_ref);
30455 return (uint32_t)ret_conv;
30458 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
30459 LDKUnsignedNodeAnnouncement this_obj_conv;
30460 this_obj_conv.inner = (void*)(this_obj & (~1));
30461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30463 UnsignedNodeAnnouncement_free(this_obj_conv);
30466 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
30467 LDKUnsignedNodeAnnouncement this_ptr_conv;
30468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30469 this_ptr_conv.is_owned = false;
30470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30471 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30472 uint32_t ret_ref = 0;
30473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30476 ret_ref = (uintptr_t)ret_var.inner;
30477 if (ret_var.is_owned) {
30483 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30484 LDKUnsignedNodeAnnouncement this_ptr_conv;
30485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30486 this_ptr_conv.is_owned = false;
30487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30488 LDKNodeFeatures val_conv;
30489 val_conv.inner = (void*)(val & (~1));
30490 val_conv.is_owned = (val & 1) || (val == 0);
30491 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30492 val_conv = NodeFeatures_clone(&val_conv);
30493 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30496 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
30497 LDKUnsignedNodeAnnouncement this_ptr_conv;
30498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30499 this_ptr_conv.is_owned = false;
30500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30501 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30505 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
30506 LDKUnsignedNodeAnnouncement this_ptr_conv;
30507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30508 this_ptr_conv.is_owned = false;
30509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30510 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30513 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
30514 LDKUnsignedNodeAnnouncement this_ptr_conv;
30515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30516 this_ptr_conv.is_owned = false;
30517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30518 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30519 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
30523 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
30524 LDKUnsignedNodeAnnouncement this_ptr_conv;
30525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30526 this_ptr_conv.is_owned = false;
30527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30528 LDKPublicKey val_ref;
30529 CHECK(val->arr_len == 33);
30530 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30531 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30534 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
30535 LDKUnsignedNodeAnnouncement this_ptr_conv;
30536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30537 this_ptr_conv.is_owned = false;
30538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30539 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
30540 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
30544 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
30545 LDKUnsignedNodeAnnouncement this_ptr_conv;
30546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30547 this_ptr_conv.is_owned = false;
30548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30549 LDKThreeBytes val_ref;
30550 CHECK(val->arr_len == 3);
30551 memcpy(val_ref.data, val->elems, 3); FREE(val);
30552 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30555 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
30556 LDKUnsignedNodeAnnouncement this_ptr_conv;
30557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30558 this_ptr_conv.is_owned = false;
30559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30560 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30561 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
30565 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
30566 LDKUnsignedNodeAnnouncement this_ptr_conv;
30567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30568 this_ptr_conv.is_owned = false;
30569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30570 LDKThirtyTwoBytes val_ref;
30571 CHECK(val->arr_len == 32);
30572 memcpy(val_ref.data, val->elems, 32); FREE(val);
30573 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30576 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
30577 LDKUnsignedNodeAnnouncement this_ptr_conv;
30578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30579 this_ptr_conv.is_owned = false;
30580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30581 LDKCVec_NetAddressZ val_constr;
30582 val_constr.datalen = val->arr_len;
30583 if (val_constr.datalen > 0)
30584 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30586 val_constr.data = NULL;
30587 uint32_t* val_vals = val->elems;
30588 for (size_t m = 0; m < val_constr.datalen; m++) {
30589 uint32_t val_conv_12 = val_vals[m];
30590 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
30591 CHECK_ACCESS(val_conv_12_ptr);
30592 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30593 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
30594 val_constr.data[m] = val_conv_12_conv;
30597 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30600 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30601 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30602 uint32_t ret_ref = 0;
30603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30606 ret_ref = (uintptr_t)ret_var.inner;
30607 if (ret_var.is_owned) {
30612 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
30613 LDKUnsignedNodeAnnouncement arg_conv;
30614 arg_conv.inner = (void*)(arg & (~1));
30615 arg_conv.is_owned = false;
30616 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30617 uint32_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30621 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
30622 LDKUnsignedNodeAnnouncement orig_conv;
30623 orig_conv.inner = (void*)(orig & (~1));
30624 orig_conv.is_owned = false;
30625 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30626 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30627 uint32_t ret_ref = 0;
30628 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30629 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30630 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30631 ret_ref = (uintptr_t)ret_var.inner;
30632 if (ret_var.is_owned) {
30638 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
30639 LDKNodeAnnouncement this_obj_conv;
30640 this_obj_conv.inner = (void*)(this_obj & (~1));
30641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30643 NodeAnnouncement_free(this_obj_conv);
30646 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
30647 LDKNodeAnnouncement this_ptr_conv;
30648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30649 this_ptr_conv.is_owned = false;
30650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30651 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30652 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
30656 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
30657 LDKNodeAnnouncement this_ptr_conv;
30658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30659 this_ptr_conv.is_owned = false;
30660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30661 LDKSignature val_ref;
30662 CHECK(val->arr_len == 64);
30663 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30664 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30667 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
30668 LDKNodeAnnouncement this_ptr_conv;
30669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30670 this_ptr_conv.is_owned = false;
30671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30672 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30673 uint32_t ret_ref = 0;
30674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30677 ret_ref = (uintptr_t)ret_var.inner;
30678 if (ret_var.is_owned) {
30684 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
30685 LDKNodeAnnouncement this_ptr_conv;
30686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30687 this_ptr_conv.is_owned = false;
30688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30689 LDKUnsignedNodeAnnouncement val_conv;
30690 val_conv.inner = (void*)(val & (~1));
30691 val_conv.is_owned = (val & 1) || (val == 0);
30692 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30693 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30694 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30697 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
30698 LDKSignature signature_arg_ref;
30699 CHECK(signature_arg->arr_len == 64);
30700 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30701 LDKUnsignedNodeAnnouncement contents_arg_conv;
30702 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30703 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30704 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30705 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30706 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30707 uint32_t ret_ref = 0;
30708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30711 ret_ref = (uintptr_t)ret_var.inner;
30712 if (ret_var.is_owned) {
30718 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30719 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30720 uint32_t ret_ref = 0;
30721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30724 ret_ref = (uintptr_t)ret_var.inner;
30725 if (ret_var.is_owned) {
30730 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
30731 LDKNodeAnnouncement arg_conv;
30732 arg_conv.inner = (void*)(arg & (~1));
30733 arg_conv.is_owned = false;
30734 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30735 uint32_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
30739 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
30740 LDKNodeAnnouncement orig_conv;
30741 orig_conv.inner = (void*)(orig & (~1));
30742 orig_conv.is_owned = false;
30743 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30744 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
30745 uint32_t ret_ref = 0;
30746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30749 ret_ref = (uintptr_t)ret_var.inner;
30750 if (ret_var.is_owned) {
30756 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
30757 LDKUnsignedChannelAnnouncement this_obj_conv;
30758 this_obj_conv.inner = (void*)(this_obj & (~1));
30759 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30761 UnsignedChannelAnnouncement_free(this_obj_conv);
30764 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
30765 LDKUnsignedChannelAnnouncement this_ptr_conv;
30766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30767 this_ptr_conv.is_owned = false;
30768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30769 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
30770 uint32_t ret_ref = 0;
30771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30774 ret_ref = (uintptr_t)ret_var.inner;
30775 if (ret_var.is_owned) {
30781 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
30782 LDKUnsignedChannelAnnouncement this_ptr_conv;
30783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30784 this_ptr_conv.is_owned = false;
30785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30786 LDKChannelFeatures val_conv;
30787 val_conv.inner = (void*)(val & (~1));
30788 val_conv.is_owned = (val & 1) || (val == 0);
30789 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30790 val_conv = ChannelFeatures_clone(&val_conv);
30791 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
30794 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
30795 LDKUnsignedChannelAnnouncement this_ptr_conv;
30796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30797 this_ptr_conv.is_owned = false;
30798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30799 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30800 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
30804 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30805 LDKUnsignedChannelAnnouncement this_ptr_conv;
30806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30807 this_ptr_conv.is_owned = false;
30808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30809 LDKThirtyTwoBytes val_ref;
30810 CHECK(val->arr_len == 32);
30811 memcpy(val_ref.data, val->elems, 32); FREE(val);
30812 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
30815 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
30816 LDKUnsignedChannelAnnouncement this_ptr_conv;
30817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30818 this_ptr_conv.is_owned = false;
30819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30820 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
30824 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
30825 LDKUnsignedChannelAnnouncement this_ptr_conv;
30826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30827 this_ptr_conv.is_owned = false;
30828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30829 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
30832 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
30833 LDKUnsignedChannelAnnouncement this_ptr_conv;
30834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30835 this_ptr_conv.is_owned = false;
30836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30837 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30838 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
30842 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
30843 LDKUnsignedChannelAnnouncement this_ptr_conv;
30844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30845 this_ptr_conv.is_owned = false;
30846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30847 LDKPublicKey val_ref;
30848 CHECK(val->arr_len == 33);
30849 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30850 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
30853 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
30854 LDKUnsignedChannelAnnouncement 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(33, __LINE__);
30859 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
30863 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
30864 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
30869 CHECK(val->arr_len == 33);
30870 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30871 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
30874 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
30875 LDKUnsignedChannelAnnouncement 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(33, __LINE__);
30880 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
30884 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
30885 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
30890 CHECK(val->arr_len == 33);
30891 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30892 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
30895 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
30896 LDKUnsignedChannelAnnouncement 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(33, __LINE__);
30901 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
30905 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
30906 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
30911 CHECK(val->arr_len == 33);
30912 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30913 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
30916 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
30917 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
30918 uint32_t ret_ref = 0;
30919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30922 ret_ref = (uintptr_t)ret_var.inner;
30923 if (ret_var.is_owned) {
30928 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
30929 LDKUnsignedChannelAnnouncement arg_conv;
30930 arg_conv.inner = (void*)(arg & (~1));
30931 arg_conv.is_owned = false;
30932 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30933 uint32_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
30937 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
30938 LDKUnsignedChannelAnnouncement orig_conv;
30939 orig_conv.inner = (void*)(orig & (~1));
30940 orig_conv.is_owned = false;
30941 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30942 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_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_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
30955 LDKChannelAnnouncement this_obj_conv;
30956 this_obj_conv.inner = (void*)(this_obj & (~1));
30957 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30959 ChannelAnnouncement_free(this_obj_conv);
30962 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
30963 LDKChannelAnnouncement this_ptr_conv;
30964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30965 this_ptr_conv.is_owned = false;
30966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30967 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30968 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
30972 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
30973 LDKChannelAnnouncement this_ptr_conv;
30974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30975 this_ptr_conv.is_owned = false;
30976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30977 LDKSignature val_ref;
30978 CHECK(val->arr_len == 64);
30979 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30980 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
30983 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
30984 LDKChannelAnnouncement this_ptr_conv;
30985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30986 this_ptr_conv.is_owned = false;
30987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30988 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30989 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
30993 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
30994 LDKChannelAnnouncement this_ptr_conv;
30995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30996 this_ptr_conv.is_owned = false;
30997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30998 LDKSignature val_ref;
30999 CHECK(val->arr_len == 64);
31000 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31001 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
31004 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
31005 LDKChannelAnnouncement this_ptr_conv;
31006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31007 this_ptr_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31009 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31010 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
31014 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
31015 LDKChannelAnnouncement this_ptr_conv;
31016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31017 this_ptr_conv.is_owned = false;
31018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31019 LDKSignature val_ref;
31020 CHECK(val->arr_len == 64);
31021 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31022 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
31025 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
31026 LDKChannelAnnouncement this_ptr_conv;
31027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31028 this_ptr_conv.is_owned = false;
31029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31030 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31031 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
31035 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
31036 LDKChannelAnnouncement this_ptr_conv;
31037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31038 this_ptr_conv.is_owned = false;
31039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31040 LDKSignature val_ref;
31041 CHECK(val->arr_len == 64);
31042 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31043 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
31046 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
31047 LDKChannelAnnouncement this_ptr_conv;
31048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31049 this_ptr_conv.is_owned = false;
31050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31051 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
31052 uint32_t ret_ref = 0;
31053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31056 ret_ref = (uintptr_t)ret_var.inner;
31057 if (ret_var.is_owned) {
31063 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
31064 LDKChannelAnnouncement this_ptr_conv;
31065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31066 this_ptr_conv.is_owned = false;
31067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31068 LDKUnsignedChannelAnnouncement val_conv;
31069 val_conv.inner = (void*)(val & (~1));
31070 val_conv.is_owned = (val & 1) || (val == 0);
31071 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31072 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
31073 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
31076 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) {
31077 LDKSignature node_signature_1_arg_ref;
31078 CHECK(node_signature_1_arg->arr_len == 64);
31079 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
31080 LDKSignature node_signature_2_arg_ref;
31081 CHECK(node_signature_2_arg->arr_len == 64);
31082 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
31083 LDKSignature bitcoin_signature_1_arg_ref;
31084 CHECK(bitcoin_signature_1_arg->arr_len == 64);
31085 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
31086 LDKSignature bitcoin_signature_2_arg_ref;
31087 CHECK(bitcoin_signature_2_arg->arr_len == 64);
31088 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
31089 LDKUnsignedChannelAnnouncement contents_arg_conv;
31090 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31091 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31092 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31093 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
31094 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);
31095 uint32_t ret_ref = 0;
31096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31099 ret_ref = (uintptr_t)ret_var.inner;
31100 if (ret_var.is_owned) {
31106 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
31107 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
31108 uint32_t ret_ref = 0;
31109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31112 ret_ref = (uintptr_t)ret_var.inner;
31113 if (ret_var.is_owned) {
31118 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
31119 LDKChannelAnnouncement arg_conv;
31120 arg_conv.inner = (void*)(arg & (~1));
31121 arg_conv.is_owned = false;
31122 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31123 uint32_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
31127 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
31128 LDKChannelAnnouncement orig_conv;
31129 orig_conv.inner = (void*)(orig & (~1));
31130 orig_conv.is_owned = false;
31131 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31132 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
31133 uint32_t ret_ref = 0;
31134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31137 ret_ref = (uintptr_t)ret_var.inner;
31138 if (ret_var.is_owned) {
31144 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
31145 LDKUnsignedChannelUpdate this_obj_conv;
31146 this_obj_conv.inner = (void*)(this_obj & (~1));
31147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31149 UnsignedChannelUpdate_free(this_obj_conv);
31152 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
31153 LDKUnsignedChannelUpdate this_ptr_conv;
31154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31155 this_ptr_conv.is_owned = false;
31156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31157 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31158 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
31162 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31163 LDKUnsignedChannelUpdate this_ptr_conv;
31164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31165 this_ptr_conv.is_owned = false;
31166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31167 LDKThirtyTwoBytes val_ref;
31168 CHECK(val->arr_len == 32);
31169 memcpy(val_ref.data, val->elems, 32); FREE(val);
31170 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
31173 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
31174 LDKUnsignedChannelUpdate this_ptr_conv;
31175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31176 this_ptr_conv.is_owned = false;
31177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31178 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
31182 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
31183 LDKUnsignedChannelUpdate this_ptr_conv;
31184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31185 this_ptr_conv.is_owned = false;
31186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31187 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
31190 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
31191 LDKUnsignedChannelUpdate this_ptr_conv;
31192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31193 this_ptr_conv.is_owned = false;
31194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31195 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
31199 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
31200 LDKUnsignedChannelUpdate this_ptr_conv;
31201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31202 this_ptr_conv.is_owned = false;
31203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31204 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
31207 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
31208 LDKUnsignedChannelUpdate this_ptr_conv;
31209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31210 this_ptr_conv.is_owned = false;
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31212 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
31216 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
31217 LDKUnsignedChannelUpdate this_ptr_conv;
31218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31219 this_ptr_conv.is_owned = false;
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31221 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
31224 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
31225 LDKUnsignedChannelUpdate this_ptr_conv;
31226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31227 this_ptr_conv.is_owned = false;
31228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31229 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31233 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31234 LDKUnsignedChannelUpdate this_ptr_conv;
31235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31236 this_ptr_conv.is_owned = false;
31237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31238 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
31241 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
31242 LDKUnsignedChannelUpdate 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 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
31250 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31251 LDKUnsignedChannelUpdate this_ptr_conv;
31252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31253 this_ptr_conv.is_owned = false;
31254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31255 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
31258 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
31259 LDKUnsignedChannelUpdate this_ptr_conv;
31260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31261 this_ptr_conv.is_owned = false;
31262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31263 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
31267 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
31268 LDKUnsignedChannelUpdate this_ptr_conv;
31269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31270 this_ptr_conv.is_owned = false;
31271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
31275 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
31276 LDKUnsignedChannelUpdate this_ptr_conv;
31277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31278 this_ptr_conv.is_owned = false;
31279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31280 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
31284 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
31285 LDKUnsignedChannelUpdate this_ptr_conv;
31286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31287 this_ptr_conv.is_owned = false;
31288 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31289 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
31292 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint32_t this_ptr, int8_tArray val) {
31293 LDKUnsignedChannelUpdate this_ptr_conv;
31294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31295 this_ptr_conv.is_owned = false;
31296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31297 LDKCVec_u8Z val_ref;
31298 val_ref.datalen = val->arr_len;
31299 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31300 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31301 UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
31304 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
31305 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
31306 uint32_t ret_ref = 0;
31307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31310 ret_ref = (uintptr_t)ret_var.inner;
31311 if (ret_var.is_owned) {
31316 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
31317 LDKUnsignedChannelUpdate arg_conv;
31318 arg_conv.inner = (void*)(arg & (~1));
31319 arg_conv.is_owned = false;
31320 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31321 uint32_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
31325 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
31326 LDKUnsignedChannelUpdate orig_conv;
31327 orig_conv.inner = (void*)(orig & (~1));
31328 orig_conv.is_owned = false;
31329 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31330 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
31331 uint32_t ret_ref = 0;
31332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31335 ret_ref = (uintptr_t)ret_var.inner;
31336 if (ret_var.is_owned) {
31342 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
31343 LDKChannelUpdate this_obj_conv;
31344 this_obj_conv.inner = (void*)(this_obj & (~1));
31345 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31347 ChannelUpdate_free(this_obj_conv);
31350 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
31351 LDKChannelUpdate this_ptr_conv;
31352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31353 this_ptr_conv.is_owned = false;
31354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31355 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31356 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
31360 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
31361 LDKChannelUpdate this_ptr_conv;
31362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31363 this_ptr_conv.is_owned = false;
31364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31365 LDKSignature val_ref;
31366 CHECK(val->arr_len == 64);
31367 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31368 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
31371 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
31372 LDKChannelUpdate this_ptr_conv;
31373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31374 this_ptr_conv.is_owned = false;
31375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31376 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
31377 uint32_t ret_ref = 0;
31378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31381 ret_ref = (uintptr_t)ret_var.inner;
31382 if (ret_var.is_owned) {
31388 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
31389 LDKChannelUpdate this_ptr_conv;
31390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31391 this_ptr_conv.is_owned = false;
31392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31393 LDKUnsignedChannelUpdate val_conv;
31394 val_conv.inner = (void*)(val & (~1));
31395 val_conv.is_owned = (val & 1) || (val == 0);
31396 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31397 val_conv = UnsignedChannelUpdate_clone(&val_conv);
31398 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
31401 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
31402 LDKSignature signature_arg_ref;
31403 CHECK(signature_arg->arr_len == 64);
31404 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31405 LDKUnsignedChannelUpdate contents_arg_conv;
31406 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31407 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31408 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31409 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
31410 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
31411 uint32_t ret_ref = 0;
31412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31415 ret_ref = (uintptr_t)ret_var.inner;
31416 if (ret_var.is_owned) {
31422 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31423 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31424 uint32_t ret_ref = 0;
31425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31428 ret_ref = (uintptr_t)ret_var.inner;
31429 if (ret_var.is_owned) {
31434 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
31435 LDKChannelUpdate arg_conv;
31436 arg_conv.inner = (void*)(arg & (~1));
31437 arg_conv.is_owned = false;
31438 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31439 uint32_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
31443 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
31444 LDKChannelUpdate orig_conv;
31445 orig_conv.inner = (void*)(orig & (~1));
31446 orig_conv.is_owned = false;
31447 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31448 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31449 uint32_t ret_ref = 0;
31450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31453 ret_ref = (uintptr_t)ret_var.inner;
31454 if (ret_var.is_owned) {
31460 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
31461 LDKQueryChannelRange this_obj_conv;
31462 this_obj_conv.inner = (void*)(this_obj & (~1));
31463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31465 QueryChannelRange_free(this_obj_conv);
31468 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
31469 LDKQueryChannelRange this_ptr_conv;
31470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31471 this_ptr_conv.is_owned = false;
31472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31473 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31474 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
31478 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31479 LDKQueryChannelRange this_ptr_conv;
31480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31481 this_ptr_conv.is_owned = false;
31482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31483 LDKThirtyTwoBytes val_ref;
31484 CHECK(val->arr_len == 32);
31485 memcpy(val_ref.data, val->elems, 32); FREE(val);
31486 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31489 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
31490 LDKQueryChannelRange this_ptr_conv;
31491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31492 this_ptr_conv.is_owned = false;
31493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31494 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31498 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31499 LDKQueryChannelRange this_ptr_conv;
31500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31501 this_ptr_conv.is_owned = false;
31502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31503 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31506 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31507 LDKQueryChannelRange 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 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31515 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31516 LDKQueryChannelRange this_ptr_conv;
31517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31518 this_ptr_conv.is_owned = false;
31519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31520 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31523 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) {
31524 LDKThirtyTwoBytes chain_hash_arg_ref;
31525 CHECK(chain_hash_arg->arr_len == 32);
31526 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31527 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31528 uint32_t ret_ref = 0;
31529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31532 ret_ref = (uintptr_t)ret_var.inner;
31533 if (ret_var.is_owned) {
31539 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31540 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31541 uint32_t ret_ref = 0;
31542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31545 ret_ref = (uintptr_t)ret_var.inner;
31546 if (ret_var.is_owned) {
31551 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
31552 LDKQueryChannelRange arg_conv;
31553 arg_conv.inner = (void*)(arg & (~1));
31554 arg_conv.is_owned = false;
31555 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31556 uint32_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
31560 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
31561 LDKQueryChannelRange orig_conv;
31562 orig_conv.inner = (void*)(orig & (~1));
31563 orig_conv.is_owned = false;
31564 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31565 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31566 uint32_t ret_ref = 0;
31567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31570 ret_ref = (uintptr_t)ret_var.inner;
31571 if (ret_var.is_owned) {
31577 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
31578 LDKReplyChannelRange this_obj_conv;
31579 this_obj_conv.inner = (void*)(this_obj & (~1));
31580 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31582 ReplyChannelRange_free(this_obj_conv);
31585 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
31586 LDKReplyChannelRange this_ptr_conv;
31587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31588 this_ptr_conv.is_owned = false;
31589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31590 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31591 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
31595 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31596 LDKReplyChannelRange this_ptr_conv;
31597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31598 this_ptr_conv.is_owned = false;
31599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31600 LDKThirtyTwoBytes val_ref;
31601 CHECK(val->arr_len == 32);
31602 memcpy(val_ref.data, val->elems, 32); FREE(val);
31603 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31606 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
31607 LDKReplyChannelRange this_ptr_conv;
31608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31609 this_ptr_conv.is_owned = false;
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31611 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31615 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
31616 LDKReplyChannelRange this_ptr_conv;
31617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31618 this_ptr_conv.is_owned = false;
31619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31620 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31623 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
31624 LDKReplyChannelRange this_ptr_conv;
31625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31626 this_ptr_conv.is_owned = false;
31627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31628 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31632 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
31633 LDKReplyChannelRange this_ptr_conv;
31634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31635 this_ptr_conv.is_owned = false;
31636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31637 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31640 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
31641 LDKReplyChannelRange 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 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31649 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
31650 LDKReplyChannelRange this_ptr_conv;
31651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31652 this_ptr_conv.is_owned = false;
31653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31654 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31657 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31658 LDKReplyChannelRange this_ptr_conv;
31659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31660 this_ptr_conv.is_owned = false;
31661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31662 LDKCVec_u64Z val_constr;
31663 val_constr.datalen = val->arr_len;
31664 if (val_constr.datalen > 0)
31665 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31667 val_constr.data = NULL;
31668 int64_t* val_vals = val->elems;
31669 for (size_t i = 0; i < val_constr.datalen; i++) {
31670 int64_t val_conv_8 = val_vals[i];
31671 val_constr.data[i] = val_conv_8;
31674 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31677 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) {
31678 LDKThirtyTwoBytes chain_hash_arg_ref;
31679 CHECK(chain_hash_arg->arr_len == 32);
31680 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31681 LDKCVec_u64Z short_channel_ids_arg_constr;
31682 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31683 if (short_channel_ids_arg_constr.datalen > 0)
31684 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31686 short_channel_ids_arg_constr.data = NULL;
31687 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31688 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31689 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31690 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31692 FREE(short_channel_ids_arg);
31693 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31694 uint32_t ret_ref = 0;
31695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31698 ret_ref = (uintptr_t)ret_var.inner;
31699 if (ret_var.is_owned) {
31705 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31706 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31707 uint32_t ret_ref = 0;
31708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31711 ret_ref = (uintptr_t)ret_var.inner;
31712 if (ret_var.is_owned) {
31717 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
31718 LDKReplyChannelRange arg_conv;
31719 arg_conv.inner = (void*)(arg & (~1));
31720 arg_conv.is_owned = false;
31721 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31722 uint32_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
31726 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
31727 LDKReplyChannelRange orig_conv;
31728 orig_conv.inner = (void*)(orig & (~1));
31729 orig_conv.is_owned = false;
31730 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31731 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
31732 uint32_t ret_ref = 0;
31733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31736 ret_ref = (uintptr_t)ret_var.inner;
31737 if (ret_var.is_owned) {
31743 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
31744 LDKQueryShortChannelIds this_obj_conv;
31745 this_obj_conv.inner = (void*)(this_obj & (~1));
31746 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31748 QueryShortChannelIds_free(this_obj_conv);
31751 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
31752 LDKQueryShortChannelIds this_ptr_conv;
31753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31754 this_ptr_conv.is_owned = false;
31755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31756 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31757 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
31761 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31762 LDKQueryShortChannelIds this_ptr_conv;
31763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31764 this_ptr_conv.is_owned = false;
31765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31766 LDKThirtyTwoBytes val_ref;
31767 CHECK(val->arr_len == 32);
31768 memcpy(val_ref.data, val->elems, 32); FREE(val);
31769 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
31772 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
31773 LDKQueryShortChannelIds this_ptr_conv;
31774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31775 this_ptr_conv.is_owned = false;
31776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31777 LDKCVec_u64Z val_constr;
31778 val_constr.datalen = val->arr_len;
31779 if (val_constr.datalen > 0)
31780 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31782 val_constr.data = NULL;
31783 int64_t* val_vals = val->elems;
31784 for (size_t i = 0; i < val_constr.datalen; i++) {
31785 int64_t val_conv_8 = val_vals[i];
31786 val_constr.data[i] = val_conv_8;
31789 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
31792 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
31793 LDKThirtyTwoBytes chain_hash_arg_ref;
31794 CHECK(chain_hash_arg->arr_len == 32);
31795 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31796 LDKCVec_u64Z short_channel_ids_arg_constr;
31797 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31798 if (short_channel_ids_arg_constr.datalen > 0)
31799 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31801 short_channel_ids_arg_constr.data = NULL;
31802 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31803 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31804 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31805 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31807 FREE(short_channel_ids_arg);
31808 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
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) {
31820 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
31821 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
31822 uint32_t ret_ref = 0;
31823 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31824 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31826 ret_ref = (uintptr_t)ret_var.inner;
31827 if (ret_var.is_owned) {
31832 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
31833 LDKQueryShortChannelIds arg_conv;
31834 arg_conv.inner = (void*)(arg & (~1));
31835 arg_conv.is_owned = false;
31836 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31837 uint32_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
31841 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
31842 LDKQueryShortChannelIds orig_conv;
31843 orig_conv.inner = (void*)(orig & (~1));
31844 orig_conv.is_owned = false;
31845 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31846 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
31847 uint32_t ret_ref = 0;
31848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31851 ret_ref = (uintptr_t)ret_var.inner;
31852 if (ret_var.is_owned) {
31858 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
31859 LDKReplyShortChannelIdsEnd this_obj_conv;
31860 this_obj_conv.inner = (void*)(this_obj & (~1));
31861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31863 ReplyShortChannelIdsEnd_free(this_obj_conv);
31866 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
31867 LDKReplyShortChannelIdsEnd this_ptr_conv;
31868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31869 this_ptr_conv.is_owned = false;
31870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31871 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31872 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
31876 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31877 LDKReplyShortChannelIdsEnd this_ptr_conv;
31878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31879 this_ptr_conv.is_owned = false;
31880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31881 LDKThirtyTwoBytes val_ref;
31882 CHECK(val->arr_len == 32);
31883 memcpy(val_ref.data, val->elems, 32); FREE(val);
31884 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
31887 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
31888 LDKReplyShortChannelIdsEnd this_ptr_conv;
31889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31890 this_ptr_conv.is_owned = false;
31891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31892 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
31896 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
31897 LDKReplyShortChannelIdsEnd this_ptr_conv;
31898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31899 this_ptr_conv.is_owned = false;
31900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31901 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
31904 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
31905 LDKThirtyTwoBytes chain_hash_arg_ref;
31906 CHECK(chain_hash_arg->arr_len == 32);
31907 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31908 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
31909 uint32_t ret_ref = 0;
31910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31913 ret_ref = (uintptr_t)ret_var.inner;
31914 if (ret_var.is_owned) {
31920 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
31921 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
31922 uint32_t ret_ref = 0;
31923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31926 ret_ref = (uintptr_t)ret_var.inner;
31927 if (ret_var.is_owned) {
31932 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
31933 LDKReplyShortChannelIdsEnd arg_conv;
31934 arg_conv.inner = (void*)(arg & (~1));
31935 arg_conv.is_owned = false;
31936 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31937 uint32_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
31941 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
31942 LDKReplyShortChannelIdsEnd orig_conv;
31943 orig_conv.inner = (void*)(orig & (~1));
31944 orig_conv.is_owned = false;
31945 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31946 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
31947 uint32_t ret_ref = 0;
31948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31951 ret_ref = (uintptr_t)ret_var.inner;
31952 if (ret_var.is_owned) {
31958 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
31959 LDKGossipTimestampFilter this_obj_conv;
31960 this_obj_conv.inner = (void*)(this_obj & (~1));
31961 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31963 GossipTimestampFilter_free(this_obj_conv);
31966 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
31967 LDKGossipTimestampFilter this_ptr_conv;
31968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31969 this_ptr_conv.is_owned = false;
31970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31971 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31972 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
31976 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
31977 LDKGossipTimestampFilter this_ptr_conv;
31978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31979 this_ptr_conv.is_owned = false;
31980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31981 LDKThirtyTwoBytes val_ref;
31982 CHECK(val->arr_len == 32);
31983 memcpy(val_ref.data, val->elems, 32); FREE(val);
31984 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
31987 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
31988 LDKGossipTimestampFilter this_ptr_conv;
31989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31990 this_ptr_conv.is_owned = false;
31991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31992 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
31996 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
31997 LDKGossipTimestampFilter this_ptr_conv;
31998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31999 this_ptr_conv.is_owned = false;
32000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32001 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
32004 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
32005 LDKGossipTimestampFilter this_ptr_conv;
32006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32007 this_ptr_conv.is_owned = false;
32008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32009 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
32013 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
32014 LDKGossipTimestampFilter this_ptr_conv;
32015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32016 this_ptr_conv.is_owned = false;
32017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32018 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
32021 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) {
32022 LDKThirtyTwoBytes chain_hash_arg_ref;
32023 CHECK(chain_hash_arg->arr_len == 32);
32024 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32025 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
32026 uint32_t ret_ref = 0;
32027 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32028 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32030 ret_ref = (uintptr_t)ret_var.inner;
32031 if (ret_var.is_owned) {
32037 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
32038 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
32039 uint32_t ret_ref = 0;
32040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32043 ret_ref = (uintptr_t)ret_var.inner;
32044 if (ret_var.is_owned) {
32049 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
32050 LDKGossipTimestampFilter arg_conv;
32051 arg_conv.inner = (void*)(arg & (~1));
32052 arg_conv.is_owned = false;
32053 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32054 uint32_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
32058 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
32059 LDKGossipTimestampFilter orig_conv;
32060 orig_conv.inner = (void*)(orig & (~1));
32061 orig_conv.is_owned = false;
32062 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32063 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
32064 uint32_t ret_ref = 0;
32065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32068 ret_ref = (uintptr_t)ret_var.inner;
32069 if (ret_var.is_owned) {
32075 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
32076 if ((this_ptr & 1) != 0) return;
32077 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32078 CHECK_ACCESS(this_ptr_ptr);
32079 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
32080 FREE((void*)this_ptr);
32081 ErrorAction_free(this_ptr_conv);
32084 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
32085 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32086 *ret_copy = ErrorAction_clone(arg);
32087 uint32_t ret_ref = (uintptr_t)ret_copy;
32090 uint32_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
32091 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
32092 uint32_t ret_conv = ErrorAction_clone_ptr(arg_conv);
32096 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
32097 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
32098 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32099 *ret_copy = ErrorAction_clone(orig_conv);
32100 uint32_t ret_ref = (uintptr_t)ret_copy;
32104 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
32105 LDKErrorMessage msg_conv;
32106 msg_conv.inner = (void*)(msg & (~1));
32107 msg_conv.is_owned = (msg & 1) || (msg == 0);
32108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32109 msg_conv = ErrorMessage_clone(&msg_conv);
32110 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32111 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
32112 uint32_t ret_ref = (uintptr_t)ret_copy;
32116 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
32117 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32118 *ret_copy = ErrorAction_ignore_error();
32119 uint32_t ret_ref = (uintptr_t)ret_copy;
32123 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
32124 LDKLevel a_conv = LDKLevel_from_js(a);
32125 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32126 *ret_copy = ErrorAction_ignore_and_log(a_conv);
32127 uint32_t ret_ref = (uintptr_t)ret_copy;
32131 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
32132 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32133 *ret_copy = ErrorAction_ignore_duplicate_gossip();
32134 uint32_t ret_ref = (uintptr_t)ret_copy;
32138 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
32139 LDKErrorMessage msg_conv;
32140 msg_conv.inner = (void*)(msg & (~1));
32141 msg_conv.is_owned = (msg & 1) || (msg == 0);
32142 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32143 msg_conv = ErrorMessage_clone(&msg_conv);
32144 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32145 *ret_copy = ErrorAction_send_error_message(msg_conv);
32146 uint32_t ret_ref = (uintptr_t)ret_copy;
32150 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
32151 LDKWarningMessage msg_conv;
32152 msg_conv.inner = (void*)(msg & (~1));
32153 msg_conv.is_owned = (msg & 1) || (msg == 0);
32154 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32155 msg_conv = WarningMessage_clone(&msg_conv);
32156 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
32157 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32158 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
32159 uint32_t ret_ref = (uintptr_t)ret_copy;
32163 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
32164 LDKLightningError this_obj_conv;
32165 this_obj_conv.inner = (void*)(this_obj & (~1));
32166 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32168 LightningError_free(this_obj_conv);
32171 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
32172 LDKLightningError this_ptr_conv;
32173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32174 this_ptr_conv.is_owned = false;
32175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32176 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
32177 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
32182 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
32183 LDKLightningError this_ptr_conv;
32184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32185 this_ptr_conv.is_owned = false;
32186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32187 LDKStr val_conv = str_ref_to_owned_c(val);
32188 LightningError_set_err(&this_ptr_conv, val_conv);
32191 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
32192 LDKLightningError 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 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32197 *ret_copy = LightningError_get_action(&this_ptr_conv);
32198 uint32_t ret_ref = (uintptr_t)ret_copy;
32202 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
32203 LDKLightningError this_ptr_conv;
32204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32205 this_ptr_conv.is_owned = false;
32206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32207 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32208 CHECK_ACCESS(val_ptr);
32209 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
32210 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
32211 LightningError_set_action(&this_ptr_conv, val_conv);
32214 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
32215 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
32216 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
32217 CHECK_ACCESS(action_arg_ptr);
32218 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
32219 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
32220 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
32221 uint32_t ret_ref = 0;
32222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32225 ret_ref = (uintptr_t)ret_var.inner;
32226 if (ret_var.is_owned) {
32232 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
32233 LDKLightningError ret_var = LightningError_clone(arg);
32234 uint32_t ret_ref = 0;
32235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32238 ret_ref = (uintptr_t)ret_var.inner;
32239 if (ret_var.is_owned) {
32244 uint32_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
32245 LDKLightningError arg_conv;
32246 arg_conv.inner = (void*)(arg & (~1));
32247 arg_conv.is_owned = false;
32248 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32249 uint32_t ret_conv = LightningError_clone_ptr(&arg_conv);
32253 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
32254 LDKLightningError orig_conv;
32255 orig_conv.inner = (void*)(orig & (~1));
32256 orig_conv.is_owned = false;
32257 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32258 LDKLightningError ret_var = LightningError_clone(&orig_conv);
32259 uint32_t ret_ref = 0;
32260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32263 ret_ref = (uintptr_t)ret_var.inner;
32264 if (ret_var.is_owned) {
32270 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
32271 LDKCommitmentUpdate this_obj_conv;
32272 this_obj_conv.inner = (void*)(this_obj & (~1));
32273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32275 CommitmentUpdate_free(this_obj_conv);
32278 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
32279 LDKCommitmentUpdate this_ptr_conv;
32280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32281 this_ptr_conv.is_owned = false;
32282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32283 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
32284 uint32_tArray ret_arr = NULL;
32285 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32286 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32287 for (size_t p = 0; p < ret_var.datalen; p++) {
32288 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
32289 uint32_t ret_conv_15_ref = 0;
32290 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32291 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
32293 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
32294 if (ret_conv_15_var.is_owned) {
32295 ret_conv_15_ref |= 1;
32297 ret_arr_ptr[p] = ret_conv_15_ref;
32300 FREE(ret_var.data);
32304 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
32305 LDKCommitmentUpdate this_ptr_conv;
32306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32307 this_ptr_conv.is_owned = false;
32308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32309 LDKCVec_UpdateAddHTLCZ val_constr;
32310 val_constr.datalen = val->arr_len;
32311 if (val_constr.datalen > 0)
32312 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32314 val_constr.data = NULL;
32315 uint32_t* val_vals = val->elems;
32316 for (size_t p = 0; p < val_constr.datalen; p++) {
32317 uint32_t val_conv_15 = val_vals[p];
32318 LDKUpdateAddHTLC val_conv_15_conv;
32319 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
32320 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
32321 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
32322 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
32323 val_constr.data[p] = val_conv_15_conv;
32326 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
32329 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
32330 LDKCommitmentUpdate this_ptr_conv;
32331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32332 this_ptr_conv.is_owned = false;
32333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
32335 uint32_tArray ret_arr = NULL;
32336 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32337 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32338 for (size_t t = 0; t < ret_var.datalen; t++) {
32339 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
32340 uint32_t ret_conv_19_ref = 0;
32341 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32342 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
32344 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
32345 if (ret_conv_19_var.is_owned) {
32346 ret_conv_19_ref |= 1;
32348 ret_arr_ptr[t] = ret_conv_19_ref;
32351 FREE(ret_var.data);
32355 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
32356 LDKCommitmentUpdate this_ptr_conv;
32357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32358 this_ptr_conv.is_owned = false;
32359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32360 LDKCVec_UpdateFulfillHTLCZ val_constr;
32361 val_constr.datalen = val->arr_len;
32362 if (val_constr.datalen > 0)
32363 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32365 val_constr.data = NULL;
32366 uint32_t* val_vals = val->elems;
32367 for (size_t t = 0; t < val_constr.datalen; t++) {
32368 uint32_t val_conv_19 = val_vals[t];
32369 LDKUpdateFulfillHTLC val_conv_19_conv;
32370 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
32371 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
32372 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
32373 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
32374 val_constr.data[t] = val_conv_19_conv;
32377 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
32380 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
32381 LDKCommitmentUpdate this_ptr_conv;
32382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32383 this_ptr_conv.is_owned = false;
32384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32385 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
32386 uint32_tArray ret_arr = NULL;
32387 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32388 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32389 for (size_t q = 0; q < ret_var.datalen; q++) {
32390 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
32391 uint32_t ret_conv_16_ref = 0;
32392 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32393 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32395 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
32396 if (ret_conv_16_var.is_owned) {
32397 ret_conv_16_ref |= 1;
32399 ret_arr_ptr[q] = ret_conv_16_ref;
32402 FREE(ret_var.data);
32406 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
32407 LDKCommitmentUpdate this_ptr_conv;
32408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32409 this_ptr_conv.is_owned = false;
32410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32411 LDKCVec_UpdateFailHTLCZ val_constr;
32412 val_constr.datalen = val->arr_len;
32413 if (val_constr.datalen > 0)
32414 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32416 val_constr.data = NULL;
32417 uint32_t* val_vals = val->elems;
32418 for (size_t q = 0; q < val_constr.datalen; q++) {
32419 uint32_t val_conv_16 = val_vals[q];
32420 LDKUpdateFailHTLC val_conv_16_conv;
32421 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
32422 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
32423 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32424 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
32425 val_constr.data[q] = val_conv_16_conv;
32428 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
32431 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
32432 LDKCommitmentUpdate this_ptr_conv;
32433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32434 this_ptr_conv.is_owned = false;
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
32437 uint32_tArray ret_arr = NULL;
32438 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
32439 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
32440 for (size_t z = 0; z < ret_var.datalen; z++) {
32441 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
32442 uint32_t ret_conv_25_ref = 0;
32443 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32444 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32446 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
32447 if (ret_conv_25_var.is_owned) {
32448 ret_conv_25_ref |= 1;
32450 ret_arr_ptr[z] = ret_conv_25_ref;
32453 FREE(ret_var.data);
32457 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) {
32458 LDKCommitmentUpdate this_ptr_conv;
32459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32460 this_ptr_conv.is_owned = false;
32461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32462 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32463 val_constr.datalen = val->arr_len;
32464 if (val_constr.datalen > 0)
32465 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32467 val_constr.data = NULL;
32468 uint32_t* val_vals = val->elems;
32469 for (size_t z = 0; z < val_constr.datalen; z++) {
32470 uint32_t val_conv_25 = val_vals[z];
32471 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32472 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
32473 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
32474 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32475 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32476 val_constr.data[z] = val_conv_25_conv;
32479 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32482 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
32483 LDKCommitmentUpdate this_ptr_conv;
32484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32485 this_ptr_conv.is_owned = false;
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32487 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32488 uint32_t ret_ref = 0;
32489 if ((uintptr_t)ret_var.inner > 4096) {
32490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32493 ret_ref = (uintptr_t)ret_var.inner;
32494 if (ret_var.is_owned) {
32501 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
32502 LDKCommitmentUpdate this_ptr_conv;
32503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32504 this_ptr_conv.is_owned = false;
32505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32506 LDKUpdateFee val_conv;
32507 val_conv.inner = (void*)(val & (~1));
32508 val_conv.is_owned = (val & 1) || (val == 0);
32509 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32510 val_conv = UpdateFee_clone(&val_conv);
32511 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32514 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
32515 LDKCommitmentUpdate this_ptr_conv;
32516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32517 this_ptr_conv.is_owned = false;
32518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32519 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32520 uint32_t ret_ref = 0;
32521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32524 ret_ref = (uintptr_t)ret_var.inner;
32525 if (ret_var.is_owned) {
32531 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
32532 LDKCommitmentUpdate this_ptr_conv;
32533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32534 this_ptr_conv.is_owned = false;
32535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32536 LDKCommitmentSigned val_conv;
32537 val_conv.inner = (void*)(val & (~1));
32538 val_conv.is_owned = (val & 1) || (val == 0);
32539 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32540 val_conv = CommitmentSigned_clone(&val_conv);
32541 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32544 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) {
32545 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32546 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
32547 if (update_add_htlcs_arg_constr.datalen > 0)
32548 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32550 update_add_htlcs_arg_constr.data = NULL;
32551 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
32552 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32553 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32554 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32555 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
32556 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
32557 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32558 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32559 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32561 FREE(update_add_htlcs_arg);
32562 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32563 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
32564 if (update_fulfill_htlcs_arg_constr.datalen > 0)
32565 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32567 update_fulfill_htlcs_arg_constr.data = NULL;
32568 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
32569 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32570 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32571 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32572 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
32573 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
32574 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32575 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32576 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32578 FREE(update_fulfill_htlcs_arg);
32579 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32580 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
32581 if (update_fail_htlcs_arg_constr.datalen > 0)
32582 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32584 update_fail_htlcs_arg_constr.data = NULL;
32585 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
32586 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32587 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32588 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32589 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
32590 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
32591 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32592 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32593 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32595 FREE(update_fail_htlcs_arg);
32596 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32597 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
32598 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32599 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32601 update_fail_malformed_htlcs_arg_constr.data = NULL;
32602 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
32603 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32604 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32605 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32606 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
32607 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);
32608 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32609 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32610 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32612 FREE(update_fail_malformed_htlcs_arg);
32613 LDKUpdateFee update_fee_arg_conv;
32614 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
32615 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
32616 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32617 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32618 LDKCommitmentSigned commitment_signed_arg_conv;
32619 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
32620 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
32621 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32622 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32623 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);
32624 uint32_t ret_ref = 0;
32625 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32626 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32628 ret_ref = (uintptr_t)ret_var.inner;
32629 if (ret_var.is_owned) {
32635 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32636 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32637 uint32_t ret_ref = 0;
32638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32641 ret_ref = (uintptr_t)ret_var.inner;
32642 if (ret_var.is_owned) {
32647 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
32648 LDKCommitmentUpdate arg_conv;
32649 arg_conv.inner = (void*)(arg & (~1));
32650 arg_conv.is_owned = false;
32651 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32652 uint32_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
32656 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
32657 LDKCommitmentUpdate orig_conv;
32658 orig_conv.inner = (void*)(orig & (~1));
32659 orig_conv.is_owned = false;
32660 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32661 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32662 uint32_t ret_ref = 0;
32663 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32664 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32666 ret_ref = (uintptr_t)ret_var.inner;
32667 if (ret_var.is_owned) {
32673 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
32674 if ((this_ptr & 1) != 0) return;
32675 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32676 CHECK_ACCESS(this_ptr_ptr);
32677 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32678 FREE((void*)this_ptr);
32679 ChannelMessageHandler_free(this_ptr_conv);
32682 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
32683 if ((this_ptr & 1) != 0) return;
32684 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32685 CHECK_ACCESS(this_ptr_ptr);
32686 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32687 FREE((void*)this_ptr);
32688 RoutingMessageHandler_free(this_ptr_conv);
32691 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
32692 LDKAcceptChannel obj_conv;
32693 obj_conv.inner = (void*)(obj & (~1));
32694 obj_conv.is_owned = false;
32695 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32696 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32697 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32698 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32699 CVec_u8Z_free(ret_var);
32703 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
32704 LDKu8slice ser_ref;
32705 ser_ref.datalen = ser->arr_len;
32706 ser_ref.data = ser->elems;
32707 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32708 *ret_conv = AcceptChannel_read(ser_ref);
32710 return (uint32_t)ret_conv;
32713 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
32714 LDKAnnouncementSignatures obj_conv;
32715 obj_conv.inner = (void*)(obj & (~1));
32716 obj_conv.is_owned = false;
32717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32718 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32719 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32720 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32721 CVec_u8Z_free(ret_var);
32725 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
32726 LDKu8slice ser_ref;
32727 ser_ref.datalen = ser->arr_len;
32728 ser_ref.data = ser->elems;
32729 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32730 *ret_conv = AnnouncementSignatures_read(ser_ref);
32732 return (uint32_t)ret_conv;
32735 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
32736 LDKChannelReestablish obj_conv;
32737 obj_conv.inner = (void*)(obj & (~1));
32738 obj_conv.is_owned = false;
32739 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32740 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32741 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32742 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32743 CVec_u8Z_free(ret_var);
32747 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
32748 LDKu8slice ser_ref;
32749 ser_ref.datalen = ser->arr_len;
32750 ser_ref.data = ser->elems;
32751 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
32752 *ret_conv = ChannelReestablish_read(ser_ref);
32754 return (uint32_t)ret_conv;
32757 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
32758 LDKClosingSigned obj_conv;
32759 obj_conv.inner = (void*)(obj & (~1));
32760 obj_conv.is_owned = false;
32761 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32762 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
32763 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32764 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32765 CVec_u8Z_free(ret_var);
32769 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
32770 LDKu8slice ser_ref;
32771 ser_ref.datalen = ser->arr_len;
32772 ser_ref.data = ser->elems;
32773 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
32774 *ret_conv = ClosingSigned_read(ser_ref);
32776 return (uint32_t)ret_conv;
32779 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
32780 LDKClosingSignedFeeRange obj_conv;
32781 obj_conv.inner = (void*)(obj & (~1));
32782 obj_conv.is_owned = false;
32783 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32784 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
32785 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32786 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32787 CVec_u8Z_free(ret_var);
32791 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
32792 LDKu8slice ser_ref;
32793 ser_ref.datalen = ser->arr_len;
32794 ser_ref.data = ser->elems;
32795 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
32796 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
32798 return (uint32_t)ret_conv;
32801 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
32802 LDKCommitmentSigned 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 = CommitmentSigned_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_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
32814 LDKu8slice ser_ref;
32815 ser_ref.datalen = ser->arr_len;
32816 ser_ref.data = ser->elems;
32817 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
32818 *ret_conv = CommitmentSigned_read(ser_ref);
32820 return (uint32_t)ret_conv;
32823 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
32824 LDKFundingCreated obj_conv;
32825 obj_conv.inner = (void*)(obj & (~1));
32826 obj_conv.is_owned = false;
32827 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32828 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
32829 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32830 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32831 CVec_u8Z_free(ret_var);
32835 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
32836 LDKu8slice ser_ref;
32837 ser_ref.datalen = ser->arr_len;
32838 ser_ref.data = ser->elems;
32839 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
32840 *ret_conv = FundingCreated_read(ser_ref);
32842 return (uint32_t)ret_conv;
32845 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
32846 LDKFundingSigned obj_conv;
32847 obj_conv.inner = (void*)(obj & (~1));
32848 obj_conv.is_owned = false;
32849 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32850 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
32851 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32852 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32853 CVec_u8Z_free(ret_var);
32857 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
32858 LDKu8slice ser_ref;
32859 ser_ref.datalen = ser->arr_len;
32860 ser_ref.data = ser->elems;
32861 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32862 *ret_conv = FundingSigned_read(ser_ref);
32864 return (uint32_t)ret_conv;
32867 int8_tArray __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint32_t obj) {
32868 LDKChannelReady obj_conv;
32869 obj_conv.inner = (void*)(obj & (~1));
32870 obj_conv.is_owned = false;
32871 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32872 LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
32873 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32874 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32875 CVec_u8Z_free(ret_var);
32879 uint32_t __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
32880 LDKu8slice ser_ref;
32881 ser_ref.datalen = ser->arr_len;
32882 ser_ref.data = ser->elems;
32883 LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32884 *ret_conv = ChannelReady_read(ser_ref);
32886 return (uint32_t)ret_conv;
32889 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
32891 obj_conv.inner = (void*)(obj & (~1));
32892 obj_conv.is_owned = false;
32893 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32894 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
32895 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32896 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32897 CVec_u8Z_free(ret_var);
32901 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
32902 LDKu8slice ser_ref;
32903 ser_ref.datalen = ser->arr_len;
32904 ser_ref.data = ser->elems;
32905 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32906 *ret_conv = Init_read(ser_ref);
32908 return (uint32_t)ret_conv;
32911 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
32912 LDKOpenChannel obj_conv;
32913 obj_conv.inner = (void*)(obj & (~1));
32914 obj_conv.is_owned = false;
32915 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32916 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
32917 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32918 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32919 CVec_u8Z_free(ret_var);
32923 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
32924 LDKu8slice ser_ref;
32925 ser_ref.datalen = ser->arr_len;
32926 ser_ref.data = ser->elems;
32927 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32928 *ret_conv = OpenChannel_read(ser_ref);
32930 return (uint32_t)ret_conv;
32933 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
32934 LDKRevokeAndACK obj_conv;
32935 obj_conv.inner = (void*)(obj & (~1));
32936 obj_conv.is_owned = false;
32937 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32938 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
32939 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32940 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32941 CVec_u8Z_free(ret_var);
32945 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
32946 LDKu8slice ser_ref;
32947 ser_ref.datalen = ser->arr_len;
32948 ser_ref.data = ser->elems;
32949 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32950 *ret_conv = RevokeAndACK_read(ser_ref);
32952 return (uint32_t)ret_conv;
32955 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
32956 LDKShutdown obj_conv;
32957 obj_conv.inner = (void*)(obj & (~1));
32958 obj_conv.is_owned = false;
32959 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32960 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
32961 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32962 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32963 CVec_u8Z_free(ret_var);
32967 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
32968 LDKu8slice ser_ref;
32969 ser_ref.datalen = ser->arr_len;
32970 ser_ref.data = ser->elems;
32971 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32972 *ret_conv = Shutdown_read(ser_ref);
32974 return (uint32_t)ret_conv;
32977 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
32978 LDKUpdateFailHTLC obj_conv;
32979 obj_conv.inner = (void*)(obj & (~1));
32980 obj_conv.is_owned = false;
32981 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32982 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
32983 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32984 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32985 CVec_u8Z_free(ret_var);
32989 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
32990 LDKu8slice ser_ref;
32991 ser_ref.datalen = ser->arr_len;
32992 ser_ref.data = ser->elems;
32993 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32994 *ret_conv = UpdateFailHTLC_read(ser_ref);
32996 return (uint32_t)ret_conv;
32999 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
33000 LDKUpdateFailMalformedHTLC obj_conv;
33001 obj_conv.inner = (void*)(obj & (~1));
33002 obj_conv.is_owned = false;
33003 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33004 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
33005 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33006 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33007 CVec_u8Z_free(ret_var);
33011 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
33012 LDKu8slice ser_ref;
33013 ser_ref.datalen = ser->arr_len;
33014 ser_ref.data = ser->elems;
33015 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
33016 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
33018 return (uint32_t)ret_conv;
33021 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
33022 LDKUpdateFee obj_conv;
33023 obj_conv.inner = (void*)(obj & (~1));
33024 obj_conv.is_owned = false;
33025 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33026 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
33027 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33028 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33029 CVec_u8Z_free(ret_var);
33033 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
33034 LDKu8slice ser_ref;
33035 ser_ref.datalen = ser->arr_len;
33036 ser_ref.data = ser->elems;
33037 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
33038 *ret_conv = UpdateFee_read(ser_ref);
33040 return (uint32_t)ret_conv;
33043 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
33044 LDKUpdateFulfillHTLC obj_conv;
33045 obj_conv.inner = (void*)(obj & (~1));
33046 obj_conv.is_owned = false;
33047 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33048 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
33049 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33050 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33051 CVec_u8Z_free(ret_var);
33055 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
33056 LDKu8slice ser_ref;
33057 ser_ref.datalen = ser->arr_len;
33058 ser_ref.data = ser->elems;
33059 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
33060 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
33062 return (uint32_t)ret_conv;
33065 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
33066 LDKUpdateAddHTLC obj_conv;
33067 obj_conv.inner = (void*)(obj & (~1));
33068 obj_conv.is_owned = false;
33069 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33070 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
33071 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33072 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33073 CVec_u8Z_free(ret_var);
33077 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
33078 LDKu8slice ser_ref;
33079 ser_ref.datalen = ser->arr_len;
33080 ser_ref.data = ser->elems;
33081 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
33082 *ret_conv = UpdateAddHTLC_read(ser_ref);
33084 return (uint32_t)ret_conv;
33087 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
33089 obj_conv.inner = (void*)(obj & (~1));
33090 obj_conv.is_owned = false;
33091 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33092 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
33093 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33094 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33095 CVec_u8Z_free(ret_var);
33099 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
33100 LDKu8slice ser_ref;
33101 ser_ref.datalen = ser->arr_len;
33102 ser_ref.data = ser->elems;
33103 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
33104 *ret_conv = Ping_read(ser_ref);
33106 return (uint32_t)ret_conv;
33109 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
33111 obj_conv.inner = (void*)(obj & (~1));
33112 obj_conv.is_owned = false;
33113 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33114 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
33115 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33116 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33117 CVec_u8Z_free(ret_var);
33121 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
33122 LDKu8slice ser_ref;
33123 ser_ref.datalen = ser->arr_len;
33124 ser_ref.data = ser->elems;
33125 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
33126 *ret_conv = Pong_read(ser_ref);
33128 return (uint32_t)ret_conv;
33131 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
33132 LDKUnsignedChannelAnnouncement obj_conv;
33133 obj_conv.inner = (void*)(obj & (~1));
33134 obj_conv.is_owned = false;
33135 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33136 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
33137 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33138 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33139 CVec_u8Z_free(ret_var);
33143 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
33144 LDKu8slice ser_ref;
33145 ser_ref.datalen = ser->arr_len;
33146 ser_ref.data = ser->elems;
33147 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
33148 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
33150 return (uint32_t)ret_conv;
33153 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
33154 LDKChannelAnnouncement obj_conv;
33155 obj_conv.inner = (void*)(obj & (~1));
33156 obj_conv.is_owned = false;
33157 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33158 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
33159 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33160 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33161 CVec_u8Z_free(ret_var);
33165 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
33166 LDKu8slice ser_ref;
33167 ser_ref.datalen = ser->arr_len;
33168 ser_ref.data = ser->elems;
33169 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
33170 *ret_conv = ChannelAnnouncement_read(ser_ref);
33172 return (uint32_t)ret_conv;
33175 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
33176 LDKUnsignedChannelUpdate obj_conv;
33177 obj_conv.inner = (void*)(obj & (~1));
33178 obj_conv.is_owned = false;
33179 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33180 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
33181 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33182 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33183 CVec_u8Z_free(ret_var);
33187 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
33188 LDKu8slice ser_ref;
33189 ser_ref.datalen = ser->arr_len;
33190 ser_ref.data = ser->elems;
33191 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33192 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
33194 return (uint32_t)ret_conv;
33197 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
33198 LDKChannelUpdate obj_conv;
33199 obj_conv.inner = (void*)(obj & (~1));
33200 obj_conv.is_owned = false;
33201 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33202 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
33203 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33204 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33205 CVec_u8Z_free(ret_var);
33209 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
33210 LDKu8slice ser_ref;
33211 ser_ref.datalen = ser->arr_len;
33212 ser_ref.data = ser->elems;
33213 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33214 *ret_conv = ChannelUpdate_read(ser_ref);
33216 return (uint32_t)ret_conv;
33219 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
33220 LDKErrorMessage obj_conv;
33221 obj_conv.inner = (void*)(obj & (~1));
33222 obj_conv.is_owned = false;
33223 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33224 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
33225 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33226 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33227 CVec_u8Z_free(ret_var);
33231 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
33232 LDKu8slice ser_ref;
33233 ser_ref.datalen = ser->arr_len;
33234 ser_ref.data = ser->elems;
33235 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33236 *ret_conv = ErrorMessage_read(ser_ref);
33238 return (uint32_t)ret_conv;
33241 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
33242 LDKWarningMessage obj_conv;
33243 obj_conv.inner = (void*)(obj & (~1));
33244 obj_conv.is_owned = false;
33245 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33246 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
33247 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33248 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33249 CVec_u8Z_free(ret_var);
33253 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
33254 LDKu8slice ser_ref;
33255 ser_ref.datalen = ser->arr_len;
33256 ser_ref.data = ser->elems;
33257 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33258 *ret_conv = WarningMessage_read(ser_ref);
33260 return (uint32_t)ret_conv;
33263 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
33264 LDKUnsignedNodeAnnouncement obj_conv;
33265 obj_conv.inner = (void*)(obj & (~1));
33266 obj_conv.is_owned = false;
33267 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33268 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
33269 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33270 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33271 CVec_u8Z_free(ret_var);
33275 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
33276 LDKu8slice ser_ref;
33277 ser_ref.datalen = ser->arr_len;
33278 ser_ref.data = ser->elems;
33279 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33280 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
33282 return (uint32_t)ret_conv;
33285 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
33286 LDKNodeAnnouncement obj_conv;
33287 obj_conv.inner = (void*)(obj & (~1));
33288 obj_conv.is_owned = false;
33289 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33290 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
33291 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33292 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33293 CVec_u8Z_free(ret_var);
33297 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
33298 LDKu8slice ser_ref;
33299 ser_ref.datalen = ser->arr_len;
33300 ser_ref.data = ser->elems;
33301 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33302 *ret_conv = NodeAnnouncement_read(ser_ref);
33304 return (uint32_t)ret_conv;
33307 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
33308 LDKu8slice ser_ref;
33309 ser_ref.datalen = ser->arr_len;
33310 ser_ref.data = ser->elems;
33311 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33312 *ret_conv = QueryShortChannelIds_read(ser_ref);
33314 return (uint32_t)ret_conv;
33317 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
33318 LDKQueryShortChannelIds obj_conv;
33319 obj_conv.inner = (void*)(obj & (~1));
33320 obj_conv.is_owned = false;
33321 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33322 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
33323 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33324 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33325 CVec_u8Z_free(ret_var);
33329 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
33330 LDKReplyShortChannelIdsEnd obj_conv;
33331 obj_conv.inner = (void*)(obj & (~1));
33332 obj_conv.is_owned = false;
33333 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33334 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
33335 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33336 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33337 CVec_u8Z_free(ret_var);
33341 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
33342 LDKu8slice ser_ref;
33343 ser_ref.datalen = ser->arr_len;
33344 ser_ref.data = ser->elems;
33345 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33346 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
33348 return (uint32_t)ret_conv;
33351 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
33352 LDKQueryChannelRange this_arg_conv;
33353 this_arg_conv.inner = (void*)(this_arg & (~1));
33354 this_arg_conv.is_owned = false;
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33356 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
33360 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
33361 LDKQueryChannelRange obj_conv;
33362 obj_conv.inner = (void*)(obj & (~1));
33363 obj_conv.is_owned = false;
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33365 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
33366 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33367 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33368 CVec_u8Z_free(ret_var);
33372 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
33373 LDKu8slice ser_ref;
33374 ser_ref.datalen = ser->arr_len;
33375 ser_ref.data = ser->elems;
33376 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33377 *ret_conv = QueryChannelRange_read(ser_ref);
33379 return (uint32_t)ret_conv;
33382 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
33383 LDKu8slice ser_ref;
33384 ser_ref.datalen = ser->arr_len;
33385 ser_ref.data = ser->elems;
33386 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33387 *ret_conv = ReplyChannelRange_read(ser_ref);
33389 return (uint32_t)ret_conv;
33392 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
33393 LDKReplyChannelRange obj_conv;
33394 obj_conv.inner = (void*)(obj & (~1));
33395 obj_conv.is_owned = false;
33396 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33397 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
33398 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33399 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33400 CVec_u8Z_free(ret_var);
33404 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
33405 LDKGossipTimestampFilter obj_conv;
33406 obj_conv.inner = (void*)(obj & (~1));
33407 obj_conv.is_owned = false;
33408 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33409 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
33410 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33411 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33412 CVec_u8Z_free(ret_var);
33416 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
33417 LDKu8slice ser_ref;
33418 ser_ref.datalen = ser->arr_len;
33419 ser_ref.data = ser->elems;
33420 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33421 *ret_conv = GossipTimestampFilter_read(ser_ref);
33423 return (uint32_t)ret_conv;
33426 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
33427 if ((this_ptr & 1) != 0) return;
33428 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33429 CHECK_ACCESS(this_ptr_ptr);
33430 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
33431 FREE((void*)this_ptr);
33432 CustomMessageHandler_free(this_ptr_conv);
33435 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
33436 LDKIgnoringMessageHandler this_obj_conv;
33437 this_obj_conv.inner = (void*)(this_obj & (~1));
33438 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33440 IgnoringMessageHandler_free(this_obj_conv);
33443 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
33444 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33445 uint32_t ret_ref = 0;
33446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33449 ret_ref = (uintptr_t)ret_var.inner;
33450 if (ret_var.is_owned) {
33456 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33457 LDKIgnoringMessageHandler this_arg_conv;
33458 this_arg_conv.inner = (void*)(this_arg & (~1));
33459 this_arg_conv.is_owned = false;
33460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33461 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33462 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33463 return (uint32_t)ret_ret;
33466 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
33467 LDKIgnoringMessageHandler this_arg_conv;
33468 this_arg_conv.inner = (void*)(this_arg & (~1));
33469 this_arg_conv.is_owned = false;
33470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33471 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33472 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33473 return (uint32_t)ret_ret;
33476 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
33477 LDKIgnoringMessageHandler this_arg_conv;
33478 this_arg_conv.inner = (void*)(this_arg & (~1));
33479 this_arg_conv.is_owned = false;
33480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33481 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33482 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33483 return (uint32_t)ret_ret;
33486 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
33487 LDKIgnoringMessageHandler this_arg_conv;
33488 this_arg_conv.inner = (void*)(this_arg & (~1));
33489 this_arg_conv.is_owned = false;
33490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33491 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33492 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33493 return (uint32_t)ret_ret;
33496 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
33497 LDKErroringMessageHandler this_obj_conv;
33498 this_obj_conv.inner = (void*)(this_obj & (~1));
33499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33501 ErroringMessageHandler_free(this_obj_conv);
33504 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
33505 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33506 uint32_t ret_ref = 0;
33507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33510 ret_ref = (uintptr_t)ret_var.inner;
33511 if (ret_var.is_owned) {
33517 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
33518 LDKErroringMessageHandler this_arg_conv;
33519 this_arg_conv.inner = (void*)(this_arg & (~1));
33520 this_arg_conv.is_owned = false;
33521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33522 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33523 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33524 return (uint32_t)ret_ret;
33527 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
33528 LDKErroringMessageHandler this_arg_conv;
33529 this_arg_conv.inner = (void*)(this_arg & (~1));
33530 this_arg_conv.is_owned = false;
33531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33532 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33533 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33534 return (uint32_t)ret_ret;
33537 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
33538 LDKMessageHandler this_obj_conv;
33539 this_obj_conv.inner = (void*)(this_obj & (~1));
33540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33542 MessageHandler_free(this_obj_conv);
33545 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
33546 LDKMessageHandler this_ptr_conv;
33547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33548 this_ptr_conv.is_owned = false;
33549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33550 // WARNING: This object doesn't live past this scope, needs clone!
33551 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
33555 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
33556 LDKMessageHandler this_ptr_conv;
33557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33558 this_ptr_conv.is_owned = false;
33559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33560 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33561 CHECK_ACCESS(val_ptr);
33562 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33563 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33564 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33565 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33567 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33570 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
33571 LDKMessageHandler this_ptr_conv;
33572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33573 this_ptr_conv.is_owned = false;
33574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33575 // WARNING: This object doesn't live past this scope, needs clone!
33576 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
33580 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
33581 LDKMessageHandler this_ptr_conv;
33582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33583 this_ptr_conv.is_owned = false;
33584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33585 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33586 CHECK_ACCESS(val_ptr);
33587 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33588 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33589 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33590 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33592 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33595 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
33596 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
33597 CHECK_ACCESS(chan_handler_arg_ptr);
33598 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33599 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33601 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33603 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
33604 CHECK_ACCESS(route_handler_arg_ptr);
33605 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33606 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33608 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33610 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_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 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33623 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33624 *ret_ret = SocketDescriptor_clone(arg);
33625 return (uint32_t)ret_ret;
33627 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
33628 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
33629 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
33630 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33631 uint32_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
33635 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
33636 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
33637 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
33638 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33639 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33640 *ret_ret = SocketDescriptor_clone(orig_conv);
33641 return (uint32_t)ret_ret;
33644 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
33645 if ((this_ptr & 1) != 0) return;
33646 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33647 CHECK_ACCESS(this_ptr_ptr);
33648 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33649 FREE((void*)this_ptr);
33650 SocketDescriptor_free(this_ptr_conv);
33653 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
33654 LDKPeerHandleError this_obj_conv;
33655 this_obj_conv.inner = (void*)(this_obj & (~1));
33656 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33658 PeerHandleError_free(this_obj_conv);
33661 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
33662 LDKPeerHandleError this_ptr_conv;
33663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33664 this_ptr_conv.is_owned = false;
33665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33666 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33670 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
33671 LDKPeerHandleError this_ptr_conv;
33672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33673 this_ptr_conv.is_owned = false;
33674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33675 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33678 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
33679 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33680 uint32_t ret_ref = 0;
33681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33684 ret_ref = (uintptr_t)ret_var.inner;
33685 if (ret_var.is_owned) {
33691 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33692 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33693 uint32_t ret_ref = 0;
33694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33697 ret_ref = (uintptr_t)ret_var.inner;
33698 if (ret_var.is_owned) {
33703 uint32_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
33704 LDKPeerHandleError arg_conv;
33705 arg_conv.inner = (void*)(arg & (~1));
33706 arg_conv.is_owned = false;
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33708 uint32_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
33712 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
33713 LDKPeerHandleError orig_conv;
33714 orig_conv.inner = (void*)(orig & (~1));
33715 orig_conv.is_owned = false;
33716 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33717 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33718 uint32_t ret_ref = 0;
33719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33722 ret_ref = (uintptr_t)ret_var.inner;
33723 if (ret_var.is_owned) {
33729 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
33730 LDKPeerManager this_obj_conv;
33731 this_obj_conv.inner = (void*)(this_obj & (~1));
33732 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33734 PeerManager_free(this_obj_conv);
33737 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) {
33738 LDKMessageHandler message_handler_conv;
33739 message_handler_conv.inner = (void*)(message_handler & (~1));
33740 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
33741 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33742 // WARNING: we need a move here but no clone is available for LDKMessageHandler
33743 LDKSecretKey our_node_secret_ref;
33744 CHECK(our_node_secret->arr_len == 32);
33745 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
33746 unsigned char ephemeral_random_data_arr[32];
33747 CHECK(ephemeral_random_data->arr_len == 32);
33748 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
33749 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33750 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
33751 CHECK_ACCESS(logger_ptr);
33752 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33753 if (logger_conv.free == LDKLogger_JCalls_free) {
33754 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33755 LDKLogger_JCalls_cloned(&logger_conv);
33757 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
33758 CHECK_ACCESS(custom_message_handler_ptr);
33759 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33760 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33761 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33762 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33764 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33765 uint32_t ret_ref = 0;
33766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33769 ret_ref = (uintptr_t)ret_var.inner;
33770 if (ret_var.is_owned) {
33776 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
33777 LDKPeerManager this_arg_conv;
33778 this_arg_conv.inner = (void*)(this_arg & (~1));
33779 this_arg_conv.is_owned = false;
33780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33781 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
33782 ptrArray ret_arr = NULL;
33783 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33784 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
33785 for (size_t m = 0; m < ret_var.datalen; m++) {
33786 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
33787 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
33788 ret_arr_ptr[m] = ret_conv_12_arr;
33791 FREE(ret_var.data);
33795 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) {
33796 LDKPeerManager this_arg_conv;
33797 this_arg_conv.inner = (void*)(this_arg & (~1));
33798 this_arg_conv.is_owned = false;
33799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33800 LDKPublicKey their_node_id_ref;
33801 CHECK(their_node_id->arr_len == 33);
33802 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
33803 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33804 CHECK_ACCESS(descriptor_ptr);
33805 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33806 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33807 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33808 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33810 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33811 CHECK_ACCESS(remote_network_address_ptr);
33812 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33813 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
33814 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
33815 return (uint32_t)ret_conv;
33818 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) {
33819 LDKPeerManager this_arg_conv;
33820 this_arg_conv.inner = (void*)(this_arg & (~1));
33821 this_arg_conv.is_owned = false;
33822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33823 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33824 CHECK_ACCESS(descriptor_ptr);
33825 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33826 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33828 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33830 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
33831 CHECK_ACCESS(remote_network_address_ptr);
33832 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33833 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33834 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
33835 return (uint32_t)ret_conv;
33838 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
33839 LDKPeerManager this_arg_conv;
33840 this_arg_conv.inner = (void*)(this_arg & (~1));
33841 this_arg_conv.is_owned = false;
33842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33843 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33844 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33845 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33846 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33847 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
33848 return (uint32_t)ret_conv;
33851 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
33852 LDKPeerManager this_arg_conv;
33853 this_arg_conv.inner = (void*)(this_arg & (~1));
33854 this_arg_conv.is_owned = false;
33855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33856 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
33857 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
33858 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
33859 LDKu8slice data_ref;
33860 data_ref.datalen = data->arr_len;
33861 data_ref.data = data->elems;
33862 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
33863 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
33865 return (uint32_t)ret_conv;
33868 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
33869 LDKPeerManager 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 PeerManager_process_events(&this_arg_conv);
33876 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
33877 LDKPeerManager this_arg_conv;
33878 this_arg_conv.inner = (void*)(this_arg & (~1));
33879 this_arg_conv.is_owned = false;
33880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33881 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
33882 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
33883 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33884 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
33887 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) {
33888 LDKPeerManager this_arg_conv;
33889 this_arg_conv.inner = (void*)(this_arg & (~1));
33890 this_arg_conv.is_owned = false;
33891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33892 LDKPublicKey node_id_ref;
33893 CHECK(node_id->arr_len == 33);
33894 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
33895 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
33898 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
33899 LDKPeerManager this_arg_conv;
33900 this_arg_conv.inner = (void*)(this_arg & (~1));
33901 this_arg_conv.is_owned = false;
33902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33903 PeerManager_disconnect_all_peers(&this_arg_conv);
33906 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
33907 LDKPeerManager this_arg_conv;
33908 this_arg_conv.inner = (void*)(this_arg & (~1));
33909 this_arg_conv.is_owned = false;
33910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33911 PeerManager_timer_tick_occurred(&this_arg_conv);
33914 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
33915 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
33919 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
33920 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
33924 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
33925 unsigned char commitment_seed_arr[32];
33926 CHECK(commitment_seed->arr_len == 32);
33927 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
33928 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
33929 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33930 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
33934 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) {
33935 LDKCVec_u8Z to_holder_script_ref;
33936 to_holder_script_ref.datalen = to_holder_script->arr_len;
33937 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33938 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33939 LDKCVec_u8Z to_counterparty_script_ref;
33940 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33941 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33942 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33943 LDKOutPoint funding_outpoint_conv;
33944 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
33945 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
33946 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
33947 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
33948 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);
33949 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33950 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33951 Transaction_free(ret_var);
33955 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
33956 LDKCounterpartyCommitmentSecrets this_obj_conv;
33957 this_obj_conv.inner = (void*)(this_obj & (~1));
33958 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33960 CounterpartyCommitmentSecrets_free(this_obj_conv);
33963 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
33964 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
33965 uint32_t ret_ref = 0;
33966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33969 ret_ref = (uintptr_t)ret_var.inner;
33970 if (ret_var.is_owned) {
33975 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
33976 LDKCounterpartyCommitmentSecrets arg_conv;
33977 arg_conv.inner = (void*)(arg & (~1));
33978 arg_conv.is_owned = false;
33979 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33980 uint32_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
33984 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
33985 LDKCounterpartyCommitmentSecrets orig_conv;
33986 orig_conv.inner = (void*)(orig & (~1));
33987 orig_conv.is_owned = false;
33988 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33989 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
33990 uint32_t ret_ref = 0;
33991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33994 ret_ref = (uintptr_t)ret_var.inner;
33995 if (ret_var.is_owned) {
34001 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
34002 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
34003 uint32_t ret_ref = 0;
34004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34007 ret_ref = (uintptr_t)ret_var.inner;
34008 if (ret_var.is_owned) {
34014 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
34015 LDKCounterpartyCommitmentSecrets this_arg_conv;
34016 this_arg_conv.inner = (void*)(this_arg & (~1));
34017 this_arg_conv.is_owned = false;
34018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34019 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
34023 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
34024 LDKCounterpartyCommitmentSecrets this_arg_conv;
34025 this_arg_conv.inner = (void*)(this_arg & (~1));
34026 this_arg_conv.is_owned = false;
34027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34028 LDKThirtyTwoBytes secret_ref;
34029 CHECK(secret->arr_len == 32);
34030 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
34031 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
34032 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
34033 return (uint32_t)ret_conv;
34036 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
34037 LDKCounterpartyCommitmentSecrets this_arg_conv;
34038 this_arg_conv.inner = (void*)(this_arg & (~1));
34039 this_arg_conv.is_owned = false;
34040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34041 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34042 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
34046 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
34047 LDKCounterpartyCommitmentSecrets obj_conv;
34048 obj_conv.inner = (void*)(obj & (~1));
34049 obj_conv.is_owned = false;
34050 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34051 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
34052 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34053 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34054 CVec_u8Z_free(ret_var);
34058 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
34059 LDKu8slice ser_ref;
34060 ser_ref.datalen = ser->arr_len;
34061 ser_ref.data = ser->elems;
34062 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
34063 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
34065 return (uint32_t)ret_conv;
34068 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
34069 LDKPublicKey per_commitment_point_ref;
34070 CHECK(per_commitment_point->arr_len == 33);
34071 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34072 unsigned char base_secret_arr[32];
34073 CHECK(base_secret->arr_len == 32);
34074 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
34075 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
34076 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34077 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
34078 return (uint32_t)ret_conv;
34081 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
34082 LDKPublicKey per_commitment_point_ref;
34083 CHECK(per_commitment_point->arr_len == 33);
34084 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34085 LDKPublicKey base_point_ref;
34086 CHECK(base_point->arr_len == 33);
34087 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
34088 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34089 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
34090 return (uint32_t)ret_conv;
34093 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) {
34094 unsigned char per_commitment_secret_arr[32];
34095 CHECK(per_commitment_secret->arr_len == 32);
34096 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
34097 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
34098 unsigned char countersignatory_revocation_base_secret_arr[32];
34099 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
34100 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
34101 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
34102 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34103 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
34104 return (uint32_t)ret_conv;
34107 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) {
34108 LDKPublicKey per_commitment_point_ref;
34109 CHECK(per_commitment_point->arr_len == 33);
34110 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34111 LDKPublicKey countersignatory_revocation_base_point_ref;
34112 CHECK(countersignatory_revocation_base_point->arr_len == 33);
34113 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
34114 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34115 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
34116 return (uint32_t)ret_conv;
34119 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
34120 LDKTxCreationKeys this_obj_conv;
34121 this_obj_conv.inner = (void*)(this_obj & (~1));
34122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34124 TxCreationKeys_free(this_obj_conv);
34127 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
34128 LDKTxCreationKeys this_ptr_conv;
34129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34130 this_ptr_conv.is_owned = false;
34131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34132 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34133 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
34137 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
34138 LDKTxCreationKeys this_ptr_conv;
34139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34140 this_ptr_conv.is_owned = false;
34141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34142 LDKPublicKey val_ref;
34143 CHECK(val->arr_len == 33);
34144 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34145 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
34148 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
34149 LDKTxCreationKeys this_ptr_conv;
34150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34151 this_ptr_conv.is_owned = false;
34152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34153 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34154 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
34158 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
34159 LDKTxCreationKeys this_ptr_conv;
34160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34161 this_ptr_conv.is_owned = false;
34162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34163 LDKPublicKey val_ref;
34164 CHECK(val->arr_len == 33);
34165 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34166 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
34169 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
34170 LDKTxCreationKeys this_ptr_conv;
34171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34172 this_ptr_conv.is_owned = false;
34173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34174 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34175 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
34179 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
34180 LDKTxCreationKeys this_ptr_conv;
34181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34182 this_ptr_conv.is_owned = false;
34183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34184 LDKPublicKey val_ref;
34185 CHECK(val->arr_len == 33);
34186 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34187 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
34190 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
34191 LDKTxCreationKeys this_ptr_conv;
34192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34193 this_ptr_conv.is_owned = false;
34194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34195 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34196 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
34200 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
34201 LDKTxCreationKeys this_ptr_conv;
34202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34203 this_ptr_conv.is_owned = false;
34204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34205 LDKPublicKey val_ref;
34206 CHECK(val->arr_len == 33);
34207 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34208 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
34211 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
34212 LDKTxCreationKeys this_ptr_conv;
34213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34214 this_ptr_conv.is_owned = false;
34215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34216 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34217 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
34221 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) {
34222 LDKTxCreationKeys this_ptr_conv;
34223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34224 this_ptr_conv.is_owned = false;
34225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34226 LDKPublicKey val_ref;
34227 CHECK(val->arr_len == 33);
34228 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34229 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
34232 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) {
34233 LDKPublicKey per_commitment_point_arg_ref;
34234 CHECK(per_commitment_point_arg->arr_len == 33);
34235 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
34236 LDKPublicKey revocation_key_arg_ref;
34237 CHECK(revocation_key_arg->arr_len == 33);
34238 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
34239 LDKPublicKey broadcaster_htlc_key_arg_ref;
34240 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
34241 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
34242 LDKPublicKey countersignatory_htlc_key_arg_ref;
34243 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
34244 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
34245 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
34246 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
34247 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
34248 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);
34249 uint32_t ret_ref = 0;
34250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34253 ret_ref = (uintptr_t)ret_var.inner;
34254 if (ret_var.is_owned) {
34260 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
34261 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
34262 uint32_t ret_ref = 0;
34263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34266 ret_ref = (uintptr_t)ret_var.inner;
34267 if (ret_var.is_owned) {
34272 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
34273 LDKTxCreationKeys arg_conv;
34274 arg_conv.inner = (void*)(arg & (~1));
34275 arg_conv.is_owned = false;
34276 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34277 uint32_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
34281 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
34282 LDKTxCreationKeys orig_conv;
34283 orig_conv.inner = (void*)(orig & (~1));
34284 orig_conv.is_owned = false;
34285 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34286 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
34287 uint32_t ret_ref = 0;
34288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34291 ret_ref = (uintptr_t)ret_var.inner;
34292 if (ret_var.is_owned) {
34298 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
34299 LDKTxCreationKeys obj_conv;
34300 obj_conv.inner = (void*)(obj & (~1));
34301 obj_conv.is_owned = false;
34302 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34303 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
34304 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34305 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34306 CVec_u8Z_free(ret_var);
34310 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
34311 LDKu8slice ser_ref;
34312 ser_ref.datalen = ser->arr_len;
34313 ser_ref.data = ser->elems;
34314 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
34315 *ret_conv = TxCreationKeys_read(ser_ref);
34317 return (uint32_t)ret_conv;
34320 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
34321 LDKChannelPublicKeys this_obj_conv;
34322 this_obj_conv.inner = (void*)(this_obj & (~1));
34323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34325 ChannelPublicKeys_free(this_obj_conv);
34328 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
34329 LDKChannelPublicKeys this_ptr_conv;
34330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34331 this_ptr_conv.is_owned = false;
34332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34333 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34334 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
34338 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
34339 LDKChannelPublicKeys this_ptr_conv;
34340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34341 this_ptr_conv.is_owned = false;
34342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34343 LDKPublicKey val_ref;
34344 CHECK(val->arr_len == 33);
34345 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34346 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
34349 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
34350 LDKChannelPublicKeys this_ptr_conv;
34351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34352 this_ptr_conv.is_owned = false;
34353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34354 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34355 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
34359 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
34360 LDKChannelPublicKeys this_ptr_conv;
34361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34362 this_ptr_conv.is_owned = false;
34363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34364 LDKPublicKey val_ref;
34365 CHECK(val->arr_len == 33);
34366 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34367 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
34370 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
34371 LDKChannelPublicKeys this_ptr_conv;
34372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34373 this_ptr_conv.is_owned = false;
34374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34375 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34376 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
34380 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
34381 LDKChannelPublicKeys this_ptr_conv;
34382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34383 this_ptr_conv.is_owned = false;
34384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34385 LDKPublicKey val_ref;
34386 CHECK(val->arr_len == 33);
34387 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34388 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
34391 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
34392 LDKChannelPublicKeys this_ptr_conv;
34393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34394 this_ptr_conv.is_owned = false;
34395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34396 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34397 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
34401 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
34402 LDKChannelPublicKeys this_ptr_conv;
34403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34404 this_ptr_conv.is_owned = false;
34405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34406 LDKPublicKey val_ref;
34407 CHECK(val->arr_len == 33);
34408 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34409 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
34412 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
34413 LDKChannelPublicKeys this_ptr_conv;
34414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34415 this_ptr_conv.is_owned = false;
34416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34417 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34418 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
34422 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
34423 LDKChannelPublicKeys this_ptr_conv;
34424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34425 this_ptr_conv.is_owned = false;
34426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34427 LDKPublicKey val_ref;
34428 CHECK(val->arr_len == 33);
34429 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34430 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
34433 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) {
34434 LDKPublicKey funding_pubkey_arg_ref;
34435 CHECK(funding_pubkey_arg->arr_len == 33);
34436 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
34437 LDKPublicKey revocation_basepoint_arg_ref;
34438 CHECK(revocation_basepoint_arg->arr_len == 33);
34439 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
34440 LDKPublicKey payment_point_arg_ref;
34441 CHECK(payment_point_arg->arr_len == 33);
34442 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
34443 LDKPublicKey delayed_payment_basepoint_arg_ref;
34444 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
34445 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
34446 LDKPublicKey htlc_basepoint_arg_ref;
34447 CHECK(htlc_basepoint_arg->arr_len == 33);
34448 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
34449 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);
34450 uint32_t ret_ref = 0;
34451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34454 ret_ref = (uintptr_t)ret_var.inner;
34455 if (ret_var.is_owned) {
34461 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34462 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34463 uint32_t ret_ref = 0;
34464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34467 ret_ref = (uintptr_t)ret_var.inner;
34468 if (ret_var.is_owned) {
34473 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
34474 LDKChannelPublicKeys arg_conv;
34475 arg_conv.inner = (void*)(arg & (~1));
34476 arg_conv.is_owned = false;
34477 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34478 uint32_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
34482 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
34483 LDKChannelPublicKeys orig_conv;
34484 orig_conv.inner = (void*)(orig & (~1));
34485 orig_conv.is_owned = false;
34486 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34487 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34488 uint32_t ret_ref = 0;
34489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34492 ret_ref = (uintptr_t)ret_var.inner;
34493 if (ret_var.is_owned) {
34499 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
34500 LDKChannelPublicKeys obj_conv;
34501 obj_conv.inner = (void*)(obj & (~1));
34502 obj_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34504 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34505 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34506 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34507 CVec_u8Z_free(ret_var);
34511 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
34512 LDKu8slice ser_ref;
34513 ser_ref.datalen = ser->arr_len;
34514 ser_ref.data = ser->elems;
34515 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34516 *ret_conv = ChannelPublicKeys_read(ser_ref);
34518 return (uint32_t)ret_conv;
34521 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) {
34522 LDKPublicKey per_commitment_point_ref;
34523 CHECK(per_commitment_point->arr_len == 33);
34524 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34525 LDKPublicKey broadcaster_delayed_payment_base_ref;
34526 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
34527 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
34528 LDKPublicKey broadcaster_htlc_base_ref;
34529 CHECK(broadcaster_htlc_base->arr_len == 33);
34530 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
34531 LDKPublicKey countersignatory_revocation_base_ref;
34532 CHECK(countersignatory_revocation_base->arr_len == 33);
34533 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
34534 LDKPublicKey countersignatory_htlc_base_ref;
34535 CHECK(countersignatory_htlc_base->arr_len == 33);
34536 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
34537 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34538 *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);
34539 return (uint32_t)ret_conv;
34542 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) {
34543 LDKPublicKey per_commitment_point_ref;
34544 CHECK(per_commitment_point->arr_len == 33);
34545 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34546 LDKChannelPublicKeys broadcaster_keys_conv;
34547 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34548 broadcaster_keys_conv.is_owned = false;
34549 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34550 LDKChannelPublicKeys countersignatory_keys_conv;
34551 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34552 countersignatory_keys_conv.is_owned = false;
34553 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34554 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34555 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34556 return (uint32_t)ret_conv;
34559 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) {
34560 LDKPublicKey revocation_key_ref;
34561 CHECK(revocation_key->arr_len == 33);
34562 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34563 LDKPublicKey broadcaster_delayed_payment_key_ref;
34564 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34565 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34566 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34567 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34568 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34569 CVec_u8Z_free(ret_var);
34573 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
34574 LDKHTLCOutputInCommitment this_obj_conv;
34575 this_obj_conv.inner = (void*)(this_obj & (~1));
34576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34578 HTLCOutputInCommitment_free(this_obj_conv);
34581 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
34582 LDKHTLCOutputInCommitment this_ptr_conv;
34583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34584 this_ptr_conv.is_owned = false;
34585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34586 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34590 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
34591 LDKHTLCOutputInCommitment this_ptr_conv;
34592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34593 this_ptr_conv.is_owned = false;
34594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34595 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34598 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
34599 LDKHTLCOutputInCommitment this_ptr_conv;
34600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34601 this_ptr_conv.is_owned = false;
34602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34603 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34607 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
34608 LDKHTLCOutputInCommitment this_ptr_conv;
34609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34610 this_ptr_conv.is_owned = false;
34611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34612 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34615 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
34616 LDKHTLCOutputInCommitment this_ptr_conv;
34617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34618 this_ptr_conv.is_owned = false;
34619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34620 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34624 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
34625 LDKHTLCOutputInCommitment this_ptr_conv;
34626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34627 this_ptr_conv.is_owned = false;
34628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34629 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34632 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
34633 LDKHTLCOutputInCommitment this_ptr_conv;
34634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34635 this_ptr_conv.is_owned = false;
34636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34637 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34638 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
34642 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
34643 LDKHTLCOutputInCommitment this_ptr_conv;
34644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34645 this_ptr_conv.is_owned = false;
34646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34647 LDKThirtyTwoBytes val_ref;
34648 CHECK(val->arr_len == 32);
34649 memcpy(val_ref.data, val->elems, 32); FREE(val);
34650 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34653 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
34654 LDKHTLCOutputInCommitment this_ptr_conv;
34655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34656 this_ptr_conv.is_owned = false;
34657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34658 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34659 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34660 uint32_t ret_ref = (uintptr_t)ret_copy;
34664 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
34665 LDKHTLCOutputInCommitment this_ptr_conv;
34666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34667 this_ptr_conv.is_owned = false;
34668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34669 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34670 CHECK_ACCESS(val_ptr);
34671 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34672 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
34673 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34676 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) {
34677 LDKThirtyTwoBytes payment_hash_arg_ref;
34678 CHECK(payment_hash_arg->arr_len == 32);
34679 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
34680 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
34681 CHECK_ACCESS(transaction_output_index_arg_ptr);
34682 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34683 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
34684 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34685 uint32_t ret_ref = 0;
34686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34689 ret_ref = (uintptr_t)ret_var.inner;
34690 if (ret_var.is_owned) {
34696 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34697 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34698 uint32_t ret_ref = 0;
34699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34702 ret_ref = (uintptr_t)ret_var.inner;
34703 if (ret_var.is_owned) {
34708 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
34709 LDKHTLCOutputInCommitment arg_conv;
34710 arg_conv.inner = (void*)(arg & (~1));
34711 arg_conv.is_owned = false;
34712 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34713 uint32_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34717 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
34718 LDKHTLCOutputInCommitment orig_conv;
34719 orig_conv.inner = (void*)(orig & (~1));
34720 orig_conv.is_owned = false;
34721 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34722 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34723 uint32_t ret_ref = 0;
34724 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34725 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34727 ret_ref = (uintptr_t)ret_var.inner;
34728 if (ret_var.is_owned) {
34734 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
34735 LDKHTLCOutputInCommitment obj_conv;
34736 obj_conv.inner = (void*)(obj & (~1));
34737 obj_conv.is_owned = false;
34738 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34739 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34740 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34741 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34742 CVec_u8Z_free(ret_var);
34746 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
34747 LDKu8slice ser_ref;
34748 ser_ref.datalen = ser->arr_len;
34749 ser_ref.data = ser->elems;
34750 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34751 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34753 return (uint32_t)ret_conv;
34756 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
34757 LDKHTLCOutputInCommitment htlc_conv;
34758 htlc_conv.inner = (void*)(htlc & (~1));
34759 htlc_conv.is_owned = false;
34760 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34761 LDKTxCreationKeys keys_conv;
34762 keys_conv.inner = (void*)(keys & (~1));
34763 keys_conv.is_owned = false;
34764 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34765 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34766 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34767 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34768 CVec_u8Z_free(ret_var);
34772 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
34773 LDKPublicKey broadcaster_ref;
34774 CHECK(broadcaster->arr_len == 33);
34775 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
34776 LDKPublicKey countersignatory_ref;
34777 CHECK(countersignatory->arr_len == 33);
34778 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
34779 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34780 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34781 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34782 CVec_u8Z_free(ret_var);
34786 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) {
34787 unsigned char commitment_txid_arr[32];
34788 CHECK(commitment_txid->arr_len == 32);
34789 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
34790 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34791 LDKHTLCOutputInCommitment htlc_conv;
34792 htlc_conv.inner = (void*)(htlc & (~1));
34793 htlc_conv.is_owned = false;
34794 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34795 LDKPublicKey broadcaster_delayed_payment_key_ref;
34796 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34797 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34798 LDKPublicKey revocation_key_ref;
34799 CHECK(revocation_key->arr_len == 33);
34800 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34801 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);
34802 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34803 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34804 Transaction_free(ret_var);
34808 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
34809 LDKPublicKey funding_pubkey_ref;
34810 CHECK(funding_pubkey->arr_len == 33);
34811 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
34812 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34813 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34814 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34815 CVec_u8Z_free(ret_var);
34819 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
34820 LDKChannelTransactionParameters this_obj_conv;
34821 this_obj_conv.inner = (void*)(this_obj & (~1));
34822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34824 ChannelTransactionParameters_free(this_obj_conv);
34827 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
34828 LDKChannelTransactionParameters this_ptr_conv;
34829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34830 this_ptr_conv.is_owned = false;
34831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34832 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34833 uint32_t ret_ref = 0;
34834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34837 ret_ref = (uintptr_t)ret_var.inner;
34838 if (ret_var.is_owned) {
34844 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
34845 LDKChannelTransactionParameters this_ptr_conv;
34846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34847 this_ptr_conv.is_owned = false;
34848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34849 LDKChannelPublicKeys val_conv;
34850 val_conv.inner = (void*)(val & (~1));
34851 val_conv.is_owned = (val & 1) || (val == 0);
34852 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34853 val_conv = ChannelPublicKeys_clone(&val_conv);
34854 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34857 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
34858 LDKChannelTransactionParameters this_ptr_conv;
34859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34860 this_ptr_conv.is_owned = false;
34861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34862 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34866 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) {
34867 LDKChannelTransactionParameters this_ptr_conv;
34868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34869 this_ptr_conv.is_owned = false;
34870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34871 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34874 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
34875 LDKChannelTransactionParameters this_ptr_conv;
34876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34877 this_ptr_conv.is_owned = false;
34878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34879 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34883 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
34884 LDKChannelTransactionParameters this_ptr_conv;
34885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34886 this_ptr_conv.is_owned = false;
34887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34888 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34891 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
34892 LDKChannelTransactionParameters this_ptr_conv;
34893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34894 this_ptr_conv.is_owned = false;
34895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34896 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
34897 uint32_t ret_ref = 0;
34898 if ((uintptr_t)ret_var.inner > 4096) {
34899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34902 ret_ref = (uintptr_t)ret_var.inner;
34903 if (ret_var.is_owned) {
34910 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
34911 LDKChannelTransactionParameters this_ptr_conv;
34912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34913 this_ptr_conv.is_owned = false;
34914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34915 LDKCounterpartyChannelTransactionParameters val_conv;
34916 val_conv.inner = (void*)(val & (~1));
34917 val_conv.is_owned = (val & 1) || (val == 0);
34918 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34919 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
34920 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
34923 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
34924 LDKChannelTransactionParameters this_ptr_conv;
34925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34926 this_ptr_conv.is_owned = false;
34927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34928 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
34929 uint32_t ret_ref = 0;
34930 if ((uintptr_t)ret_var.inner > 4096) {
34931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34934 ret_ref = (uintptr_t)ret_var.inner;
34935 if (ret_var.is_owned) {
34942 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
34943 LDKChannelTransactionParameters this_ptr_conv;
34944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34945 this_ptr_conv.is_owned = false;
34946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34947 LDKOutPoint val_conv;
34948 val_conv.inner = (void*)(val & (~1));
34949 val_conv.is_owned = (val & 1) || (val == 0);
34950 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34951 val_conv = OutPoint_clone(&val_conv);
34952 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
34955 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
34956 LDKChannelTransactionParameters this_ptr_conv;
34957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34958 this_ptr_conv.is_owned = false;
34959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34960 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
34964 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
34965 LDKChannelTransactionParameters this_ptr_conv;
34966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34967 this_ptr_conv.is_owned = false;
34968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34969 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
34970 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
34973 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) {
34974 LDKChannelPublicKeys holder_pubkeys_arg_conv;
34975 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
34976 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
34977 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
34978 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
34979 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
34980 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
34981 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
34982 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
34983 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
34984 LDKOutPoint funding_outpoint_arg_conv;
34985 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
34986 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
34987 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
34988 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
34989 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
34990 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);
34991 uint32_t ret_ref = 0;
34992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34995 ret_ref = (uintptr_t)ret_var.inner;
34996 if (ret_var.is_owned) {
35002 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
35003 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
35004 uint32_t ret_ref = 0;
35005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35008 ret_ref = (uintptr_t)ret_var.inner;
35009 if (ret_var.is_owned) {
35014 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
35015 LDKChannelTransactionParameters arg_conv;
35016 arg_conv.inner = (void*)(arg & (~1));
35017 arg_conv.is_owned = false;
35018 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35019 uint32_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
35023 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
35024 LDKChannelTransactionParameters orig_conv;
35025 orig_conv.inner = (void*)(orig & (~1));
35026 orig_conv.is_owned = false;
35027 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35028 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
35029 uint32_t ret_ref = 0;
35030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35033 ret_ref = (uintptr_t)ret_var.inner;
35034 if (ret_var.is_owned) {
35040 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
35041 LDKCounterpartyChannelTransactionParameters this_obj_conv;
35042 this_obj_conv.inner = (void*)(this_obj & (~1));
35043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35045 CounterpartyChannelTransactionParameters_free(this_obj_conv);
35048 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
35049 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35051 this_ptr_conv.is_owned = false;
35052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35053 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
35054 uint32_t ret_ref = 0;
35055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35058 ret_ref = (uintptr_t)ret_var.inner;
35059 if (ret_var.is_owned) {
35065 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
35066 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35068 this_ptr_conv.is_owned = false;
35069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35070 LDKChannelPublicKeys val_conv;
35071 val_conv.inner = (void*)(val & (~1));
35072 val_conv.is_owned = (val & 1) || (val == 0);
35073 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35074 val_conv = ChannelPublicKeys_clone(&val_conv);
35075 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
35078 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
35079 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35081 this_ptr_conv.is_owned = false;
35082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35083 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
35087 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
35088 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35090 this_ptr_conv.is_owned = false;
35091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35092 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
35095 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
35096 LDKChannelPublicKeys pubkeys_arg_conv;
35097 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
35098 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
35099 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
35100 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
35101 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
35102 uint32_t ret_ref = 0;
35103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35106 ret_ref = (uintptr_t)ret_var.inner;
35107 if (ret_var.is_owned) {
35113 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
35114 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
35115 uint32_t ret_ref = 0;
35116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35119 ret_ref = (uintptr_t)ret_var.inner;
35120 if (ret_var.is_owned) {
35125 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
35126 LDKCounterpartyChannelTransactionParameters arg_conv;
35127 arg_conv.inner = (void*)(arg & (~1));
35128 arg_conv.is_owned = false;
35129 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35130 uint32_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
35134 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
35135 LDKCounterpartyChannelTransactionParameters orig_conv;
35136 orig_conv.inner = (void*)(orig & (~1));
35137 orig_conv.is_owned = false;
35138 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35139 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
35140 uint32_t ret_ref = 0;
35141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35144 ret_ref = (uintptr_t)ret_var.inner;
35145 if (ret_var.is_owned) {
35151 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
35152 LDKChannelTransactionParameters this_arg_conv;
35153 this_arg_conv.inner = (void*)(this_arg & (~1));
35154 this_arg_conv.is_owned = false;
35155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35156 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
35160 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
35161 LDKChannelTransactionParameters this_arg_conv;
35162 this_arg_conv.inner = (void*)(this_arg & (~1));
35163 this_arg_conv.is_owned = false;
35164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35165 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
35166 uint32_t ret_ref = 0;
35167 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35168 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35170 ret_ref = (uintptr_t)ret_var.inner;
35171 if (ret_var.is_owned) {
35177 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
35178 LDKChannelTransactionParameters this_arg_conv;
35179 this_arg_conv.inner = (void*)(this_arg & (~1));
35180 this_arg_conv.is_owned = false;
35181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35182 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
35183 uint32_t ret_ref = 0;
35184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35187 ret_ref = (uintptr_t)ret_var.inner;
35188 if (ret_var.is_owned) {
35194 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
35195 LDKCounterpartyChannelTransactionParameters obj_conv;
35196 obj_conv.inner = (void*)(obj & (~1));
35197 obj_conv.is_owned = false;
35198 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35199 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
35200 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35201 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35202 CVec_u8Z_free(ret_var);
35206 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
35207 LDKu8slice ser_ref;
35208 ser_ref.datalen = ser->arr_len;
35209 ser_ref.data = ser->elems;
35210 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
35211 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
35213 return (uint32_t)ret_conv;
35216 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
35217 LDKChannelTransactionParameters obj_conv;
35218 obj_conv.inner = (void*)(obj & (~1));
35219 obj_conv.is_owned = false;
35220 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35221 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
35222 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35223 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35224 CVec_u8Z_free(ret_var);
35228 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
35229 LDKu8slice ser_ref;
35230 ser_ref.datalen = ser->arr_len;
35231 ser_ref.data = ser->elems;
35232 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
35233 *ret_conv = ChannelTransactionParameters_read(ser_ref);
35235 return (uint32_t)ret_conv;
35238 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
35239 LDKDirectedChannelTransactionParameters this_obj_conv;
35240 this_obj_conv.inner = (void*)(this_obj & (~1));
35241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35243 DirectedChannelTransactionParameters_free(this_obj_conv);
35246 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
35247 LDKDirectedChannelTransactionParameters this_arg_conv;
35248 this_arg_conv.inner = (void*)(this_arg & (~1));
35249 this_arg_conv.is_owned = false;
35250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35251 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
35252 uint32_t ret_ref = 0;
35253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35256 ret_ref = (uintptr_t)ret_var.inner;
35257 if (ret_var.is_owned) {
35263 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
35264 LDKDirectedChannelTransactionParameters this_arg_conv;
35265 this_arg_conv.inner = (void*)(this_arg & (~1));
35266 this_arg_conv.is_owned = false;
35267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35268 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
35269 uint32_t ret_ref = 0;
35270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35273 ret_ref = (uintptr_t)ret_var.inner;
35274 if (ret_var.is_owned) {
35280 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
35281 LDKDirectedChannelTransactionParameters this_arg_conv;
35282 this_arg_conv.inner = (void*)(this_arg & (~1));
35283 this_arg_conv.is_owned = false;
35284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35285 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
35289 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
35290 LDKDirectedChannelTransactionParameters this_arg_conv;
35291 this_arg_conv.inner = (void*)(this_arg & (~1));
35292 this_arg_conv.is_owned = false;
35293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35294 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
35298 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
35299 LDKDirectedChannelTransactionParameters this_arg_conv;
35300 this_arg_conv.inner = (void*)(this_arg & (~1));
35301 this_arg_conv.is_owned = false;
35302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35303 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
35304 uint32_t ret_ref = 0;
35305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35308 ret_ref = (uintptr_t)ret_var.inner;
35309 if (ret_var.is_owned) {
35315 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
35316 LDKDirectedChannelTransactionParameters this_arg_conv;
35317 this_arg_conv.inner = (void*)(this_arg & (~1));
35318 this_arg_conv.is_owned = false;
35319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35320 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
35324 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
35325 LDKHolderCommitmentTransaction this_obj_conv;
35326 this_obj_conv.inner = (void*)(this_obj & (~1));
35327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35329 HolderCommitmentTransaction_free(this_obj_conv);
35332 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
35333 LDKHolderCommitmentTransaction this_ptr_conv;
35334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35335 this_ptr_conv.is_owned = false;
35336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35337 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35338 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
35342 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
35343 LDKHolderCommitmentTransaction this_ptr_conv;
35344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35345 this_ptr_conv.is_owned = false;
35346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35347 LDKSignature val_ref;
35348 CHECK(val->arr_len == 64);
35349 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35350 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
35353 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
35354 LDKHolderCommitmentTransaction this_ptr_conv;
35355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35356 this_ptr_conv.is_owned = false;
35357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35358 LDKCVec_SignatureZ val_constr;
35359 val_constr.datalen = val->arr_len;
35360 if (val_constr.datalen > 0)
35361 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35363 val_constr.data = NULL;
35364 int8_tArray* val_vals = (void*) val->elems;
35365 for (size_t m = 0; m < val_constr.datalen; m++) {
35366 int8_tArray val_conv_12 = val_vals[m];
35367 LDKSignature val_conv_12_ref;
35368 CHECK(val_conv_12->arr_len == 64);
35369 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
35370 val_constr.data[m] = val_conv_12_ref;
35373 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
35376 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
35377 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
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) {
35388 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
35389 LDKHolderCommitmentTransaction arg_conv;
35390 arg_conv.inner = (void*)(arg & (~1));
35391 arg_conv.is_owned = false;
35392 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35393 uint32_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
35397 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
35398 LDKHolderCommitmentTransaction orig_conv;
35399 orig_conv.inner = (void*)(orig & (~1));
35400 orig_conv.is_owned = false;
35401 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35402 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
35403 uint32_t ret_ref = 0;
35404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35407 ret_ref = (uintptr_t)ret_var.inner;
35408 if (ret_var.is_owned) {
35414 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
35415 LDKHolderCommitmentTransaction obj_conv;
35416 obj_conv.inner = (void*)(obj & (~1));
35417 obj_conv.is_owned = false;
35418 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35419 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
35420 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35421 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35422 CVec_u8Z_free(ret_var);
35426 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
35427 LDKu8slice ser_ref;
35428 ser_ref.datalen = ser->arr_len;
35429 ser_ref.data = ser->elems;
35430 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
35431 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
35433 return (uint32_t)ret_conv;
35436 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) {
35437 LDKCommitmentTransaction commitment_tx_conv;
35438 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
35439 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
35440 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
35441 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
35442 LDKSignature counterparty_sig_ref;
35443 CHECK(counterparty_sig->arr_len == 64);
35444 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
35445 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
35446 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
35447 if (counterparty_htlc_sigs_constr.datalen > 0)
35448 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35450 counterparty_htlc_sigs_constr.data = NULL;
35451 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
35452 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
35453 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
35454 LDKSignature counterparty_htlc_sigs_conv_12_ref;
35455 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
35456 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
35457 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
35459 FREE(counterparty_htlc_sigs);
35460 LDKPublicKey holder_funding_key_ref;
35461 CHECK(holder_funding_key->arr_len == 33);
35462 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
35463 LDKPublicKey counterparty_funding_key_ref;
35464 CHECK(counterparty_funding_key->arr_len == 33);
35465 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
35466 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
35467 uint32_t ret_ref = 0;
35468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35471 ret_ref = (uintptr_t)ret_var.inner;
35472 if (ret_var.is_owned) {
35478 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
35479 LDKBuiltCommitmentTransaction 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 BuiltCommitmentTransaction_free(this_obj_conv);
35486 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
35487 LDKBuiltCommitmentTransaction this_ptr_conv;
35488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35489 this_ptr_conv.is_owned = false;
35490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35491 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35492 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35493 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35494 Transaction_free(ret_var);
35498 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
35499 LDKBuiltCommitmentTransaction this_ptr_conv;
35500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35501 this_ptr_conv.is_owned = false;
35502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35503 LDKTransaction val_ref;
35504 val_ref.datalen = val->arr_len;
35505 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35506 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35507 val_ref.data_is_owned = true;
35508 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35511 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
35512 LDKBuiltCommitmentTransaction this_ptr_conv;
35513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35514 this_ptr_conv.is_owned = false;
35515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35516 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35517 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
35521 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
35522 LDKBuiltCommitmentTransaction this_ptr_conv;
35523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35524 this_ptr_conv.is_owned = false;
35525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35526 LDKThirtyTwoBytes val_ref;
35527 CHECK(val->arr_len == 32);
35528 memcpy(val_ref.data, val->elems, 32); FREE(val);
35529 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35532 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
35533 LDKTransaction transaction_arg_ref;
35534 transaction_arg_ref.datalen = transaction_arg->arr_len;
35535 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35536 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
35537 transaction_arg_ref.data_is_owned = true;
35538 LDKThirtyTwoBytes txid_arg_ref;
35539 CHECK(txid_arg->arr_len == 32);
35540 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35541 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35542 uint32_t ret_ref = 0;
35543 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35544 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35546 ret_ref = (uintptr_t)ret_var.inner;
35547 if (ret_var.is_owned) {
35553 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35554 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35555 uint32_t ret_ref = 0;
35556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35559 ret_ref = (uintptr_t)ret_var.inner;
35560 if (ret_var.is_owned) {
35565 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
35566 LDKBuiltCommitmentTransaction arg_conv;
35567 arg_conv.inner = (void*)(arg & (~1));
35568 arg_conv.is_owned = false;
35569 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35570 uint32_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35574 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
35575 LDKBuiltCommitmentTransaction orig_conv;
35576 orig_conv.inner = (void*)(orig & (~1));
35577 orig_conv.is_owned = false;
35578 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35579 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35580 uint32_t ret_ref = 0;
35581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35584 ret_ref = (uintptr_t)ret_var.inner;
35585 if (ret_var.is_owned) {
35591 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
35592 LDKBuiltCommitmentTransaction obj_conv;
35593 obj_conv.inner = (void*)(obj & (~1));
35594 obj_conv.is_owned = false;
35595 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35596 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35597 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35598 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35599 CVec_u8Z_free(ret_var);
35603 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
35604 LDKu8slice ser_ref;
35605 ser_ref.datalen = ser->arr_len;
35606 ser_ref.data = ser->elems;
35607 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35608 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35610 return (uint32_t)ret_conv;
35613 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) {
35614 LDKBuiltCommitmentTransaction this_arg_conv;
35615 this_arg_conv.inner = (void*)(this_arg & (~1));
35616 this_arg_conv.is_owned = false;
35617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35618 LDKu8slice funding_redeemscript_ref;
35619 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35620 funding_redeemscript_ref.data = funding_redeemscript->elems;
35621 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35622 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35623 FREE(funding_redeemscript);
35627 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) {
35628 LDKBuiltCommitmentTransaction this_arg_conv;
35629 this_arg_conv.inner = (void*)(this_arg & (~1));
35630 this_arg_conv.is_owned = false;
35631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35632 unsigned char funding_key_arr[32];
35633 CHECK(funding_key->arr_len == 32);
35634 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35635 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35636 LDKu8slice funding_redeemscript_ref;
35637 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35638 funding_redeemscript_ref.data = funding_redeemscript->elems;
35639 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35640 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35641 FREE(funding_redeemscript);
35645 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
35646 LDKClosingTransaction this_obj_conv;
35647 this_obj_conv.inner = (void*)(this_obj & (~1));
35648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35650 ClosingTransaction_free(this_obj_conv);
35653 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35654 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35655 uint32_t ret_ref = 0;
35656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35659 ret_ref = (uintptr_t)ret_var.inner;
35660 if (ret_var.is_owned) {
35665 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
35666 LDKClosingTransaction arg_conv;
35667 arg_conv.inner = (void*)(arg & (~1));
35668 arg_conv.is_owned = false;
35669 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35670 uint32_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
35674 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
35675 LDKClosingTransaction orig_conv;
35676 orig_conv.inner = (void*)(orig & (~1));
35677 orig_conv.is_owned = false;
35678 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35679 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35680 uint32_t ret_ref = 0;
35681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35684 ret_ref = (uintptr_t)ret_var.inner;
35685 if (ret_var.is_owned) {
35691 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
35692 LDKClosingTransaction o_conv;
35693 o_conv.inner = (void*)(o & (~1));
35694 o_conv.is_owned = false;
35695 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35696 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
35700 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) {
35701 LDKCVec_u8Z to_holder_script_ref;
35702 to_holder_script_ref.datalen = to_holder_script->arr_len;
35703 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35704 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35705 LDKCVec_u8Z to_counterparty_script_ref;
35706 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35707 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35708 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35709 LDKOutPoint funding_outpoint_conv;
35710 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35711 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35712 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35713 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35714 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35715 uint32_t ret_ref = 0;
35716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35719 ret_ref = (uintptr_t)ret_var.inner;
35720 if (ret_var.is_owned) {
35726 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
35727 LDKClosingTransaction this_arg_conv;
35728 this_arg_conv.inner = (void*)(this_arg & (~1));
35729 this_arg_conv.is_owned = false;
35730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35731 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35732 uint32_t ret_ref = 0;
35733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35736 ret_ref = (uintptr_t)ret_var.inner;
35737 if (ret_var.is_owned) {
35743 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
35744 LDKClosingTransaction this_arg_conv;
35745 this_arg_conv.inner = (void*)(this_arg & (~1));
35746 this_arg_conv.is_owned = false;
35747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35748 LDKOutPoint funding_outpoint_conv;
35749 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35750 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35751 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35752 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35753 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35754 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35755 return (uint32_t)ret_conv;
35758 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
35759 LDKClosingTransaction this_arg_conv;
35760 this_arg_conv.inner = (void*)(this_arg & (~1));
35761 this_arg_conv.is_owned = false;
35762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35763 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35767 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
35768 LDKClosingTransaction this_arg_conv;
35769 this_arg_conv.inner = (void*)(this_arg & (~1));
35770 this_arg_conv.is_owned = false;
35771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35772 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35776 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
35777 LDKClosingTransaction this_arg_conv;
35778 this_arg_conv.inner = (void*)(this_arg & (~1));
35779 this_arg_conv.is_owned = false;
35780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35781 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35782 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35783 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35787 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
35788 LDKClosingTransaction this_arg_conv;
35789 this_arg_conv.inner = (void*)(this_arg & (~1));
35790 this_arg_conv.is_owned = false;
35791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35792 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35793 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35794 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35798 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
35799 LDKTrustedClosingTransaction this_obj_conv;
35800 this_obj_conv.inner = (void*)(this_obj & (~1));
35801 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35803 TrustedClosingTransaction_free(this_obj_conv);
35806 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
35807 LDKTrustedClosingTransaction this_arg_conv;
35808 this_arg_conv.inner = (void*)(this_arg & (~1));
35809 this_arg_conv.is_owned = false;
35810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35811 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35812 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35813 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35814 Transaction_free(ret_var);
35818 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) {
35819 LDKTrustedClosingTransaction this_arg_conv;
35820 this_arg_conv.inner = (void*)(this_arg & (~1));
35821 this_arg_conv.is_owned = false;
35822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35823 LDKu8slice funding_redeemscript_ref;
35824 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35825 funding_redeemscript_ref.data = funding_redeemscript->elems;
35826 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35827 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35828 FREE(funding_redeemscript);
35832 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) {
35833 LDKTrustedClosingTransaction this_arg_conv;
35834 this_arg_conv.inner = (void*)(this_arg & (~1));
35835 this_arg_conv.is_owned = false;
35836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35837 unsigned char funding_key_arr[32];
35838 CHECK(funding_key->arr_len == 32);
35839 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35840 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35841 LDKu8slice funding_redeemscript_ref;
35842 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35843 funding_redeemscript_ref.data = funding_redeemscript->elems;
35844 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35845 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35846 FREE(funding_redeemscript);
35850 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
35851 LDKCommitmentTransaction this_obj_conv;
35852 this_obj_conv.inner = (void*)(this_obj & (~1));
35853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35855 CommitmentTransaction_free(this_obj_conv);
35858 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35859 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35860 uint32_t ret_ref = 0;
35861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35864 ret_ref = (uintptr_t)ret_var.inner;
35865 if (ret_var.is_owned) {
35870 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
35871 LDKCommitmentTransaction arg_conv;
35872 arg_conv.inner = (void*)(arg & (~1));
35873 arg_conv.is_owned = false;
35874 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35875 uint32_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
35879 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
35880 LDKCommitmentTransaction orig_conv;
35881 orig_conv.inner = (void*)(orig & (~1));
35882 orig_conv.is_owned = false;
35883 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35884 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35885 uint32_t ret_ref = 0;
35886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35889 ret_ref = (uintptr_t)ret_var.inner;
35890 if (ret_var.is_owned) {
35896 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
35897 LDKCommitmentTransaction obj_conv;
35898 obj_conv.inner = (void*)(obj & (~1));
35899 obj_conv.is_owned = false;
35900 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35901 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
35902 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35903 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35904 CVec_u8Z_free(ret_var);
35908 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
35909 LDKu8slice ser_ref;
35910 ser_ref.datalen = ser->arr_len;
35911 ser_ref.data = ser->elems;
35912 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
35913 *ret_conv = CommitmentTransaction_read(ser_ref);
35915 return (uint32_t)ret_conv;
35918 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
35919 LDKCommitmentTransaction this_arg_conv;
35920 this_arg_conv.inner = (void*)(this_arg & (~1));
35921 this_arg_conv.is_owned = false;
35922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35923 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
35927 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
35928 LDKCommitmentTransaction this_arg_conv;
35929 this_arg_conv.inner = (void*)(this_arg & (~1));
35930 this_arg_conv.is_owned = false;
35931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35932 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
35936 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
35937 LDKCommitmentTransaction this_arg_conv;
35938 this_arg_conv.inner = (void*)(this_arg & (~1));
35939 this_arg_conv.is_owned = false;
35940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35941 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
35945 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
35946 LDKCommitmentTransaction this_arg_conv;
35947 this_arg_conv.inner = (void*)(this_arg & (~1));
35948 this_arg_conv.is_owned = false;
35949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35950 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
35954 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
35955 LDKCommitmentTransaction this_arg_conv;
35956 this_arg_conv.inner = (void*)(this_arg & (~1));
35957 this_arg_conv.is_owned = false;
35958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35959 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
35960 uint32_t ret_ref = 0;
35961 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35962 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35964 ret_ref = (uintptr_t)ret_var.inner;
35965 if (ret_var.is_owned) {
35971 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) {
35972 LDKCommitmentTransaction this_arg_conv;
35973 this_arg_conv.inner = (void*)(this_arg & (~1));
35974 this_arg_conv.is_owned = false;
35975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35976 LDKDirectedChannelTransactionParameters channel_parameters_conv;
35977 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
35978 channel_parameters_conv.is_owned = false;
35979 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35980 LDKChannelPublicKeys broadcaster_keys_conv;
35981 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
35982 broadcaster_keys_conv.is_owned = false;
35983 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35984 LDKChannelPublicKeys countersignatory_keys_conv;
35985 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
35986 countersignatory_keys_conv.is_owned = false;
35987 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35988 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
35989 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
35990 return (uint32_t)ret_conv;
35993 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
35994 LDKTrustedCommitmentTransaction this_obj_conv;
35995 this_obj_conv.inner = (void*)(this_obj & (~1));
35996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35998 TrustedCommitmentTransaction_free(this_obj_conv);
36001 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
36002 LDKTrustedCommitmentTransaction this_arg_conv;
36003 this_arg_conv.inner = (void*)(this_arg & (~1));
36004 this_arg_conv.is_owned = false;
36005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36006 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36007 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
36011 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
36012 LDKTrustedCommitmentTransaction this_arg_conv;
36013 this_arg_conv.inner = (void*)(this_arg & (~1));
36014 this_arg_conv.is_owned = false;
36015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36016 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
36017 uint32_t ret_ref = 0;
36018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36021 ret_ref = (uintptr_t)ret_var.inner;
36022 if (ret_var.is_owned) {
36028 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
36029 LDKTrustedCommitmentTransaction this_arg_conv;
36030 this_arg_conv.inner = (void*)(this_arg & (~1));
36031 this_arg_conv.is_owned = false;
36032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36033 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
36034 uint32_t ret_ref = 0;
36035 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36036 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36038 ret_ref = (uintptr_t)ret_var.inner;
36039 if (ret_var.is_owned) {
36045 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
36046 LDKTrustedCommitmentTransaction this_arg_conv;
36047 this_arg_conv.inner = (void*)(this_arg & (~1));
36048 this_arg_conv.is_owned = false;
36049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36050 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
36054 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) {
36055 LDKTrustedCommitmentTransaction this_arg_conv;
36056 this_arg_conv.inner = (void*)(this_arg & (~1));
36057 this_arg_conv.is_owned = false;
36058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36059 unsigned char htlc_base_key_arr[32];
36060 CHECK(htlc_base_key->arr_len == 32);
36061 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
36062 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
36063 LDKDirectedChannelTransactionParameters channel_parameters_conv;
36064 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
36065 channel_parameters_conv.is_owned = false;
36066 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
36067 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
36068 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
36069 return (uint32_t)ret_conv;
36072 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) {
36073 LDKPublicKey broadcaster_payment_basepoint_ref;
36074 CHECK(broadcaster_payment_basepoint->arr_len == 33);
36075 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
36076 LDKPublicKey countersignatory_payment_basepoint_ref;
36077 CHECK(countersignatory_payment_basepoint->arr_len == 33);
36078 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
36079 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
36083 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
36084 LDKInitFeatures a_conv;
36085 a_conv.inner = (void*)(a & (~1));
36086 a_conv.is_owned = false;
36087 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36088 LDKInitFeatures b_conv;
36089 b_conv.inner = (void*)(b & (~1));
36090 b_conv.is_owned = false;
36091 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36092 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
36096 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
36097 LDKNodeFeatures a_conv;
36098 a_conv.inner = (void*)(a & (~1));
36099 a_conv.is_owned = false;
36100 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36101 LDKNodeFeatures b_conv;
36102 b_conv.inner = (void*)(b & (~1));
36103 b_conv.is_owned = false;
36104 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36105 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
36109 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
36110 LDKChannelFeatures a_conv;
36111 a_conv.inner = (void*)(a & (~1));
36112 a_conv.is_owned = false;
36113 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36114 LDKChannelFeatures b_conv;
36115 b_conv.inner = (void*)(b & (~1));
36116 b_conv.is_owned = false;
36117 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36118 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
36122 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
36123 LDKInvoiceFeatures a_conv;
36124 a_conv.inner = (void*)(a & (~1));
36125 a_conv.is_owned = false;
36126 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36127 LDKInvoiceFeatures b_conv;
36128 b_conv.inner = (void*)(b & (~1));
36129 b_conv.is_owned = false;
36130 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36131 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
36135 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
36136 LDKChannelTypeFeatures a_conv;
36137 a_conv.inner = (void*)(a & (~1));
36138 a_conv.is_owned = false;
36139 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36140 LDKChannelTypeFeatures b_conv;
36141 b_conv.inner = (void*)(b & (~1));
36142 b_conv.is_owned = false;
36143 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36144 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
36148 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
36149 LDKInitFeatures ret_var = InitFeatures_clone(arg);
36150 uint32_t ret_ref = 0;
36151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36154 ret_ref = (uintptr_t)ret_var.inner;
36155 if (ret_var.is_owned) {
36160 uint32_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
36161 LDKInitFeatures arg_conv;
36162 arg_conv.inner = (void*)(arg & (~1));
36163 arg_conv.is_owned = false;
36164 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36165 uint32_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
36169 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
36170 LDKInitFeatures orig_conv;
36171 orig_conv.inner = (void*)(orig & (~1));
36172 orig_conv.is_owned = false;
36173 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36174 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
36175 uint32_t ret_ref = 0;
36176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36179 ret_ref = (uintptr_t)ret_var.inner;
36180 if (ret_var.is_owned) {
36186 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
36187 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
36188 uint32_t ret_ref = 0;
36189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36192 ret_ref = (uintptr_t)ret_var.inner;
36193 if (ret_var.is_owned) {
36198 uint32_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
36199 LDKNodeFeatures arg_conv;
36200 arg_conv.inner = (void*)(arg & (~1));
36201 arg_conv.is_owned = false;
36202 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36203 uint32_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
36207 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
36208 LDKNodeFeatures orig_conv;
36209 orig_conv.inner = (void*)(orig & (~1));
36210 orig_conv.is_owned = false;
36211 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36212 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
36213 uint32_t ret_ref = 0;
36214 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36215 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36216 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36217 ret_ref = (uintptr_t)ret_var.inner;
36218 if (ret_var.is_owned) {
36224 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
36225 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
36226 uint32_t ret_ref = 0;
36227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36230 ret_ref = (uintptr_t)ret_var.inner;
36231 if (ret_var.is_owned) {
36236 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
36237 LDKChannelFeatures arg_conv;
36238 arg_conv.inner = (void*)(arg & (~1));
36239 arg_conv.is_owned = false;
36240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36241 uint32_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
36245 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
36246 LDKChannelFeatures orig_conv;
36247 orig_conv.inner = (void*)(orig & (~1));
36248 orig_conv.is_owned = false;
36249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36250 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
36251 uint32_t ret_ref = 0;
36252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36255 ret_ref = (uintptr_t)ret_var.inner;
36256 if (ret_var.is_owned) {
36262 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
36263 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
36264 uint32_t ret_ref = 0;
36265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36268 ret_ref = (uintptr_t)ret_var.inner;
36269 if (ret_var.is_owned) {
36274 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
36275 LDKInvoiceFeatures arg_conv;
36276 arg_conv.inner = (void*)(arg & (~1));
36277 arg_conv.is_owned = false;
36278 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36279 uint32_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
36283 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
36284 LDKInvoiceFeatures orig_conv;
36285 orig_conv.inner = (void*)(orig & (~1));
36286 orig_conv.is_owned = false;
36287 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36288 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
36289 uint32_t ret_ref = 0;
36290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36293 ret_ref = (uintptr_t)ret_var.inner;
36294 if (ret_var.is_owned) {
36300 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
36301 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
36302 uint32_t ret_ref = 0;
36303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36306 ret_ref = (uintptr_t)ret_var.inner;
36307 if (ret_var.is_owned) {
36312 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
36313 LDKChannelTypeFeatures arg_conv;
36314 arg_conv.inner = (void*)(arg & (~1));
36315 arg_conv.is_owned = false;
36316 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36317 uint32_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
36321 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
36322 LDKChannelTypeFeatures orig_conv;
36323 orig_conv.inner = (void*)(orig & (~1));
36324 orig_conv.is_owned = false;
36325 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36326 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
36327 uint32_t ret_ref = 0;
36328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36331 ret_ref = (uintptr_t)ret_var.inner;
36332 if (ret_var.is_owned) {
36338 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
36339 LDKInitFeatures this_obj_conv;
36340 this_obj_conv.inner = (void*)(this_obj & (~1));
36341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36343 InitFeatures_free(this_obj_conv);
36346 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
36347 LDKNodeFeatures this_obj_conv;
36348 this_obj_conv.inner = (void*)(this_obj & (~1));
36349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36351 NodeFeatures_free(this_obj_conv);
36354 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
36355 LDKChannelFeatures this_obj_conv;
36356 this_obj_conv.inner = (void*)(this_obj & (~1));
36357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36359 ChannelFeatures_free(this_obj_conv);
36362 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
36363 LDKInvoiceFeatures this_obj_conv;
36364 this_obj_conv.inner = (void*)(this_obj & (~1));
36365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36367 InvoiceFeatures_free(this_obj_conv);
36370 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
36371 LDKChannelTypeFeatures this_obj_conv;
36372 this_obj_conv.inner = (void*)(this_obj & (~1));
36373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36375 ChannelTypeFeatures_free(this_obj_conv);
36378 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
36379 LDKInitFeatures ret_var = InitFeatures_empty();
36380 uint32_t ret_ref = 0;
36381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36384 ret_ref = (uintptr_t)ret_var.inner;
36385 if (ret_var.is_owned) {
36391 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
36392 LDKInitFeatures ret_var = InitFeatures_known();
36393 uint32_t ret_ref = 0;
36394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36397 ret_ref = (uintptr_t)ret_var.inner;
36398 if (ret_var.is_owned) {
36404 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
36405 LDKInitFeatures this_arg_conv;
36406 this_arg_conv.inner = (void*)(this_arg & (~1));
36407 this_arg_conv.is_owned = false;
36408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36409 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
36413 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
36414 LDKNodeFeatures ret_var = NodeFeatures_empty();
36415 uint32_t ret_ref = 0;
36416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36419 ret_ref = (uintptr_t)ret_var.inner;
36420 if (ret_var.is_owned) {
36426 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
36427 LDKNodeFeatures ret_var = NodeFeatures_known();
36428 uint32_t ret_ref = 0;
36429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36432 ret_ref = (uintptr_t)ret_var.inner;
36433 if (ret_var.is_owned) {
36439 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
36440 LDKNodeFeatures this_arg_conv;
36441 this_arg_conv.inner = (void*)(this_arg & (~1));
36442 this_arg_conv.is_owned = false;
36443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36444 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
36448 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
36449 LDKChannelFeatures ret_var = ChannelFeatures_empty();
36450 uint32_t ret_ref = 0;
36451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36454 ret_ref = (uintptr_t)ret_var.inner;
36455 if (ret_var.is_owned) {
36461 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
36462 LDKChannelFeatures ret_var = ChannelFeatures_known();
36463 uint32_t ret_ref = 0;
36464 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36465 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36466 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36467 ret_ref = (uintptr_t)ret_var.inner;
36468 if (ret_var.is_owned) {
36474 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
36475 LDKChannelFeatures this_arg_conv;
36476 this_arg_conv.inner = (void*)(this_arg & (~1));
36477 this_arg_conv.is_owned = false;
36478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36479 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
36483 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
36484 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
36485 uint32_t ret_ref = 0;
36486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36489 ret_ref = (uintptr_t)ret_var.inner;
36490 if (ret_var.is_owned) {
36496 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
36497 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
36498 uint32_t ret_ref = 0;
36499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36502 ret_ref = (uintptr_t)ret_var.inner;
36503 if (ret_var.is_owned) {
36509 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
36510 LDKInvoiceFeatures this_arg_conv;
36511 this_arg_conv.inner = (void*)(this_arg & (~1));
36512 this_arg_conv.is_owned = false;
36513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36514 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
36518 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
36519 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
36520 uint32_t ret_ref = 0;
36521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36524 ret_ref = (uintptr_t)ret_var.inner;
36525 if (ret_var.is_owned) {
36531 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
36532 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
36533 uint32_t ret_ref = 0;
36534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36537 ret_ref = (uintptr_t)ret_var.inner;
36538 if (ret_var.is_owned) {
36544 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
36545 LDKChannelTypeFeatures this_arg_conv;
36546 this_arg_conv.inner = (void*)(this_arg & (~1));
36547 this_arg_conv.is_owned = false;
36548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36549 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
36553 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
36554 LDKInitFeatures obj_conv;
36555 obj_conv.inner = (void*)(obj & (~1));
36556 obj_conv.is_owned = false;
36557 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36558 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
36559 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36560 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36561 CVec_u8Z_free(ret_var);
36565 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
36566 LDKu8slice ser_ref;
36567 ser_ref.datalen = ser->arr_len;
36568 ser_ref.data = ser->elems;
36569 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
36570 *ret_conv = InitFeatures_read(ser_ref);
36572 return (uint32_t)ret_conv;
36575 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
36576 LDKChannelFeatures obj_conv;
36577 obj_conv.inner = (void*)(obj & (~1));
36578 obj_conv.is_owned = false;
36579 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36580 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
36581 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36582 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36583 CVec_u8Z_free(ret_var);
36587 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
36588 LDKu8slice ser_ref;
36589 ser_ref.datalen = ser->arr_len;
36590 ser_ref.data = ser->elems;
36591 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36592 *ret_conv = ChannelFeatures_read(ser_ref);
36594 return (uint32_t)ret_conv;
36597 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
36598 LDKNodeFeatures obj_conv;
36599 obj_conv.inner = (void*)(obj & (~1));
36600 obj_conv.is_owned = false;
36601 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36602 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36603 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36604 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36605 CVec_u8Z_free(ret_var);
36609 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
36610 LDKu8slice ser_ref;
36611 ser_ref.datalen = ser->arr_len;
36612 ser_ref.data = ser->elems;
36613 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36614 *ret_conv = NodeFeatures_read(ser_ref);
36616 return (uint32_t)ret_conv;
36619 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
36620 LDKInvoiceFeatures obj_conv;
36621 obj_conv.inner = (void*)(obj & (~1));
36622 obj_conv.is_owned = false;
36623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36624 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36625 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36626 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36627 CVec_u8Z_free(ret_var);
36631 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
36632 LDKu8slice ser_ref;
36633 ser_ref.datalen = ser->arr_len;
36634 ser_ref.data = ser->elems;
36635 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36636 *ret_conv = InvoiceFeatures_read(ser_ref);
36638 return (uint32_t)ret_conv;
36641 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
36642 LDKChannelTypeFeatures obj_conv;
36643 obj_conv.inner = (void*)(obj & (~1));
36644 obj_conv.is_owned = false;
36645 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36646 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36647 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36648 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36649 CVec_u8Z_free(ret_var);
36653 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
36654 LDKu8slice ser_ref;
36655 ser_ref.datalen = ser->arr_len;
36656 ser_ref.data = ser->elems;
36657 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36658 *ret_conv = ChannelTypeFeatures_read(ser_ref);
36660 return (uint32_t)ret_conv;
36663 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36664 LDKInitFeatures this_arg_conv;
36665 this_arg_conv.inner = (void*)(this_arg & (~1));
36666 this_arg_conv.is_owned = false;
36667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36668 InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
36671 void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36672 LDKInitFeatures this_arg_conv;
36673 this_arg_conv.inner = (void*)(this_arg & (~1));
36674 this_arg_conv.is_owned = false;
36675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36676 InitFeatures_set_data_loss_protect_required(&this_arg_conv);
36679 jboolean __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint32_t this_arg) {
36680 LDKInitFeatures this_arg_conv;
36681 this_arg_conv.inner = (void*)(this_arg & (~1));
36682 this_arg_conv.is_owned = false;
36683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36684 jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
36688 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint32_t this_arg) {
36689 LDKNodeFeatures this_arg_conv;
36690 this_arg_conv.inner = (void*)(this_arg & (~1));
36691 this_arg_conv.is_owned = false;
36692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36693 NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
36696 void __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint32_t this_arg) {
36697 LDKNodeFeatures this_arg_conv;
36698 this_arg_conv.inner = (void*)(this_arg & (~1));
36699 this_arg_conv.is_owned = false;
36700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36701 NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
36704 jboolean __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint32_t this_arg) {
36705 LDKNodeFeatures this_arg_conv;
36706 this_arg_conv.inner = (void*)(this_arg & (~1));
36707 this_arg_conv.is_owned = false;
36708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36709 jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
36713 jboolean __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint32_t this_arg) {
36714 LDKInitFeatures this_arg_conv;
36715 this_arg_conv.inner = (void*)(this_arg & (~1));
36716 this_arg_conv.is_owned = false;
36717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36718 jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
36722 jboolean __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint32_t this_arg) {
36723 LDKNodeFeatures this_arg_conv;
36724 this_arg_conv.inner = (void*)(this_arg & (~1));
36725 this_arg_conv.is_owned = false;
36726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36727 jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
36731 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint32_t this_arg) {
36732 LDKInitFeatures this_arg_conv;
36733 this_arg_conv.inner = (void*)(this_arg & (~1));
36734 this_arg_conv.is_owned = false;
36735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36736 InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
36739 void __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint32_t this_arg) {
36740 LDKInitFeatures this_arg_conv;
36741 this_arg_conv.inner = (void*)(this_arg & (~1));
36742 this_arg_conv.is_owned = false;
36743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36744 InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
36747 jboolean __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint32_t this_arg) {
36748 LDKInitFeatures this_arg_conv;
36749 this_arg_conv.inner = (void*)(this_arg & (~1));
36750 this_arg_conv.is_owned = false;
36751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36752 jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
36756 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36757 LDKInitFeatures this_arg_conv;
36758 this_arg_conv.inner = (void*)(this_arg & (~1));
36759 this_arg_conv.is_owned = false;
36760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36761 InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36764 void __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36765 LDKInitFeatures this_arg_conv;
36766 this_arg_conv.inner = (void*)(this_arg & (~1));
36767 this_arg_conv.is_owned = false;
36768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36769 InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36772 jboolean __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36773 LDKInitFeatures this_arg_conv;
36774 this_arg_conv.inner = (void*)(this_arg & (~1));
36775 this_arg_conv.is_owned = false;
36776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36777 jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36781 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint32_t this_arg) {
36782 LDKNodeFeatures this_arg_conv;
36783 this_arg_conv.inner = (void*)(this_arg & (~1));
36784 this_arg_conv.is_owned = false;
36785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36786 NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36789 void __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint32_t this_arg) {
36790 LDKNodeFeatures this_arg_conv;
36791 this_arg_conv.inner = (void*)(this_arg & (~1));
36792 this_arg_conv.is_owned = false;
36793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36794 NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36797 jboolean __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint32_t this_arg) {
36798 LDKNodeFeatures this_arg_conv;
36799 this_arg_conv.inner = (void*)(this_arg & (~1));
36800 this_arg_conv.is_owned = false;
36801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36802 jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36806 jboolean __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36807 LDKInitFeatures this_arg_conv;
36808 this_arg_conv.inner = (void*)(this_arg & (~1));
36809 this_arg_conv.is_owned = false;
36810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36811 jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36815 jboolean __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint32_t this_arg) {
36816 LDKNodeFeatures this_arg_conv;
36817 this_arg_conv.inner = (void*)(this_arg & (~1));
36818 this_arg_conv.is_owned = false;
36819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36820 jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36824 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36825 LDKInitFeatures this_arg_conv;
36826 this_arg_conv.inner = (void*)(this_arg & (~1));
36827 this_arg_conv.is_owned = false;
36828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36829 InitFeatures_set_gossip_queries_optional(&this_arg_conv);
36832 void __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint32_t this_arg) {
36833 LDKInitFeatures this_arg_conv;
36834 this_arg_conv.inner = (void*)(this_arg & (~1));
36835 this_arg_conv.is_owned = false;
36836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36837 InitFeatures_set_gossip_queries_required(&this_arg_conv);
36840 jboolean __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint32_t this_arg) {
36841 LDKInitFeatures this_arg_conv;
36842 this_arg_conv.inner = (void*)(this_arg & (~1));
36843 this_arg_conv.is_owned = false;
36844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36845 jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
36849 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint32_t this_arg) {
36850 LDKNodeFeatures this_arg_conv;
36851 this_arg_conv.inner = (void*)(this_arg & (~1));
36852 this_arg_conv.is_owned = false;
36853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36854 NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
36857 void __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint32_t this_arg) {
36858 LDKNodeFeatures this_arg_conv;
36859 this_arg_conv.inner = (void*)(this_arg & (~1));
36860 this_arg_conv.is_owned = false;
36861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36862 NodeFeatures_set_gossip_queries_required(&this_arg_conv);
36865 jboolean __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint32_t this_arg) {
36866 LDKNodeFeatures this_arg_conv;
36867 this_arg_conv.inner = (void*)(this_arg & (~1));
36868 this_arg_conv.is_owned = false;
36869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36870 jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
36874 jboolean __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint32_t this_arg) {
36875 LDKInitFeatures this_arg_conv;
36876 this_arg_conv.inner = (void*)(this_arg & (~1));
36877 this_arg_conv.is_owned = false;
36878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36879 jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
36883 jboolean __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint32_t this_arg) {
36884 LDKNodeFeatures this_arg_conv;
36885 this_arg_conv.inner = (void*)(this_arg & (~1));
36886 this_arg_conv.is_owned = false;
36887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36888 jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
36892 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36893 LDKInitFeatures this_arg_conv;
36894 this_arg_conv.inner = (void*)(this_arg & (~1));
36895 this_arg_conv.is_owned = false;
36896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36897 InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
36900 void __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36901 LDKInitFeatures this_arg_conv;
36902 this_arg_conv.inner = (void*)(this_arg & (~1));
36903 this_arg_conv.is_owned = false;
36904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36905 InitFeatures_set_variable_length_onion_required(&this_arg_conv);
36908 jboolean __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint32_t this_arg) {
36909 LDKInitFeatures this_arg_conv;
36910 this_arg_conv.inner = (void*)(this_arg & (~1));
36911 this_arg_conv.is_owned = false;
36912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36913 jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
36917 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36918 LDKNodeFeatures this_arg_conv;
36919 this_arg_conv.inner = (void*)(this_arg & (~1));
36920 this_arg_conv.is_owned = false;
36921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36922 NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
36925 void __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36926 LDKNodeFeatures this_arg_conv;
36927 this_arg_conv.inner = (void*)(this_arg & (~1));
36928 this_arg_conv.is_owned = false;
36929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36930 NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
36933 jboolean __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint32_t this_arg) {
36934 LDKNodeFeatures this_arg_conv;
36935 this_arg_conv.inner = (void*)(this_arg & (~1));
36936 this_arg_conv.is_owned = false;
36937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36938 jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
36942 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint32_t this_arg) {
36943 LDKInvoiceFeatures this_arg_conv;
36944 this_arg_conv.inner = (void*)(this_arg & (~1));
36945 this_arg_conv.is_owned = false;
36946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36947 InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
36950 void __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint32_t this_arg) {
36951 LDKInvoiceFeatures this_arg_conv;
36952 this_arg_conv.inner = (void*)(this_arg & (~1));
36953 this_arg_conv.is_owned = false;
36954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36955 InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
36958 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint32_t this_arg) {
36959 LDKInvoiceFeatures this_arg_conv;
36960 this_arg_conv.inner = (void*)(this_arg & (~1));
36961 this_arg_conv.is_owned = false;
36962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36963 jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
36967 jboolean __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint32_t this_arg) {
36968 LDKInitFeatures this_arg_conv;
36969 this_arg_conv.inner = (void*)(this_arg & (~1));
36970 this_arg_conv.is_owned = false;
36971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36972 jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
36976 jboolean __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint32_t this_arg) {
36977 LDKNodeFeatures this_arg_conv;
36978 this_arg_conv.inner = (void*)(this_arg & (~1));
36979 this_arg_conv.is_owned = false;
36980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36981 jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
36985 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint32_t this_arg) {
36986 LDKInvoiceFeatures this_arg_conv;
36987 this_arg_conv.inner = (void*)(this_arg & (~1));
36988 this_arg_conv.is_owned = false;
36989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36990 jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
36994 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint32_t this_arg) {
36995 LDKInitFeatures this_arg_conv;
36996 this_arg_conv.inner = (void*)(this_arg & (~1));
36997 this_arg_conv.is_owned = false;
36998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36999 InitFeatures_set_static_remote_key_optional(&this_arg_conv);
37002 void __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint32_t this_arg) {
37003 LDKInitFeatures this_arg_conv;
37004 this_arg_conv.inner = (void*)(this_arg & (~1));
37005 this_arg_conv.is_owned = false;
37006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37007 InitFeatures_set_static_remote_key_required(&this_arg_conv);
37010 jboolean __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint32_t this_arg) {
37011 LDKInitFeatures this_arg_conv;
37012 this_arg_conv.inner = (void*)(this_arg & (~1));
37013 this_arg_conv.is_owned = false;
37014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37015 jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
37019 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
37020 LDKNodeFeatures this_arg_conv;
37021 this_arg_conv.inner = (void*)(this_arg & (~1));
37022 this_arg_conv.is_owned = false;
37023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37024 NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
37027 void __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint32_t this_arg) {
37028 LDKNodeFeatures this_arg_conv;
37029 this_arg_conv.inner = (void*)(this_arg & (~1));
37030 this_arg_conv.is_owned = false;
37031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37032 NodeFeatures_set_static_remote_key_required(&this_arg_conv);
37035 jboolean __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint32_t this_arg) {
37036 LDKNodeFeatures this_arg_conv;
37037 this_arg_conv.inner = (void*)(this_arg & (~1));
37038 this_arg_conv.is_owned = false;
37039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37040 jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
37044 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint32_t this_arg) {
37045 LDKChannelTypeFeatures this_arg_conv;
37046 this_arg_conv.inner = (void*)(this_arg & (~1));
37047 this_arg_conv.is_owned = false;
37048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37049 ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
37052 void __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint32_t this_arg) {
37053 LDKChannelTypeFeatures this_arg_conv;
37054 this_arg_conv.inner = (void*)(this_arg & (~1));
37055 this_arg_conv.is_owned = false;
37056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37057 ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
37060 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint32_t this_arg) {
37061 LDKChannelTypeFeatures this_arg_conv;
37062 this_arg_conv.inner = (void*)(this_arg & (~1));
37063 this_arg_conv.is_owned = false;
37064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37065 jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
37069 jboolean __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint32_t this_arg) {
37070 LDKInitFeatures this_arg_conv;
37071 this_arg_conv.inner = (void*)(this_arg & (~1));
37072 this_arg_conv.is_owned = false;
37073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37074 jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
37078 jboolean __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint32_t this_arg) {
37079 LDKNodeFeatures this_arg_conv;
37080 this_arg_conv.inner = (void*)(this_arg & (~1));
37081 this_arg_conv.is_owned = false;
37082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37083 jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
37087 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint32_t this_arg) {
37088 LDKChannelTypeFeatures this_arg_conv;
37089 this_arg_conv.inner = (void*)(this_arg & (~1));
37090 this_arg_conv.is_owned = false;
37091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37092 jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
37096 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint32_t this_arg) {
37097 LDKInitFeatures this_arg_conv;
37098 this_arg_conv.inner = (void*)(this_arg & (~1));
37099 this_arg_conv.is_owned = false;
37100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37101 InitFeatures_set_payment_secret_optional(&this_arg_conv);
37104 void __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint32_t this_arg) {
37105 LDKInitFeatures this_arg_conv;
37106 this_arg_conv.inner = (void*)(this_arg & (~1));
37107 this_arg_conv.is_owned = false;
37108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37109 InitFeatures_set_payment_secret_required(&this_arg_conv);
37112 jboolean __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
37113 LDKInitFeatures this_arg_conv;
37114 this_arg_conv.inner = (void*)(this_arg & (~1));
37115 this_arg_conv.is_owned = false;
37116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37117 jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
37121 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint32_t this_arg) {
37122 LDKNodeFeatures this_arg_conv;
37123 this_arg_conv.inner = (void*)(this_arg & (~1));
37124 this_arg_conv.is_owned = false;
37125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37126 NodeFeatures_set_payment_secret_optional(&this_arg_conv);
37129 void __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint32_t this_arg) {
37130 LDKNodeFeatures this_arg_conv;
37131 this_arg_conv.inner = (void*)(this_arg & (~1));
37132 this_arg_conv.is_owned = false;
37133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37134 NodeFeatures_set_payment_secret_required(&this_arg_conv);
37137 jboolean __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) {
37138 LDKNodeFeatures this_arg_conv;
37139 this_arg_conv.inner = (void*)(this_arg & (~1));
37140 this_arg_conv.is_owned = false;
37141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37142 jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
37146 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint32_t this_arg) {
37147 LDKInvoiceFeatures this_arg_conv;
37148 this_arg_conv.inner = (void*)(this_arg & (~1));
37149 this_arg_conv.is_owned = false;
37150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37151 InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
37154 void __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint32_t this_arg) {
37155 LDKInvoiceFeatures this_arg_conv;
37156 this_arg_conv.inner = (void*)(this_arg & (~1));
37157 this_arg_conv.is_owned = false;
37158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37159 InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
37162 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) {
37163 LDKInvoiceFeatures this_arg_conv;
37164 this_arg_conv.inner = (void*)(this_arg & (~1));
37165 this_arg_conv.is_owned = false;
37166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37167 jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
37171 jboolean __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint32_t this_arg) {
37172 LDKInitFeatures this_arg_conv;
37173 this_arg_conv.inner = (void*)(this_arg & (~1));
37174 this_arg_conv.is_owned = false;
37175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37176 jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
37180 jboolean __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint32_t this_arg) {
37181 LDKNodeFeatures this_arg_conv;
37182 this_arg_conv.inner = (void*)(this_arg & (~1));
37183 this_arg_conv.is_owned = false;
37184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37185 jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
37189 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint32_t this_arg) {
37190 LDKInvoiceFeatures this_arg_conv;
37191 this_arg_conv.inner = (void*)(this_arg & (~1));
37192 this_arg_conv.is_owned = false;
37193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37194 jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
37198 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37199 LDKInitFeatures this_arg_conv;
37200 this_arg_conv.inner = (void*)(this_arg & (~1));
37201 this_arg_conv.is_owned = false;
37202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37203 InitFeatures_set_basic_mpp_optional(&this_arg_conv);
37206 void __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint32_t this_arg) {
37207 LDKInitFeatures this_arg_conv;
37208 this_arg_conv.inner = (void*)(this_arg & (~1));
37209 this_arg_conv.is_owned = false;
37210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37211 InitFeatures_set_basic_mpp_required(&this_arg_conv);
37214 jboolean __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint32_t this_arg) {
37215 LDKInitFeatures this_arg_conv;
37216 this_arg_conv.inner = (void*)(this_arg & (~1));
37217 this_arg_conv.is_owned = false;
37218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37219 jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
37223 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37224 LDKNodeFeatures this_arg_conv;
37225 this_arg_conv.inner = (void*)(this_arg & (~1));
37226 this_arg_conv.is_owned = false;
37227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37228 NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
37231 void __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint32_t this_arg) {
37232 LDKNodeFeatures this_arg_conv;
37233 this_arg_conv.inner = (void*)(this_arg & (~1));
37234 this_arg_conv.is_owned = false;
37235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37236 NodeFeatures_set_basic_mpp_required(&this_arg_conv);
37239 jboolean __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint32_t this_arg) {
37240 LDKNodeFeatures this_arg_conv;
37241 this_arg_conv.inner = (void*)(this_arg & (~1));
37242 this_arg_conv.is_owned = false;
37243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37244 jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
37248 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint32_t this_arg) {
37249 LDKInvoiceFeatures this_arg_conv;
37250 this_arg_conv.inner = (void*)(this_arg & (~1));
37251 this_arg_conv.is_owned = false;
37252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37253 InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
37256 void __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint32_t this_arg) {
37257 LDKInvoiceFeatures this_arg_conv;
37258 this_arg_conv.inner = (void*)(this_arg & (~1));
37259 this_arg_conv.is_owned = false;
37260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37261 InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
37264 jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint32_t this_arg) {
37265 LDKInvoiceFeatures this_arg_conv;
37266 this_arg_conv.inner = (void*)(this_arg & (~1));
37267 this_arg_conv.is_owned = false;
37268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37269 jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
37273 jboolean __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint32_t this_arg) {
37274 LDKInitFeatures this_arg_conv;
37275 this_arg_conv.inner = (void*)(this_arg & (~1));
37276 this_arg_conv.is_owned = false;
37277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37278 jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
37282 jboolean __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint32_t this_arg) {
37283 LDKNodeFeatures this_arg_conv;
37284 this_arg_conv.inner = (void*)(this_arg & (~1));
37285 this_arg_conv.is_owned = false;
37286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37287 jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
37291 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint32_t this_arg) {
37292 LDKInvoiceFeatures this_arg_conv;
37293 this_arg_conv.inner = (void*)(this_arg & (~1));
37294 this_arg_conv.is_owned = false;
37295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37296 jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
37300 void __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint32_t this_arg) {
37301 LDKInitFeatures this_arg_conv;
37302 this_arg_conv.inner = (void*)(this_arg & (~1));
37303 this_arg_conv.is_owned = false;
37304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37305 InitFeatures_set_wumbo_optional(&this_arg_conv);
37308 void __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint32_t this_arg) {
37309 LDKInitFeatures this_arg_conv;
37310 this_arg_conv.inner = (void*)(this_arg & (~1));
37311 this_arg_conv.is_owned = false;
37312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37313 InitFeatures_set_wumbo_required(&this_arg_conv);
37316 jboolean __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint32_t this_arg) {
37317 LDKInitFeatures this_arg_conv;
37318 this_arg_conv.inner = (void*)(this_arg & (~1));
37319 this_arg_conv.is_owned = false;
37320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37321 jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
37325 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint32_t this_arg) {
37326 LDKNodeFeatures this_arg_conv;
37327 this_arg_conv.inner = (void*)(this_arg & (~1));
37328 this_arg_conv.is_owned = false;
37329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37330 NodeFeatures_set_wumbo_optional(&this_arg_conv);
37333 void __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint32_t this_arg) {
37334 LDKNodeFeatures this_arg_conv;
37335 this_arg_conv.inner = (void*)(this_arg & (~1));
37336 this_arg_conv.is_owned = false;
37337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37338 NodeFeatures_set_wumbo_required(&this_arg_conv);
37341 jboolean __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint32_t this_arg) {
37342 LDKNodeFeatures this_arg_conv;
37343 this_arg_conv.inner = (void*)(this_arg & (~1));
37344 this_arg_conv.is_owned = false;
37345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37346 jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
37350 jboolean __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint32_t this_arg) {
37351 LDKInitFeatures this_arg_conv;
37352 this_arg_conv.inner = (void*)(this_arg & (~1));
37353 this_arg_conv.is_owned = false;
37354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37355 jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
37359 jboolean __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint32_t this_arg) {
37360 LDKNodeFeatures this_arg_conv;
37361 this_arg_conv.inner = (void*)(this_arg & (~1));
37362 this_arg_conv.is_owned = false;
37363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37364 jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
37368 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37369 LDKInitFeatures this_arg_conv;
37370 this_arg_conv.inner = (void*)(this_arg & (~1));
37371 this_arg_conv.is_owned = false;
37372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37373 InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37376 void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37377 LDKInitFeatures this_arg_conv;
37378 this_arg_conv.inner = (void*)(this_arg & (~1));
37379 this_arg_conv.is_owned = false;
37380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37381 InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37384 jboolean __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37385 LDKInitFeatures this_arg_conv;
37386 this_arg_conv.inner = (void*)(this_arg & (~1));
37387 this_arg_conv.is_owned = false;
37388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37389 jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37393 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint32_t this_arg) {
37394 LDKNodeFeatures this_arg_conv;
37395 this_arg_conv.inner = (void*)(this_arg & (~1));
37396 this_arg_conv.is_owned = false;
37397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37398 NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37401 void __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint32_t this_arg) {
37402 LDKNodeFeatures this_arg_conv;
37403 this_arg_conv.inner = (void*)(this_arg & (~1));
37404 this_arg_conv.is_owned = false;
37405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37406 NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37409 jboolean __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint32_t this_arg) {
37410 LDKNodeFeatures this_arg_conv;
37411 this_arg_conv.inner = (void*)(this_arg & (~1));
37412 this_arg_conv.is_owned = false;
37413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37414 jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37418 jboolean __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37419 LDKInitFeatures this_arg_conv;
37420 this_arg_conv.inner = (void*)(this_arg & (~1));
37421 this_arg_conv.is_owned = false;
37422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37423 jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37427 jboolean __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint32_t this_arg) {
37428 LDKNodeFeatures this_arg_conv;
37429 this_arg_conv.inner = (void*)(this_arg & (~1));
37430 this_arg_conv.is_owned = false;
37431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37432 jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37436 void __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint32_t this_arg) {
37437 LDKInitFeatures this_arg_conv;
37438 this_arg_conv.inner = (void*)(this_arg & (~1));
37439 this_arg_conv.is_owned = false;
37440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37441 InitFeatures_set_channel_type_optional(&this_arg_conv);
37444 void __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint32_t this_arg) {
37445 LDKInitFeatures this_arg_conv;
37446 this_arg_conv.inner = (void*)(this_arg & (~1));
37447 this_arg_conv.is_owned = false;
37448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37449 InitFeatures_set_channel_type_required(&this_arg_conv);
37452 jboolean __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint32_t this_arg) {
37453 LDKInitFeatures this_arg_conv;
37454 this_arg_conv.inner = (void*)(this_arg & (~1));
37455 this_arg_conv.is_owned = false;
37456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37457 jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
37461 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint32_t this_arg) {
37462 LDKNodeFeatures this_arg_conv;
37463 this_arg_conv.inner = (void*)(this_arg & (~1));
37464 this_arg_conv.is_owned = false;
37465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37466 NodeFeatures_set_channel_type_optional(&this_arg_conv);
37469 void __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint32_t this_arg) {
37470 LDKNodeFeatures this_arg_conv;
37471 this_arg_conv.inner = (void*)(this_arg & (~1));
37472 this_arg_conv.is_owned = false;
37473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37474 NodeFeatures_set_channel_type_required(&this_arg_conv);
37477 jboolean __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint32_t this_arg) {
37478 LDKNodeFeatures this_arg_conv;
37479 this_arg_conv.inner = (void*)(this_arg & (~1));
37480 this_arg_conv.is_owned = false;
37481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37482 jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
37486 jboolean __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint32_t this_arg) {
37487 LDKInitFeatures this_arg_conv;
37488 this_arg_conv.inner = (void*)(this_arg & (~1));
37489 this_arg_conv.is_owned = false;
37490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37491 jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
37495 jboolean __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint32_t this_arg) {
37496 LDKNodeFeatures this_arg_conv;
37497 this_arg_conv.inner = (void*)(this_arg & (~1));
37498 this_arg_conv.is_owned = false;
37499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37500 jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
37504 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37505 LDKInitFeatures this_arg_conv;
37506 this_arg_conv.inner = (void*)(this_arg & (~1));
37507 this_arg_conv.is_owned = false;
37508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37509 InitFeatures_set_scid_privacy_optional(&this_arg_conv);
37512 void __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint32_t this_arg) {
37513 LDKInitFeatures this_arg_conv;
37514 this_arg_conv.inner = (void*)(this_arg & (~1));
37515 this_arg_conv.is_owned = false;
37516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37517 InitFeatures_set_scid_privacy_required(&this_arg_conv);
37520 jboolean __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint32_t this_arg) {
37521 LDKInitFeatures this_arg_conv;
37522 this_arg_conv.inner = (void*)(this_arg & (~1));
37523 this_arg_conv.is_owned = false;
37524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37525 jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
37529 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37530 LDKNodeFeatures this_arg_conv;
37531 this_arg_conv.inner = (void*)(this_arg & (~1));
37532 this_arg_conv.is_owned = false;
37533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37534 NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
37537 void __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37538 LDKNodeFeatures this_arg_conv;
37539 this_arg_conv.inner = (void*)(this_arg & (~1));
37540 this_arg_conv.is_owned = false;
37541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37542 NodeFeatures_set_scid_privacy_required(&this_arg_conv);
37545 jboolean __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint32_t this_arg) {
37546 LDKNodeFeatures this_arg_conv;
37547 this_arg_conv.inner = (void*)(this_arg & (~1));
37548 this_arg_conv.is_owned = false;
37549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37550 jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
37554 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint32_t this_arg) {
37555 LDKChannelTypeFeatures this_arg_conv;
37556 this_arg_conv.inner = (void*)(this_arg & (~1));
37557 this_arg_conv.is_owned = false;
37558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37559 ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
37562 void __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint32_t this_arg) {
37563 LDKChannelTypeFeatures this_arg_conv;
37564 this_arg_conv.inner = (void*)(this_arg & (~1));
37565 this_arg_conv.is_owned = false;
37566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37567 ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
37570 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint32_t this_arg) {
37571 LDKChannelTypeFeatures this_arg_conv;
37572 this_arg_conv.inner = (void*)(this_arg & (~1));
37573 this_arg_conv.is_owned = false;
37574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37575 jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
37579 jboolean __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint32_t this_arg) {
37580 LDKInitFeatures this_arg_conv;
37581 this_arg_conv.inner = (void*)(this_arg & (~1));
37582 this_arg_conv.is_owned = false;
37583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37584 jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
37588 jboolean __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint32_t this_arg) {
37589 LDKNodeFeatures this_arg_conv;
37590 this_arg_conv.inner = (void*)(this_arg & (~1));
37591 this_arg_conv.is_owned = false;
37592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37593 jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
37597 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint32_t this_arg) {
37598 LDKChannelTypeFeatures this_arg_conv;
37599 this_arg_conv.inner = (void*)(this_arg & (~1));
37600 this_arg_conv.is_owned = false;
37601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37602 jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
37606 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint32_t this_arg) {
37607 LDKInitFeatures this_arg_conv;
37608 this_arg_conv.inner = (void*)(this_arg & (~1));
37609 this_arg_conv.is_owned = false;
37610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37611 InitFeatures_set_zero_conf_optional(&this_arg_conv);
37614 void __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint32_t this_arg) {
37615 LDKInitFeatures this_arg_conv;
37616 this_arg_conv.inner = (void*)(this_arg & (~1));
37617 this_arg_conv.is_owned = false;
37618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37619 InitFeatures_set_zero_conf_required(&this_arg_conv);
37622 jboolean __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint32_t this_arg) {
37623 LDKInitFeatures this_arg_conv;
37624 this_arg_conv.inner = (void*)(this_arg & (~1));
37625 this_arg_conv.is_owned = false;
37626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37627 jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
37631 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37632 LDKNodeFeatures this_arg_conv;
37633 this_arg_conv.inner = (void*)(this_arg & (~1));
37634 this_arg_conv.is_owned = false;
37635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37636 NodeFeatures_set_zero_conf_optional(&this_arg_conv);
37639 void __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint32_t this_arg) {
37640 LDKNodeFeatures this_arg_conv;
37641 this_arg_conv.inner = (void*)(this_arg & (~1));
37642 this_arg_conv.is_owned = false;
37643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37644 NodeFeatures_set_zero_conf_required(&this_arg_conv);
37647 jboolean __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint32_t this_arg) {
37648 LDKNodeFeatures this_arg_conv;
37649 this_arg_conv.inner = (void*)(this_arg & (~1));
37650 this_arg_conv.is_owned = false;
37651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37652 jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
37656 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint32_t this_arg) {
37657 LDKChannelTypeFeatures this_arg_conv;
37658 this_arg_conv.inner = (void*)(this_arg & (~1));
37659 this_arg_conv.is_owned = false;
37660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37661 ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
37664 void __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint32_t this_arg) {
37665 LDKChannelTypeFeatures this_arg_conv;
37666 this_arg_conv.inner = (void*)(this_arg & (~1));
37667 this_arg_conv.is_owned = false;
37668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37669 ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
37672 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint32_t this_arg) {
37673 LDKChannelTypeFeatures this_arg_conv;
37674 this_arg_conv.inner = (void*)(this_arg & (~1));
37675 this_arg_conv.is_owned = false;
37676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37677 jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
37681 jboolean __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint32_t this_arg) {
37682 LDKInitFeatures this_arg_conv;
37683 this_arg_conv.inner = (void*)(this_arg & (~1));
37684 this_arg_conv.is_owned = false;
37685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37686 jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
37690 jboolean __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint32_t this_arg) {
37691 LDKNodeFeatures this_arg_conv;
37692 this_arg_conv.inner = (void*)(this_arg & (~1));
37693 this_arg_conv.is_owned = false;
37694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37695 jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
37699 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint32_t this_arg) {
37700 LDKChannelTypeFeatures this_arg_conv;
37701 this_arg_conv.inner = (void*)(this_arg & (~1));
37702 this_arg_conv.is_owned = false;
37703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37704 jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
37708 void __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint32_t this_arg) {
37709 LDKNodeFeatures this_arg_conv;
37710 this_arg_conv.inner = (void*)(this_arg & (~1));
37711 this_arg_conv.is_owned = false;
37712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37713 NodeFeatures_set_keysend_optional(&this_arg_conv);
37716 void __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint32_t this_arg) {
37717 LDKNodeFeatures this_arg_conv;
37718 this_arg_conv.inner = (void*)(this_arg & (~1));
37719 this_arg_conv.is_owned = false;
37720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37721 NodeFeatures_set_keysend_required(&this_arg_conv);
37724 jboolean __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint32_t this_arg) {
37725 LDKNodeFeatures this_arg_conv;
37726 this_arg_conv.inner = (void*)(this_arg & (~1));
37727 this_arg_conv.is_owned = false;
37728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37729 jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
37733 jboolean __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint32_t this_arg) {
37734 LDKNodeFeatures this_arg_conv;
37735 this_arg_conv.inner = (void*)(this_arg & (~1));
37736 this_arg_conv.is_owned = false;
37737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37738 jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
37742 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
37743 LDKShutdownScript this_obj_conv;
37744 this_obj_conv.inner = (void*)(this_obj & (~1));
37745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37747 ShutdownScript_free(this_obj_conv);
37750 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
37751 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
37752 uint32_t ret_ref = 0;
37753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37756 ret_ref = (uintptr_t)ret_var.inner;
37757 if (ret_var.is_owned) {
37762 uint32_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
37763 LDKShutdownScript arg_conv;
37764 arg_conv.inner = (void*)(arg & (~1));
37765 arg_conv.is_owned = false;
37766 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37767 uint32_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
37771 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
37772 LDKShutdownScript orig_conv;
37773 orig_conv.inner = (void*)(orig & (~1));
37774 orig_conv.is_owned = false;
37775 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37776 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
37777 uint32_t ret_ref = 0;
37778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37781 ret_ref = (uintptr_t)ret_var.inner;
37782 if (ret_var.is_owned) {
37788 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
37789 LDKInvalidShutdownScript this_obj_conv;
37790 this_obj_conv.inner = (void*)(this_obj & (~1));
37791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37793 InvalidShutdownScript_free(this_obj_conv);
37796 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
37797 LDKInvalidShutdownScript this_ptr_conv;
37798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37799 this_ptr_conv.is_owned = false;
37800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37801 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
37802 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37803 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37807 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
37808 LDKInvalidShutdownScript this_ptr_conv;
37809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37810 this_ptr_conv.is_owned = false;
37811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37812 LDKCVec_u8Z val_ref;
37813 val_ref.datalen = val->arr_len;
37814 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37815 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37816 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
37819 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
37820 LDKCVec_u8Z script_arg_ref;
37821 script_arg_ref.datalen = script_arg->arr_len;
37822 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37823 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37824 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
37825 uint32_t ret_ref = 0;
37826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37829 ret_ref = (uintptr_t)ret_var.inner;
37830 if (ret_var.is_owned) {
37836 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
37837 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
37838 uint32_t ret_ref = 0;
37839 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37840 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37842 ret_ref = (uintptr_t)ret_var.inner;
37843 if (ret_var.is_owned) {
37848 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
37849 LDKInvalidShutdownScript arg_conv;
37850 arg_conv.inner = (void*)(arg & (~1));
37851 arg_conv.is_owned = false;
37852 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37853 uint32_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
37857 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
37858 LDKInvalidShutdownScript orig_conv;
37859 orig_conv.inner = (void*)(orig & (~1));
37860 orig_conv.is_owned = false;
37861 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37862 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
37863 uint32_t ret_ref = 0;
37864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37867 ret_ref = (uintptr_t)ret_var.inner;
37868 if (ret_var.is_owned) {
37874 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
37875 LDKShutdownScript obj_conv;
37876 obj_conv.inner = (void*)(obj & (~1));
37877 obj_conv.is_owned = false;
37878 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37879 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
37880 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37881 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37882 CVec_u8Z_free(ret_var);
37886 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
37887 LDKu8slice ser_ref;
37888 ser_ref.datalen = ser->arr_len;
37889 ser_ref.data = ser->elems;
37890 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37891 *ret_conv = ShutdownScript_read(ser_ref);
37893 return (uint32_t)ret_conv;
37896 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
37897 unsigned char pubkey_hash_arr[20];
37898 CHECK(pubkey_hash->arr_len == 20);
37899 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
37900 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
37901 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
37902 uint32_t ret_ref = 0;
37903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37906 ret_ref = (uintptr_t)ret_var.inner;
37907 if (ret_var.is_owned) {
37913 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
37914 unsigned char script_hash_arr[32];
37915 CHECK(script_hash->arr_len == 32);
37916 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
37917 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
37918 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
37919 uint32_t ret_ref = 0;
37920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37923 ret_ref = (uintptr_t)ret_var.inner;
37924 if (ret_var.is_owned) {
37930 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
37932 LDKu8slice program_ref;
37933 program_ref.datalen = program->arr_len;
37934 program_ref.data = program->elems;
37935 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37936 *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
37938 return (uint32_t)ret_conv;
37941 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
37942 LDKShutdownScript this_arg_conv;
37943 this_arg_conv.inner = (void*)(this_arg & (~1));
37944 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
37945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37946 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
37947 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
37948 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37949 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37950 CVec_u8Z_free(ret_var);
37954 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
37955 LDKShutdownScript this_arg_conv;
37956 this_arg_conv.inner = (void*)(this_arg & (~1));
37957 this_arg_conv.is_owned = false;
37958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37959 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37960 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
37964 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
37965 LDKShutdownScript this_arg_conv;
37966 this_arg_conv.inner = (void*)(this_arg & (~1));
37967 this_arg_conv.is_owned = false;
37968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37969 LDKInitFeatures features_conv;
37970 features_conv.inner = (void*)(features & (~1));
37971 features_conv.is_owned = false;
37972 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
37973 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37977 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
37978 if ((this_ptr & 1) != 0) return;
37979 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37980 CHECK_ACCESS(this_ptr_ptr);
37981 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37982 FREE((void*)this_ptr);
37983 CustomMessageReader_free(this_ptr_conv);
37986 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37987 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37988 *ret_ret = Type_clone(arg);
37989 return (uint32_t)ret_ret;
37991 uint32_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
37992 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37993 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37994 LDKType* arg_conv = (LDKType*)arg_ptr;
37995 uint32_t ret_conv = Type_clone_ptr(arg_conv);
37999 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
38000 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
38001 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
38002 LDKType* orig_conv = (LDKType*)orig_ptr;
38003 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
38004 *ret_ret = Type_clone(orig_conv);
38005 return (uint32_t)ret_ret;
38008 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
38009 if ((this_ptr & 1) != 0) return;
38010 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38011 CHECK_ACCESS(this_ptr_ptr);
38012 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
38013 FREE((void*)this_ptr);
38014 Type_free(this_ptr_conv);
38017 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
38018 LDKNodeId this_obj_conv;
38019 this_obj_conv.inner = (void*)(this_obj & (~1));
38020 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38022 NodeId_free(this_obj_conv);
38025 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
38026 LDKNodeId ret_var = NodeId_clone(arg);
38027 uint32_t ret_ref = 0;
38028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38031 ret_ref = (uintptr_t)ret_var.inner;
38032 if (ret_var.is_owned) {
38037 uint32_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
38038 LDKNodeId arg_conv;
38039 arg_conv.inner = (void*)(arg & (~1));
38040 arg_conv.is_owned = false;
38041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38042 uint32_t ret_conv = NodeId_clone_ptr(&arg_conv);
38046 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
38047 LDKNodeId orig_conv;
38048 orig_conv.inner = (void*)(orig & (~1));
38049 orig_conv.is_owned = false;
38050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38051 LDKNodeId ret_var = NodeId_clone(&orig_conv);
38052 uint32_t ret_ref = 0;
38053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38056 ret_ref = (uintptr_t)ret_var.inner;
38057 if (ret_var.is_owned) {
38063 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
38064 LDKPublicKey pubkey_ref;
38065 CHECK(pubkey->arr_len == 33);
38066 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
38067 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
38068 uint32_t ret_ref = 0;
38069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38072 ret_ref = (uintptr_t)ret_var.inner;
38073 if (ret_var.is_owned) {
38079 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
38080 LDKNodeId this_arg_conv;
38081 this_arg_conv.inner = (void*)(this_arg & (~1));
38082 this_arg_conv.is_owned = false;
38083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38084 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
38085 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38086 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38090 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
38092 o_conv.inner = (void*)(o & (~1));
38093 o_conv.is_owned = false;
38094 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38095 int64_t ret_conv = NodeId_hash(&o_conv);
38099 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
38100 LDKNodeId obj_conv;
38101 obj_conv.inner = (void*)(obj & (~1));
38102 obj_conv.is_owned = false;
38103 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38104 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
38105 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38106 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38107 CVec_u8Z_free(ret_var);
38111 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
38112 LDKu8slice ser_ref;
38113 ser_ref.datalen = ser->arr_len;
38114 ser_ref.data = ser->elems;
38115 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
38116 *ret_conv = NodeId_read(ser_ref);
38118 return (uint32_t)ret_conv;
38121 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
38122 LDKNetworkGraph this_obj_conv;
38123 this_obj_conv.inner = (void*)(this_obj & (~1));
38124 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38126 NetworkGraph_free(this_obj_conv);
38129 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
38130 LDKReadOnlyNetworkGraph this_obj_conv;
38131 this_obj_conv.inner = (void*)(this_obj & (~1));
38132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38134 ReadOnlyNetworkGraph_free(this_obj_conv);
38137 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
38138 if ((this_ptr & 1) != 0) return;
38139 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38140 CHECK_ACCESS(this_ptr_ptr);
38141 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
38142 FREE((void*)this_ptr);
38143 NetworkUpdate_free(this_ptr_conv);
38146 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
38147 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38148 *ret_copy = NetworkUpdate_clone(arg);
38149 uint32_t ret_ref = (uintptr_t)ret_copy;
38152 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
38153 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
38154 uint32_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
38158 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
38159 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
38160 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38161 *ret_copy = NetworkUpdate_clone(orig_conv);
38162 uint32_t ret_ref = (uintptr_t)ret_copy;
38166 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
38167 LDKChannelUpdate msg_conv;
38168 msg_conv.inner = (void*)(msg & (~1));
38169 msg_conv.is_owned = (msg & 1) || (msg == 0);
38170 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38171 msg_conv = ChannelUpdate_clone(&msg_conv);
38172 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38173 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
38174 uint32_t ret_ref = (uintptr_t)ret_copy;
38178 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
38179 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38180 *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
38181 uint32_t ret_ref = (uintptr_t)ret_copy;
38185 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
38186 LDKPublicKey node_id_ref;
38187 CHECK(node_id->arr_len == 33);
38188 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38189 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
38190 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
38191 uint32_t ret_ref = (uintptr_t)ret_copy;
38195 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
38196 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
38197 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
38198 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38199 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38200 CVec_u8Z_free(ret_var);
38204 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
38205 LDKu8slice ser_ref;
38206 ser_ref.datalen = ser->arr_len;
38207 ser_ref.data = ser->elems;
38208 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
38209 *ret_conv = NetworkUpdate_read(ser_ref);
38211 return (uint32_t)ret_conv;
38214 void __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint32_t this_obj) {
38215 LDKP2PGossipSync this_obj_conv;
38216 this_obj_conv.inner = (void*)(this_obj & (~1));
38217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38219 P2PGossipSync_free(this_obj_conv);
38222 uint32_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
38223 LDKNetworkGraph network_graph_conv;
38224 network_graph_conv.inner = (void*)(network_graph & (~1));
38225 network_graph_conv.is_owned = false;
38226 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
38227 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38228 CHECK_ACCESS(chain_access_ptr);
38229 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38230 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38231 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38232 // Manually implement clone for Java trait instances
38233 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38234 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38235 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38238 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38239 CHECK_ACCESS(logger_ptr);
38240 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38241 if (logger_conv.free == LDKLogger_JCalls_free) {
38242 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38243 LDKLogger_JCalls_cloned(&logger_conv);
38245 LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
38246 uint32_t ret_ref = 0;
38247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38250 ret_ref = (uintptr_t)ret_var.inner;
38251 if (ret_var.is_owned) {
38257 void __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
38258 LDKP2PGossipSync this_arg_conv;
38259 this_arg_conv.inner = (void*)(this_arg & (~1));
38260 this_arg_conv.is_owned = false;
38261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38262 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38263 CHECK_ACCESS(chain_access_ptr);
38264 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38265 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
38266 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38267 // Manually implement clone for Java trait instances
38268 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38269 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38270 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38273 P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
38276 uint32_t __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint32_t this_arg) {
38277 LDKNetworkGraph this_arg_conv;
38278 this_arg_conv.inner = (void*)(this_arg & (~1));
38279 this_arg_conv.is_owned = false;
38280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38281 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
38282 *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
38283 return (uint32_t)ret_ret;
38286 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint32_t this_arg) {
38287 LDKP2PGossipSync this_arg_conv;
38288 this_arg_conv.inner = (void*)(this_arg & (~1));
38289 this_arg_conv.is_owned = false;
38290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38291 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38292 *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
38293 return (uint32_t)ret_ret;
38296 uint32_t __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint32_t this_arg) {
38297 LDKP2PGossipSync this_arg_conv;
38298 this_arg_conv.inner = (void*)(this_arg & (~1));
38299 this_arg_conv.is_owned = false;
38300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38301 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38302 *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
38303 return (uint32_t)ret_ret;
38306 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
38307 LDKChannelUpdateInfo this_obj_conv;
38308 this_obj_conv.inner = (void*)(this_obj & (~1));
38309 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38311 ChannelUpdateInfo_free(this_obj_conv);
38314 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
38315 LDKChannelUpdateInfo this_ptr_conv;
38316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38317 this_ptr_conv.is_owned = false;
38318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38319 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
38323 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
38324 LDKChannelUpdateInfo this_ptr_conv;
38325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38326 this_ptr_conv.is_owned = false;
38327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38328 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
38331 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
38332 LDKChannelUpdateInfo this_ptr_conv;
38333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38334 this_ptr_conv.is_owned = false;
38335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38336 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
38340 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
38341 LDKChannelUpdateInfo this_ptr_conv;
38342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38343 this_ptr_conv.is_owned = false;
38344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38345 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
38348 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
38349 LDKChannelUpdateInfo this_ptr_conv;
38350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38351 this_ptr_conv.is_owned = false;
38352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38353 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
38357 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
38358 LDKChannelUpdateInfo this_ptr_conv;
38359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38360 this_ptr_conv.is_owned = false;
38361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38362 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38365 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
38366 LDKChannelUpdateInfo this_ptr_conv;
38367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38368 this_ptr_conv.is_owned = false;
38369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38370 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
38374 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
38375 LDKChannelUpdateInfo this_ptr_conv;
38376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38377 this_ptr_conv.is_owned = false;
38378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38379 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
38382 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
38383 LDKChannelUpdateInfo 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 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38388 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
38389 uint32_t ret_ref = (uintptr_t)ret_copy;
38393 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
38394 LDKChannelUpdateInfo this_ptr_conv;
38395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38396 this_ptr_conv.is_owned = false;
38397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38398 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38399 CHECK_ACCESS(val_ptr);
38400 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38401 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38402 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38405 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
38406 LDKChannelUpdateInfo this_ptr_conv;
38407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38408 this_ptr_conv.is_owned = false;
38409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38410 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
38411 uint32_t ret_ref = 0;
38412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38415 ret_ref = (uintptr_t)ret_var.inner;
38416 if (ret_var.is_owned) {
38422 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
38423 LDKChannelUpdateInfo this_ptr_conv;
38424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38425 this_ptr_conv.is_owned = false;
38426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38427 LDKRoutingFees val_conv;
38428 val_conv.inner = (void*)(val & (~1));
38429 val_conv.is_owned = (val & 1) || (val == 0);
38430 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38431 val_conv = RoutingFees_clone(&val_conv);
38432 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
38435 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
38436 LDKChannelUpdateInfo this_ptr_conv;
38437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38438 this_ptr_conv.is_owned = false;
38439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38440 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
38441 uint32_t ret_ref = 0;
38442 if ((uintptr_t)ret_var.inner > 4096) {
38443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38446 ret_ref = (uintptr_t)ret_var.inner;
38447 if (ret_var.is_owned) {
38454 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
38455 LDKChannelUpdateInfo this_ptr_conv;
38456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38457 this_ptr_conv.is_owned = false;
38458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38459 LDKChannelUpdate val_conv;
38460 val_conv.inner = (void*)(val & (~1));
38461 val_conv.is_owned = (val & 1) || (val == 0);
38462 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38463 val_conv = ChannelUpdate_clone(&val_conv);
38464 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
38467 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) {
38468 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
38469 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38470 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38471 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
38472 LDKRoutingFees fees_arg_conv;
38473 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38474 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38475 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38476 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38477 LDKChannelUpdate last_update_message_arg_conv;
38478 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
38479 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
38480 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
38481 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
38482 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);
38483 uint32_t ret_ref = 0;
38484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38487 ret_ref = (uintptr_t)ret_var.inner;
38488 if (ret_var.is_owned) {
38494 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
38495 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
38496 uint32_t ret_ref = 0;
38497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38500 ret_ref = (uintptr_t)ret_var.inner;
38501 if (ret_var.is_owned) {
38506 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
38507 LDKChannelUpdateInfo arg_conv;
38508 arg_conv.inner = (void*)(arg & (~1));
38509 arg_conv.is_owned = false;
38510 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38511 uint32_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
38515 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
38516 LDKChannelUpdateInfo orig_conv;
38517 orig_conv.inner = (void*)(orig & (~1));
38518 orig_conv.is_owned = false;
38519 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38520 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
38521 uint32_t ret_ref = 0;
38522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38525 ret_ref = (uintptr_t)ret_var.inner;
38526 if (ret_var.is_owned) {
38532 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
38533 LDKChannelUpdateInfo obj_conv;
38534 obj_conv.inner = (void*)(obj & (~1));
38535 obj_conv.is_owned = false;
38536 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38537 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
38538 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38539 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38540 CVec_u8Z_free(ret_var);
38544 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
38545 LDKu8slice ser_ref;
38546 ser_ref.datalen = ser->arr_len;
38547 ser_ref.data = ser->elems;
38548 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
38549 *ret_conv = ChannelUpdateInfo_read(ser_ref);
38551 return (uint32_t)ret_conv;
38554 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
38555 LDKChannelInfo this_obj_conv;
38556 this_obj_conv.inner = (void*)(this_obj & (~1));
38557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38559 ChannelInfo_free(this_obj_conv);
38562 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
38563 LDKChannelInfo this_ptr_conv;
38564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38565 this_ptr_conv.is_owned = false;
38566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38567 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
38568 uint32_t ret_ref = 0;
38569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38572 ret_ref = (uintptr_t)ret_var.inner;
38573 if (ret_var.is_owned) {
38579 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
38580 LDKChannelInfo this_ptr_conv;
38581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38582 this_ptr_conv.is_owned = false;
38583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38584 LDKChannelFeatures val_conv;
38585 val_conv.inner = (void*)(val & (~1));
38586 val_conv.is_owned = (val & 1) || (val == 0);
38587 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38588 val_conv = ChannelFeatures_clone(&val_conv);
38589 ChannelInfo_set_features(&this_ptr_conv, val_conv);
38592 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
38593 LDKChannelInfo this_ptr_conv;
38594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38595 this_ptr_conv.is_owned = false;
38596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38597 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
38598 uint32_t ret_ref = 0;
38599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38602 ret_ref = (uintptr_t)ret_var.inner;
38603 if (ret_var.is_owned) {
38609 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
38610 LDKChannelInfo this_ptr_conv;
38611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38612 this_ptr_conv.is_owned = false;
38613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38614 LDKNodeId val_conv;
38615 val_conv.inner = (void*)(val & (~1));
38616 val_conv.is_owned = (val & 1) || (val == 0);
38617 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38618 val_conv = NodeId_clone(&val_conv);
38619 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
38622 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
38623 LDKChannelInfo this_ptr_conv;
38624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38625 this_ptr_conv.is_owned = false;
38626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38627 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
38628 uint32_t ret_ref = 0;
38629 if ((uintptr_t)ret_var.inner > 4096) {
38630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38633 ret_ref = (uintptr_t)ret_var.inner;
38634 if (ret_var.is_owned) {
38641 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
38642 LDKChannelInfo this_ptr_conv;
38643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38644 this_ptr_conv.is_owned = false;
38645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38646 LDKChannelUpdateInfo val_conv;
38647 val_conv.inner = (void*)(val & (~1));
38648 val_conv.is_owned = (val & 1) || (val == 0);
38649 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38650 val_conv = ChannelUpdateInfo_clone(&val_conv);
38651 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
38654 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
38655 LDKChannelInfo this_ptr_conv;
38656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38657 this_ptr_conv.is_owned = false;
38658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38659 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
38660 uint32_t ret_ref = 0;
38661 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38662 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38664 ret_ref = (uintptr_t)ret_var.inner;
38665 if (ret_var.is_owned) {
38671 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
38672 LDKChannelInfo this_ptr_conv;
38673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38674 this_ptr_conv.is_owned = false;
38675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38676 LDKNodeId val_conv;
38677 val_conv.inner = (void*)(val & (~1));
38678 val_conv.is_owned = (val & 1) || (val == 0);
38679 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38680 val_conv = NodeId_clone(&val_conv);
38681 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
38684 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
38685 LDKChannelInfo this_ptr_conv;
38686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38687 this_ptr_conv.is_owned = false;
38688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38689 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
38690 uint32_t ret_ref = 0;
38691 if ((uintptr_t)ret_var.inner > 4096) {
38692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38695 ret_ref = (uintptr_t)ret_var.inner;
38696 if (ret_var.is_owned) {
38703 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
38704 LDKChannelInfo this_ptr_conv;
38705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38706 this_ptr_conv.is_owned = false;
38707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38708 LDKChannelUpdateInfo val_conv;
38709 val_conv.inner = (void*)(val & (~1));
38710 val_conv.is_owned = (val & 1) || (val == 0);
38711 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38712 val_conv = ChannelUpdateInfo_clone(&val_conv);
38713 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
38716 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
38717 LDKChannelInfo this_ptr_conv;
38718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38719 this_ptr_conv.is_owned = false;
38720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38721 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38722 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
38723 uint32_t ret_ref = (uintptr_t)ret_copy;
38727 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
38728 LDKChannelInfo this_ptr_conv;
38729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38730 this_ptr_conv.is_owned = false;
38731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38732 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38733 CHECK_ACCESS(val_ptr);
38734 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38735 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38736 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
38739 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
38740 LDKChannelInfo this_ptr_conv;
38741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38742 this_ptr_conv.is_owned = false;
38743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38744 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
38745 uint32_t ret_ref = 0;
38746 if ((uintptr_t)ret_var.inner > 4096) {
38747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38750 ret_ref = (uintptr_t)ret_var.inner;
38751 if (ret_var.is_owned) {
38758 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
38759 LDKChannelInfo this_ptr_conv;
38760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38761 this_ptr_conv.is_owned = false;
38762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38763 LDKChannelAnnouncement val_conv;
38764 val_conv.inner = (void*)(val & (~1));
38765 val_conv.is_owned = (val & 1) || (val == 0);
38766 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38767 val_conv = ChannelAnnouncement_clone(&val_conv);
38768 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
38771 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
38772 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
38773 uint32_t ret_ref = 0;
38774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38777 ret_ref = (uintptr_t)ret_var.inner;
38778 if (ret_var.is_owned) {
38783 uint32_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
38784 LDKChannelInfo arg_conv;
38785 arg_conv.inner = (void*)(arg & (~1));
38786 arg_conv.is_owned = false;
38787 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38788 uint32_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
38792 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
38793 LDKChannelInfo orig_conv;
38794 orig_conv.inner = (void*)(orig & (~1));
38795 orig_conv.is_owned = false;
38796 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38797 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
38798 uint32_t ret_ref = 0;
38799 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38800 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38802 ret_ref = (uintptr_t)ret_var.inner;
38803 if (ret_var.is_owned) {
38809 uint32_t __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint32_t this_arg, int8_t channel_flags) {
38810 LDKChannelInfo this_arg_conv;
38811 this_arg_conv.inner = (void*)(this_arg & (~1));
38812 this_arg_conv.is_owned = false;
38813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38814 LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
38815 uint32_t ret_ref = 0;
38816 if ((uintptr_t)ret_var.inner > 4096) {
38817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38820 ret_ref = (uintptr_t)ret_var.inner;
38821 if (ret_var.is_owned) {
38828 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
38829 LDKChannelInfo obj_conv;
38830 obj_conv.inner = (void*)(obj & (~1));
38831 obj_conv.is_owned = false;
38832 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38833 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
38834 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38835 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38836 CVec_u8Z_free(ret_var);
38840 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
38841 LDKu8slice ser_ref;
38842 ser_ref.datalen = ser->arr_len;
38843 ser_ref.data = ser->elems;
38844 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
38845 *ret_conv = ChannelInfo_read(ser_ref);
38847 return (uint32_t)ret_conv;
38850 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
38851 LDKDirectedChannelInfo this_obj_conv;
38852 this_obj_conv.inner = (void*)(this_obj & (~1));
38853 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38855 DirectedChannelInfo_free(this_obj_conv);
38858 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
38859 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
38860 uint32_t ret_ref = 0;
38861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38864 ret_ref = (uintptr_t)ret_var.inner;
38865 if (ret_var.is_owned) {
38870 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
38871 LDKDirectedChannelInfo arg_conv;
38872 arg_conv.inner = (void*)(arg & (~1));
38873 arg_conv.is_owned = false;
38874 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38875 uint32_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
38879 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
38880 LDKDirectedChannelInfo orig_conv;
38881 orig_conv.inner = (void*)(orig & (~1));
38882 orig_conv.is_owned = false;
38883 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38884 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
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 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
38897 LDKDirectedChannelInfo this_arg_conv;
38898 this_arg_conv.inner = (void*)(this_arg & (~1));
38899 this_arg_conv.is_owned = false;
38900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38901 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
38902 uint32_t ret_ref = 0;
38903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38906 ret_ref = (uintptr_t)ret_var.inner;
38907 if (ret_var.is_owned) {
38913 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
38914 LDKDirectedChannelInfo this_arg_conv;
38915 this_arg_conv.inner = (void*)(this_arg & (~1));
38916 this_arg_conv.is_owned = false;
38917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38918 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
38919 uint32_t ret_ref = 0;
38920 if ((uintptr_t)ret_var.inner > 4096) {
38921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38924 ret_ref = (uintptr_t)ret_var.inner;
38925 if (ret_var.is_owned) {
38932 int64_t __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint32_t this_arg) {
38933 LDKDirectedChannelInfo this_arg_conv;
38934 this_arg_conv.inner = (void*)(this_arg & (~1));
38935 this_arg_conv.is_owned = false;
38936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38937 int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
38941 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
38942 LDKDirectedChannelInfo this_arg_conv;
38943 this_arg_conv.inner = (void*)(this_arg & (~1));
38944 this_arg_conv.is_owned = false;
38945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38946 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38947 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
38948 uint32_t ret_ref = (uintptr_t)ret_copy;
38952 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
38953 if ((this_ptr & 1) != 0) return;
38954 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38955 CHECK_ACCESS(this_ptr_ptr);
38956 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
38957 FREE((void*)this_ptr);
38958 EffectiveCapacity_free(this_ptr_conv);
38961 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
38962 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38963 *ret_copy = EffectiveCapacity_clone(arg);
38964 uint32_t ret_ref = (uintptr_t)ret_copy;
38967 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
38968 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
38969 uint32_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
38973 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
38974 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
38975 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38976 *ret_copy = EffectiveCapacity_clone(orig_conv);
38977 uint32_t ret_ref = (uintptr_t)ret_copy;
38981 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
38982 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38983 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
38984 uint32_t ret_ref = (uintptr_t)ret_copy;
38988 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
38989 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38990 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
38991 uint32_t ret_ref = (uintptr_t)ret_copy;
38995 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat) {
38996 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38997 *ret_copy = EffectiveCapacity_total(capacity_msat);
38998 uint32_t ret_ref = (uintptr_t)ret_copy;
39002 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
39003 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39004 *ret_copy = EffectiveCapacity_infinite();
39005 uint32_t ret_ref = (uintptr_t)ret_copy;
39009 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
39010 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
39011 *ret_copy = EffectiveCapacity_unknown();
39012 uint32_t ret_ref = (uintptr_t)ret_copy;
39016 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
39017 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
39018 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
39022 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
39023 LDKRoutingFees this_obj_conv;
39024 this_obj_conv.inner = (void*)(this_obj & (~1));
39025 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39027 RoutingFees_free(this_obj_conv);
39030 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
39031 LDKRoutingFees this_ptr_conv;
39032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39033 this_ptr_conv.is_owned = false;
39034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39035 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
39039 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
39040 LDKRoutingFees this_ptr_conv;
39041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39042 this_ptr_conv.is_owned = false;
39043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39044 RoutingFees_set_base_msat(&this_ptr_conv, val);
39047 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
39048 LDKRoutingFees this_ptr_conv;
39049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39050 this_ptr_conv.is_owned = false;
39051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39052 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
39056 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
39057 LDKRoutingFees this_ptr_conv;
39058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39059 this_ptr_conv.is_owned = false;
39060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39061 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
39064 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
39065 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
39066 uint32_t ret_ref = 0;
39067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39070 ret_ref = (uintptr_t)ret_var.inner;
39071 if (ret_var.is_owned) {
39077 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
39078 LDKRoutingFees a_conv;
39079 a_conv.inner = (void*)(a & (~1));
39080 a_conv.is_owned = false;
39081 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39082 LDKRoutingFees b_conv;
39083 b_conv.inner = (void*)(b & (~1));
39084 b_conv.is_owned = false;
39085 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39086 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
39090 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
39091 LDKRoutingFees ret_var = RoutingFees_clone(arg);
39092 uint32_t ret_ref = 0;
39093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39096 ret_ref = (uintptr_t)ret_var.inner;
39097 if (ret_var.is_owned) {
39102 uint32_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
39103 LDKRoutingFees arg_conv;
39104 arg_conv.inner = (void*)(arg & (~1));
39105 arg_conv.is_owned = false;
39106 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39107 uint32_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
39111 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
39112 LDKRoutingFees orig_conv;
39113 orig_conv.inner = (void*)(orig & (~1));
39114 orig_conv.is_owned = false;
39115 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39116 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
39117 uint32_t ret_ref = 0;
39118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39121 ret_ref = (uintptr_t)ret_var.inner;
39122 if (ret_var.is_owned) {
39128 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
39129 LDKRoutingFees o_conv;
39130 o_conv.inner = (void*)(o & (~1));
39131 o_conv.is_owned = false;
39132 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39133 int64_t ret_conv = RoutingFees_hash(&o_conv);
39137 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
39138 LDKRoutingFees obj_conv;
39139 obj_conv.inner = (void*)(obj & (~1));
39140 obj_conv.is_owned = false;
39141 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39142 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
39143 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39144 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39145 CVec_u8Z_free(ret_var);
39149 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
39150 LDKu8slice ser_ref;
39151 ser_ref.datalen = ser->arr_len;
39152 ser_ref.data = ser->elems;
39153 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
39154 *ret_conv = RoutingFees_read(ser_ref);
39156 return (uint32_t)ret_conv;
39159 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
39160 LDKNodeAnnouncementInfo this_obj_conv;
39161 this_obj_conv.inner = (void*)(this_obj & (~1));
39162 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39164 NodeAnnouncementInfo_free(this_obj_conv);
39167 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
39168 LDKNodeAnnouncementInfo this_ptr_conv;
39169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39170 this_ptr_conv.is_owned = false;
39171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39172 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
39173 uint32_t ret_ref = 0;
39174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39177 ret_ref = (uintptr_t)ret_var.inner;
39178 if (ret_var.is_owned) {
39184 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
39185 LDKNodeAnnouncementInfo this_ptr_conv;
39186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39187 this_ptr_conv.is_owned = false;
39188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39189 LDKNodeFeatures val_conv;
39190 val_conv.inner = (void*)(val & (~1));
39191 val_conv.is_owned = (val & 1) || (val == 0);
39192 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39193 val_conv = NodeFeatures_clone(&val_conv);
39194 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
39197 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
39198 LDKNodeAnnouncementInfo this_ptr_conv;
39199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39200 this_ptr_conv.is_owned = false;
39201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39202 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
39206 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
39207 LDKNodeAnnouncementInfo this_ptr_conv;
39208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39209 this_ptr_conv.is_owned = false;
39210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39211 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
39214 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
39215 LDKNodeAnnouncementInfo this_ptr_conv;
39216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39217 this_ptr_conv.is_owned = false;
39218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39219 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
39220 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
39224 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
39225 LDKNodeAnnouncementInfo this_ptr_conv;
39226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39227 this_ptr_conv.is_owned = false;
39228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39229 LDKThreeBytes val_ref;
39230 CHECK(val->arr_len == 3);
39231 memcpy(val_ref.data, val->elems, 3); FREE(val);
39232 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
39235 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
39236 LDKNodeAnnouncementInfo this_ptr_conv;
39237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39238 this_ptr_conv.is_owned = false;
39239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39240 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39241 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
39245 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
39246 LDKNodeAnnouncementInfo this_ptr_conv;
39247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39248 this_ptr_conv.is_owned = false;
39249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39250 LDKThirtyTwoBytes val_ref;
39251 CHECK(val->arr_len == 32);
39252 memcpy(val_ref.data, val->elems, 32); FREE(val);
39253 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
39256 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
39257 LDKNodeAnnouncementInfo this_ptr_conv;
39258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39259 this_ptr_conv.is_owned = false;
39260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39261 LDKCVec_NetAddressZ val_constr;
39262 val_constr.datalen = val->arr_len;
39263 if (val_constr.datalen > 0)
39264 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39266 val_constr.data = NULL;
39267 uint32_t* val_vals = val->elems;
39268 for (size_t m = 0; m < val_constr.datalen; m++) {
39269 uint32_t val_conv_12 = val_vals[m];
39270 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
39271 CHECK_ACCESS(val_conv_12_ptr);
39272 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
39273 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
39274 val_constr.data[m] = val_conv_12_conv;
39277 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
39280 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
39281 LDKNodeAnnouncementInfo this_ptr_conv;
39282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39283 this_ptr_conv.is_owned = false;
39284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39285 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
39286 uint32_t ret_ref = 0;
39287 if ((uintptr_t)ret_var.inner > 4096) {
39288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39291 ret_ref = (uintptr_t)ret_var.inner;
39292 if (ret_var.is_owned) {
39299 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
39300 LDKNodeAnnouncementInfo this_ptr_conv;
39301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39302 this_ptr_conv.is_owned = false;
39303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39304 LDKNodeAnnouncement val_conv;
39305 val_conv.inner = (void*)(val & (~1));
39306 val_conv.is_owned = (val & 1) || (val == 0);
39307 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39308 val_conv = NodeAnnouncement_clone(&val_conv);
39309 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
39312 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) {
39313 LDKNodeFeatures features_arg_conv;
39314 features_arg_conv.inner = (void*)(features_arg & (~1));
39315 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
39316 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39317 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
39318 LDKThreeBytes rgb_arg_ref;
39319 CHECK(rgb_arg->arr_len == 3);
39320 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
39321 LDKThirtyTwoBytes alias_arg_ref;
39322 CHECK(alias_arg->arr_len == 32);
39323 memcpy(alias_arg_ref.data, alias_arg->elems, 32); FREE(alias_arg);
39324 LDKCVec_NetAddressZ addresses_arg_constr;
39325 addresses_arg_constr.datalen = addresses_arg->arr_len;
39326 if (addresses_arg_constr.datalen > 0)
39327 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39329 addresses_arg_constr.data = NULL;
39330 uint32_t* addresses_arg_vals = addresses_arg->elems;
39331 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
39332 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
39333 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
39334 CHECK_ACCESS(addresses_arg_conv_12_ptr);
39335 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
39336 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
39338 FREE(addresses_arg);
39339 LDKNodeAnnouncement announcement_message_arg_conv;
39340 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
39341 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
39342 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
39343 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
39344 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_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 NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
39357 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_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_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
39369 LDKNodeAnnouncementInfo 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 = NodeAnnouncementInfo_clone_ptr(&arg_conv);
39377 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
39378 LDKNodeAnnouncementInfo 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 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_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_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
39395 LDKNodeAnnouncementInfo 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 = NodeAnnouncementInfo_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_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
39407 LDKu8slice ser_ref;
39408 ser_ref.datalen = ser->arr_len;
39409 ser_ref.data = ser->elems;
39410 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
39411 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
39413 return (uint32_t)ret_conv;
39416 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
39417 LDKNodeInfo this_obj_conv;
39418 this_obj_conv.inner = (void*)(this_obj & (~1));
39419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39421 NodeInfo_free(this_obj_conv);
39424 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
39425 LDKNodeInfo this_ptr_conv;
39426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39427 this_ptr_conv.is_owned = false;
39428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39429 LDKCVec_u64Z val_constr;
39430 val_constr.datalen = val->arr_len;
39431 if (val_constr.datalen > 0)
39432 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39434 val_constr.data = NULL;
39435 int64_t* val_vals = val->elems;
39436 for (size_t i = 0; i < val_constr.datalen; i++) {
39437 int64_t val_conv_8 = val_vals[i];
39438 val_constr.data[i] = val_conv_8;
39441 NodeInfo_set_channels(&this_ptr_conv, val_constr);
39444 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
39445 LDKNodeInfo this_ptr_conv;
39446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39447 this_ptr_conv.is_owned = false;
39448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39449 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
39450 uint32_t ret_ref = 0;
39451 if ((uintptr_t)ret_var.inner > 4096) {
39452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39455 ret_ref = (uintptr_t)ret_var.inner;
39456 if (ret_var.is_owned) {
39463 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) {
39464 LDKNodeInfo this_ptr_conv;
39465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39466 this_ptr_conv.is_owned = false;
39467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39468 LDKRoutingFees val_conv;
39469 val_conv.inner = (void*)(val & (~1));
39470 val_conv.is_owned = (val & 1) || (val == 0);
39471 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39472 val_conv = RoutingFees_clone(&val_conv);
39473 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
39476 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
39477 LDKNodeInfo this_ptr_conv;
39478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39479 this_ptr_conv.is_owned = false;
39480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39481 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
39482 uint32_t ret_ref = 0;
39483 if ((uintptr_t)ret_var.inner > 4096) {
39484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39487 ret_ref = (uintptr_t)ret_var.inner;
39488 if (ret_var.is_owned) {
39495 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
39496 LDKNodeInfo this_ptr_conv;
39497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39498 this_ptr_conv.is_owned = false;
39499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39500 LDKNodeAnnouncementInfo val_conv;
39501 val_conv.inner = (void*)(val & (~1));
39502 val_conv.is_owned = (val & 1) || (val == 0);
39503 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39504 val_conv = NodeAnnouncementInfo_clone(&val_conv);
39505 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
39508 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) {
39509 LDKCVec_u64Z channels_arg_constr;
39510 channels_arg_constr.datalen = channels_arg->arr_len;
39511 if (channels_arg_constr.datalen > 0)
39512 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39514 channels_arg_constr.data = NULL;
39515 int64_t* channels_arg_vals = channels_arg->elems;
39516 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
39517 int64_t channels_arg_conv_8 = channels_arg_vals[i];
39518 channels_arg_constr.data[i] = channels_arg_conv_8;
39520 FREE(channels_arg);
39521 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
39522 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
39523 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
39524 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
39525 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
39526 LDKNodeAnnouncementInfo announcement_info_arg_conv;
39527 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
39528 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
39529 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
39530 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
39531 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
39532 uint32_t ret_ref = 0;
39533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39536 ret_ref = (uintptr_t)ret_var.inner;
39537 if (ret_var.is_owned) {
39543 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
39544 LDKNodeInfo ret_var = NodeInfo_clone(arg);
39545 uint32_t ret_ref = 0;
39546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39549 ret_ref = (uintptr_t)ret_var.inner;
39550 if (ret_var.is_owned) {
39555 uint32_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
39556 LDKNodeInfo arg_conv;
39557 arg_conv.inner = (void*)(arg & (~1));
39558 arg_conv.is_owned = false;
39559 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39560 uint32_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
39564 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
39565 LDKNodeInfo orig_conv;
39566 orig_conv.inner = (void*)(orig & (~1));
39567 orig_conv.is_owned = false;
39568 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39569 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
39570 uint32_t ret_ref = 0;
39571 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39572 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39574 ret_ref = (uintptr_t)ret_var.inner;
39575 if (ret_var.is_owned) {
39581 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
39582 LDKNodeInfo obj_conv;
39583 obj_conv.inner = (void*)(obj & (~1));
39584 obj_conv.is_owned = false;
39585 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39586 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
39587 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39588 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39589 CVec_u8Z_free(ret_var);
39593 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
39594 LDKu8slice ser_ref;
39595 ser_ref.datalen = ser->arr_len;
39596 ser_ref.data = ser->elems;
39597 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
39598 *ret_conv = NodeInfo_read(ser_ref);
39600 return (uint32_t)ret_conv;
39603 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
39604 LDKNetworkGraph obj_conv;
39605 obj_conv.inner = (void*)(obj & (~1));
39606 obj_conv.is_owned = false;
39607 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39608 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
39609 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39610 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39611 CVec_u8Z_free(ret_var);
39615 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint32_t arg) {
39616 LDKu8slice ser_ref;
39617 ser_ref.datalen = ser->arr_len;
39618 ser_ref.data = ser->elems;
39619 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39620 CHECK_ACCESS(arg_ptr);
39621 LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
39622 if (arg_conv.free == LDKLogger_JCalls_free) {
39623 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39624 LDKLogger_JCalls_cloned(&arg_conv);
39626 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
39627 *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
39629 return (uint32_t)ret_conv;
39632 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint32_t logger) {
39633 LDKThirtyTwoBytes genesis_hash_ref;
39634 CHECK(genesis_hash->arr_len == 32);
39635 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
39636 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39637 CHECK_ACCESS(logger_ptr);
39638 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39639 if (logger_conv.free == LDKLogger_JCalls_free) {
39640 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39641 LDKLogger_JCalls_cloned(&logger_conv);
39643 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
39644 uint32_t ret_ref = 0;
39645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39648 ret_ref = (uintptr_t)ret_var.inner;
39649 if (ret_var.is_owned) {
39655 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
39656 LDKNetworkGraph this_arg_conv;
39657 this_arg_conv.inner = (void*)(this_arg & (~1));
39658 this_arg_conv.is_owned = false;
39659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39660 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
39661 uint32_t ret_ref = 0;
39662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39665 ret_ref = (uintptr_t)ret_var.inner;
39666 if (ret_var.is_owned) {
39672 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) {
39673 LDKNetworkGraph this_arg_conv;
39674 this_arg_conv.inner = (void*)(this_arg & (~1));
39675 this_arg_conv.is_owned = false;
39676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39677 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39678 *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
39679 uint32_t ret_ref = (uintptr_t)ret_copy;
39683 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) {
39684 LDKNetworkGraph this_arg_conv;
39685 this_arg_conv.inner = (void*)(this_arg & (~1));
39686 this_arg_conv.is_owned = false;
39687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39688 NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
39691 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
39692 LDKNetworkGraph this_arg_conv;
39693 this_arg_conv.inner = (void*)(this_arg & (~1));
39694 this_arg_conv.is_owned = false;
39695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39696 LDKNodeAnnouncement msg_conv;
39697 msg_conv.inner = (void*)(msg & (~1));
39698 msg_conv.is_owned = false;
39699 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39700 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39701 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
39702 return (uint32_t)ret_conv;
39705 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) {
39706 LDKNetworkGraph this_arg_conv;
39707 this_arg_conv.inner = (void*)(this_arg & (~1));
39708 this_arg_conv.is_owned = false;
39709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39710 LDKUnsignedNodeAnnouncement msg_conv;
39711 msg_conv.inner = (void*)(msg & (~1));
39712 msg_conv.is_owned = false;
39713 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39714 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39715 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
39716 return (uint32_t)ret_conv;
39719 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) {
39720 LDKNetworkGraph this_arg_conv;
39721 this_arg_conv.inner = (void*)(this_arg & (~1));
39722 this_arg_conv.is_owned = false;
39723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39724 LDKChannelAnnouncement msg_conv;
39725 msg_conv.inner = (void*)(msg & (~1));
39726 msg_conv.is_owned = false;
39727 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39728 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39729 CHECK_ACCESS(chain_access_ptr);
39730 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39731 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39732 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39733 // Manually implement clone for Java trait instances
39734 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39735 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39736 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39739 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39740 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39741 return (uint32_t)ret_conv;
39744 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) {
39745 LDKNetworkGraph this_arg_conv;
39746 this_arg_conv.inner = (void*)(this_arg & (~1));
39747 this_arg_conv.is_owned = false;
39748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39749 LDKUnsignedChannelAnnouncement msg_conv;
39750 msg_conv.inner = (void*)(msg & (~1));
39751 msg_conv.is_owned = false;
39752 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39753 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39754 CHECK_ACCESS(chain_access_ptr);
39755 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39756 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39757 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39758 // Manually implement clone for Java trait instances
39759 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39761 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39764 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39765 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39766 return (uint32_t)ret_conv;
39769 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) {
39770 LDKNetworkGraph this_arg_conv;
39771 this_arg_conv.inner = (void*)(this_arg & (~1));
39772 this_arg_conv.is_owned = false;
39773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39774 LDKChannelFeatures features_conv;
39775 features_conv.inner = (void*)(features & (~1));
39776 features_conv.is_owned = (features & 1) || (features == 0);
39777 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39778 features_conv = ChannelFeatures_clone(&features_conv);
39779 LDKPublicKey node_id_1_ref;
39780 CHECK(node_id_1->arr_len == 33);
39781 memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
39782 LDKPublicKey node_id_2_ref;
39783 CHECK(node_id_2->arr_len == 33);
39784 memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
39785 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39786 *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);
39787 return (uint32_t)ret_conv;
39790 void __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
39791 LDKNetworkGraph this_arg_conv;
39792 this_arg_conv.inner = (void*)(this_arg & (~1));
39793 this_arg_conv.is_owned = false;
39794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39795 NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
39798 void __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
39799 LDKNetworkGraph this_arg_conv;
39800 this_arg_conv.inner = (void*)(this_arg & (~1));
39801 this_arg_conv.is_owned = false;
39802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39803 LDKPublicKey _node_id_ref;
39804 CHECK(_node_id->arr_len == 33);
39805 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
39806 NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
39809 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) {
39810 LDKNetworkGraph this_arg_conv;
39811 this_arg_conv.inner = (void*)(this_arg & (~1));
39812 this_arg_conv.is_owned = false;
39813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39814 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
39817 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
39818 LDKNetworkGraph this_arg_conv;
39819 this_arg_conv.inner = (void*)(this_arg & (~1));
39820 this_arg_conv.is_owned = false;
39821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39822 LDKChannelUpdate msg_conv;
39823 msg_conv.inner = (void*)(msg & (~1));
39824 msg_conv.is_owned = false;
39825 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39826 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39827 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
39828 return (uint32_t)ret_conv;
39831 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
39832 LDKNetworkGraph this_arg_conv;
39833 this_arg_conv.inner = (void*)(this_arg & (~1));
39834 this_arg_conv.is_owned = false;
39835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39836 LDKUnsignedChannelUpdate msg_conv;
39837 msg_conv.inner = (void*)(msg & (~1));
39838 msg_conv.is_owned = false;
39839 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39840 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39841 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
39842 return (uint32_t)ret_conv;
39845 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
39846 LDKReadOnlyNetworkGraph this_arg_conv;
39847 this_arg_conv.inner = (void*)(this_arg & (~1));
39848 this_arg_conv.is_owned = false;
39849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39850 LDKPublicKey pubkey_ref;
39851 CHECK(pubkey->arr_len == 33);
39852 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39853 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
39854 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
39855 uint32_t ret_ref = (uintptr_t)ret_copy;
39859 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
39860 LDKRouteHop this_obj_conv;
39861 this_obj_conv.inner = (void*)(this_obj & (~1));
39862 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39864 RouteHop_free(this_obj_conv);
39867 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
39868 LDKRouteHop this_ptr_conv;
39869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39870 this_ptr_conv.is_owned = false;
39871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39872 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39873 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
39877 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
39878 LDKRouteHop this_ptr_conv;
39879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39880 this_ptr_conv.is_owned = false;
39881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39882 LDKPublicKey val_ref;
39883 CHECK(val->arr_len == 33);
39884 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39885 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
39888 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
39889 LDKRouteHop this_ptr_conv;
39890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39891 this_ptr_conv.is_owned = false;
39892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39893 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
39894 uint32_t ret_ref = 0;
39895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39898 ret_ref = (uintptr_t)ret_var.inner;
39899 if (ret_var.is_owned) {
39905 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
39906 LDKRouteHop this_ptr_conv;
39907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39908 this_ptr_conv.is_owned = false;
39909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39910 LDKNodeFeatures val_conv;
39911 val_conv.inner = (void*)(val & (~1));
39912 val_conv.is_owned = (val & 1) || (val == 0);
39913 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39914 val_conv = NodeFeatures_clone(&val_conv);
39915 RouteHop_set_node_features(&this_ptr_conv, val_conv);
39918 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
39919 LDKRouteHop this_ptr_conv;
39920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39921 this_ptr_conv.is_owned = false;
39922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39923 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
39927 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
39928 LDKRouteHop this_ptr_conv;
39929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39930 this_ptr_conv.is_owned = false;
39931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39932 RouteHop_set_short_channel_id(&this_ptr_conv, val);
39935 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
39936 LDKRouteHop this_ptr_conv;
39937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39938 this_ptr_conv.is_owned = false;
39939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39940 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
39941 uint32_t ret_ref = 0;
39942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39945 ret_ref = (uintptr_t)ret_var.inner;
39946 if (ret_var.is_owned) {
39952 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
39953 LDKRouteHop this_ptr_conv;
39954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39955 this_ptr_conv.is_owned = false;
39956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39957 LDKChannelFeatures val_conv;
39958 val_conv.inner = (void*)(val & (~1));
39959 val_conv.is_owned = (val & 1) || (val == 0);
39960 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39961 val_conv = ChannelFeatures_clone(&val_conv);
39962 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
39965 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
39966 LDKRouteHop this_ptr_conv;
39967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39968 this_ptr_conv.is_owned = false;
39969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39970 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
39974 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
39975 LDKRouteHop this_ptr_conv;
39976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39977 this_ptr_conv.is_owned = false;
39978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39979 RouteHop_set_fee_msat(&this_ptr_conv, val);
39982 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
39983 LDKRouteHop this_ptr_conv;
39984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39985 this_ptr_conv.is_owned = false;
39986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39987 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
39991 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
39992 LDKRouteHop this_ptr_conv;
39993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39994 this_ptr_conv.is_owned = false;
39995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39996 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
39999 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) {
40000 LDKPublicKey pubkey_arg_ref;
40001 CHECK(pubkey_arg->arr_len == 33);
40002 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
40003 LDKNodeFeatures node_features_arg_conv;
40004 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
40005 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
40006 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
40007 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
40008 LDKChannelFeatures channel_features_arg_conv;
40009 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
40010 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
40011 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
40012 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
40013 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);
40014 uint32_t ret_ref = 0;
40015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40018 ret_ref = (uintptr_t)ret_var.inner;
40019 if (ret_var.is_owned) {
40025 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
40026 LDKRouteHop ret_var = RouteHop_clone(arg);
40027 uint32_t ret_ref = 0;
40028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40031 ret_ref = (uintptr_t)ret_var.inner;
40032 if (ret_var.is_owned) {
40037 uint32_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
40038 LDKRouteHop arg_conv;
40039 arg_conv.inner = (void*)(arg & (~1));
40040 arg_conv.is_owned = false;
40041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40042 uint32_t ret_conv = RouteHop_clone_ptr(&arg_conv);
40046 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
40047 LDKRouteHop orig_conv;
40048 orig_conv.inner = (void*)(orig & (~1));
40049 orig_conv.is_owned = false;
40050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40051 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
40052 uint32_t ret_ref = 0;
40053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40056 ret_ref = (uintptr_t)ret_var.inner;
40057 if (ret_var.is_owned) {
40063 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
40064 LDKRouteHop o_conv;
40065 o_conv.inner = (void*)(o & (~1));
40066 o_conv.is_owned = false;
40067 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40068 int64_t ret_conv = RouteHop_hash(&o_conv);
40072 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
40073 LDKRouteHop a_conv;
40074 a_conv.inner = (void*)(a & (~1));
40075 a_conv.is_owned = false;
40076 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40077 LDKRouteHop b_conv;
40078 b_conv.inner = (void*)(b & (~1));
40079 b_conv.is_owned = false;
40080 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40081 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
40085 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
40086 LDKRouteHop obj_conv;
40087 obj_conv.inner = (void*)(obj & (~1));
40088 obj_conv.is_owned = false;
40089 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40090 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
40091 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40092 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40093 CVec_u8Z_free(ret_var);
40097 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
40098 LDKu8slice ser_ref;
40099 ser_ref.datalen = ser->arr_len;
40100 ser_ref.data = ser->elems;
40101 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
40102 *ret_conv = RouteHop_read(ser_ref);
40104 return (uint32_t)ret_conv;
40107 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
40108 LDKRoute this_obj_conv;
40109 this_obj_conv.inner = (void*)(this_obj & (~1));
40110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40112 Route_free(this_obj_conv);
40115 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
40116 LDKRoute this_ptr_conv;
40117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40118 this_ptr_conv.is_owned = false;
40119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40120 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
40121 ptrArray ret_arr = NULL;
40122 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
40123 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
40124 for (size_t m = 0; m < ret_var.datalen; m++) {
40125 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
40126 uint32_tArray ret_conv_12_arr = NULL;
40127 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
40128 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
40129 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
40130 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
40131 uint32_t ret_conv_12_conv_10_ref = 0;
40132 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40133 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
40135 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
40136 if (ret_conv_12_conv_10_var.is_owned) {
40137 ret_conv_12_conv_10_ref |= 1;
40139 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
40142 FREE(ret_conv_12_var.data);
40143 ret_arr_ptr[m] = ret_conv_12_arr;
40146 FREE(ret_var.data);
40150 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
40151 LDKRoute this_ptr_conv;
40152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40153 this_ptr_conv.is_owned = false;
40154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40155 LDKCVec_CVec_RouteHopZZ val_constr;
40156 val_constr.datalen = val->arr_len;
40157 if (val_constr.datalen > 0)
40158 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40160 val_constr.data = NULL;
40161 uint32_tArray* val_vals = (void*) val->elems;
40162 for (size_t m = 0; m < val_constr.datalen; m++) {
40163 uint32_tArray val_conv_12 = val_vals[m];
40164 LDKCVec_RouteHopZ val_conv_12_constr;
40165 val_conv_12_constr.datalen = val_conv_12->arr_len;
40166 if (val_conv_12_constr.datalen > 0)
40167 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40169 val_conv_12_constr.data = NULL;
40170 uint32_t* val_conv_12_vals = val_conv_12->elems;
40171 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
40172 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
40173 LDKRouteHop val_conv_12_conv_10_conv;
40174 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
40175 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
40176 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
40177 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
40178 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
40181 val_constr.data[m] = val_conv_12_constr;
40184 Route_set_paths(&this_ptr_conv, val_constr);
40187 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
40188 LDKRoute this_ptr_conv;
40189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40190 this_ptr_conv.is_owned = false;
40191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40192 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
40193 uint32_t ret_ref = 0;
40194 if ((uintptr_t)ret_var.inner > 4096) {
40195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40198 ret_ref = (uintptr_t)ret_var.inner;
40199 if (ret_var.is_owned) {
40206 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
40207 LDKRoute this_ptr_conv;
40208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40209 this_ptr_conv.is_owned = false;
40210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40211 LDKPaymentParameters val_conv;
40212 val_conv.inner = (void*)(val & (~1));
40213 val_conv.is_owned = (val & 1) || (val == 0);
40214 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40215 val_conv = PaymentParameters_clone(&val_conv);
40216 Route_set_payment_params(&this_ptr_conv, val_conv);
40219 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
40220 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
40221 paths_arg_constr.datalen = paths_arg->arr_len;
40222 if (paths_arg_constr.datalen > 0)
40223 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40225 paths_arg_constr.data = NULL;
40226 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
40227 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
40228 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
40229 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
40230 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
40231 if (paths_arg_conv_12_constr.datalen > 0)
40232 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40234 paths_arg_conv_12_constr.data = NULL;
40235 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
40236 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
40237 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
40238 LDKRouteHop paths_arg_conv_12_conv_10_conv;
40239 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
40240 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
40241 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
40242 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
40243 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
40245 FREE(paths_arg_conv_12);
40246 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
40249 LDKPaymentParameters payment_params_arg_conv;
40250 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40251 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40252 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40253 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40254 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
40255 uint32_t ret_ref = 0;
40256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40259 ret_ref = (uintptr_t)ret_var.inner;
40260 if (ret_var.is_owned) {
40266 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
40267 LDKRoute ret_var = Route_clone(arg);
40268 uint32_t ret_ref = 0;
40269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40272 ret_ref = (uintptr_t)ret_var.inner;
40273 if (ret_var.is_owned) {
40278 uint32_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
40280 arg_conv.inner = (void*)(arg & (~1));
40281 arg_conv.is_owned = false;
40282 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40283 uint32_t ret_conv = Route_clone_ptr(&arg_conv);
40287 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
40288 LDKRoute orig_conv;
40289 orig_conv.inner = (void*)(orig & (~1));
40290 orig_conv.is_owned = false;
40291 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40292 LDKRoute ret_var = Route_clone(&orig_conv);
40293 uint32_t ret_ref = 0;
40294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40297 ret_ref = (uintptr_t)ret_var.inner;
40298 if (ret_var.is_owned) {
40304 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
40306 o_conv.inner = (void*)(o & (~1));
40307 o_conv.is_owned = false;
40308 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40309 int64_t ret_conv = Route_hash(&o_conv);
40313 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
40315 a_conv.inner = (void*)(a & (~1));
40316 a_conv.is_owned = false;
40317 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40319 b_conv.inner = (void*)(b & (~1));
40320 b_conv.is_owned = false;
40321 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40322 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
40326 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
40327 LDKRoute this_arg_conv;
40328 this_arg_conv.inner = (void*)(this_arg & (~1));
40329 this_arg_conv.is_owned = false;
40330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40331 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
40335 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
40336 LDKRoute this_arg_conv;
40337 this_arg_conv.inner = (void*)(this_arg & (~1));
40338 this_arg_conv.is_owned = false;
40339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40340 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
40344 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
40346 obj_conv.inner = (void*)(obj & (~1));
40347 obj_conv.is_owned = false;
40348 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40349 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
40350 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40351 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40352 CVec_u8Z_free(ret_var);
40356 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
40357 LDKu8slice ser_ref;
40358 ser_ref.datalen = ser->arr_len;
40359 ser_ref.data = ser->elems;
40360 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
40361 *ret_conv = Route_read(ser_ref);
40363 return (uint32_t)ret_conv;
40366 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
40367 LDKRouteParameters this_obj_conv;
40368 this_obj_conv.inner = (void*)(this_obj & (~1));
40369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40371 RouteParameters_free(this_obj_conv);
40374 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
40375 LDKRouteParameters this_ptr_conv;
40376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40377 this_ptr_conv.is_owned = false;
40378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40379 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
40380 uint32_t ret_ref = 0;
40381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40384 ret_ref = (uintptr_t)ret_var.inner;
40385 if (ret_var.is_owned) {
40391 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
40392 LDKRouteParameters this_ptr_conv;
40393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40394 this_ptr_conv.is_owned = false;
40395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40396 LDKPaymentParameters val_conv;
40397 val_conv.inner = (void*)(val & (~1));
40398 val_conv.is_owned = (val & 1) || (val == 0);
40399 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40400 val_conv = PaymentParameters_clone(&val_conv);
40401 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
40404 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
40405 LDKRouteParameters this_ptr_conv;
40406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40407 this_ptr_conv.is_owned = false;
40408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40409 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
40413 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
40414 LDKRouteParameters this_ptr_conv;
40415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40416 this_ptr_conv.is_owned = false;
40417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40418 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
40421 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
40422 LDKRouteParameters this_ptr_conv;
40423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40424 this_ptr_conv.is_owned = false;
40425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40426 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
40430 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) {
40431 LDKRouteParameters this_ptr_conv;
40432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40433 this_ptr_conv.is_owned = false;
40434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40435 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
40438 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) {
40439 LDKPaymentParameters payment_params_arg_conv;
40440 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
40441 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
40442 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40443 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40444 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
40445 uint32_t ret_ref = 0;
40446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40449 ret_ref = (uintptr_t)ret_var.inner;
40450 if (ret_var.is_owned) {
40456 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
40457 LDKRouteParameters ret_var = RouteParameters_clone(arg);
40458 uint32_t ret_ref = 0;
40459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40462 ret_ref = (uintptr_t)ret_var.inner;
40463 if (ret_var.is_owned) {
40468 uint32_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
40469 LDKRouteParameters arg_conv;
40470 arg_conv.inner = (void*)(arg & (~1));
40471 arg_conv.is_owned = false;
40472 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40473 uint32_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
40477 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
40478 LDKRouteParameters orig_conv;
40479 orig_conv.inner = (void*)(orig & (~1));
40480 orig_conv.is_owned = false;
40481 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40482 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
40483 uint32_t ret_ref = 0;
40484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40487 ret_ref = (uintptr_t)ret_var.inner;
40488 if (ret_var.is_owned) {
40494 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
40495 LDKRouteParameters obj_conv;
40496 obj_conv.inner = (void*)(obj & (~1));
40497 obj_conv.is_owned = false;
40498 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40499 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
40500 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40501 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40502 CVec_u8Z_free(ret_var);
40506 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
40507 LDKu8slice ser_ref;
40508 ser_ref.datalen = ser->arr_len;
40509 ser_ref.data = ser->elems;
40510 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
40511 *ret_conv = RouteParameters_read(ser_ref);
40513 return (uint32_t)ret_conv;
40516 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
40517 LDKPaymentParameters this_obj_conv;
40518 this_obj_conv.inner = (void*)(this_obj & (~1));
40519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40521 PaymentParameters_free(this_obj_conv);
40524 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
40525 LDKPaymentParameters this_ptr_conv;
40526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40527 this_ptr_conv.is_owned = false;
40528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40529 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40530 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
40534 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
40535 LDKPaymentParameters this_ptr_conv;
40536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40537 this_ptr_conv.is_owned = false;
40538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40539 LDKPublicKey val_ref;
40540 CHECK(val->arr_len == 33);
40541 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40542 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
40545 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
40546 LDKPaymentParameters this_ptr_conv;
40547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40548 this_ptr_conv.is_owned = false;
40549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40550 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
40551 uint32_t ret_ref = 0;
40552 if ((uintptr_t)ret_var.inner > 4096) {
40553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40556 ret_ref = (uintptr_t)ret_var.inner;
40557 if (ret_var.is_owned) {
40564 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
40565 LDKPaymentParameters this_ptr_conv;
40566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40567 this_ptr_conv.is_owned = false;
40568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40569 LDKInvoiceFeatures val_conv;
40570 val_conv.inner = (void*)(val & (~1));
40571 val_conv.is_owned = (val & 1) || (val == 0);
40572 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40573 val_conv = InvoiceFeatures_clone(&val_conv);
40574 PaymentParameters_set_features(&this_ptr_conv, val_conv);
40577 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
40578 LDKPaymentParameters this_ptr_conv;
40579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40580 this_ptr_conv.is_owned = false;
40581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40582 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
40583 uint32_tArray ret_arr = NULL;
40584 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40585 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40586 for (size_t l = 0; l < ret_var.datalen; l++) {
40587 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40588 uint32_t ret_conv_11_ref = 0;
40589 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40590 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40592 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
40593 if (ret_conv_11_var.is_owned) {
40594 ret_conv_11_ref |= 1;
40596 ret_arr_ptr[l] = ret_conv_11_ref;
40599 FREE(ret_var.data);
40603 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
40604 LDKPaymentParameters this_ptr_conv;
40605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40606 this_ptr_conv.is_owned = false;
40607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40608 LDKCVec_RouteHintZ val_constr;
40609 val_constr.datalen = val->arr_len;
40610 if (val_constr.datalen > 0)
40611 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40613 val_constr.data = NULL;
40614 uint32_t* val_vals = val->elems;
40615 for (size_t l = 0; l < val_constr.datalen; l++) {
40616 uint32_t val_conv_11 = val_vals[l];
40617 LDKRouteHint val_conv_11_conv;
40618 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
40619 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
40620 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
40621 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
40622 val_constr.data[l] = val_conv_11_conv;
40625 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
40628 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
40629 LDKPaymentParameters this_ptr_conv;
40630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40631 this_ptr_conv.is_owned = false;
40632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40633 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40634 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
40635 uint32_t ret_ref = (uintptr_t)ret_copy;
40639 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
40640 LDKPaymentParameters this_ptr_conv;
40641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40642 this_ptr_conv.is_owned = false;
40643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40644 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40645 CHECK_ACCESS(val_ptr);
40646 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40647 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40648 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
40651 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) {
40652 LDKPaymentParameters this_ptr_conv;
40653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40654 this_ptr_conv.is_owned = false;
40655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40656 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
40660 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) {
40661 LDKPaymentParameters this_ptr_conv;
40662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40663 this_ptr_conv.is_owned = false;
40664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40665 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
40668 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) {
40669 LDKPublicKey payee_pubkey_arg_ref;
40670 CHECK(payee_pubkey_arg->arr_len == 33);
40671 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
40672 LDKInvoiceFeatures features_arg_conv;
40673 features_arg_conv.inner = (void*)(features_arg & (~1));
40674 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40675 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40676 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
40677 LDKCVec_RouteHintZ route_hints_arg_constr;
40678 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
40679 if (route_hints_arg_constr.datalen > 0)
40680 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40682 route_hints_arg_constr.data = NULL;
40683 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
40684 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
40685 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
40686 LDKRouteHint route_hints_arg_conv_11_conv;
40687 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
40688 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
40689 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
40690 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
40691 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
40693 FREE(route_hints_arg);
40694 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
40695 CHECK_ACCESS(expiry_time_arg_ptr);
40696 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
40697 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
40698 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);
40699 uint32_t ret_ref = 0;
40700 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40701 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40703 ret_ref = (uintptr_t)ret_var.inner;
40704 if (ret_var.is_owned) {
40710 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
40711 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
40712 uint32_t ret_ref = 0;
40713 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40714 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40715 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40716 ret_ref = (uintptr_t)ret_var.inner;
40717 if (ret_var.is_owned) {
40722 uint32_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
40723 LDKPaymentParameters arg_conv;
40724 arg_conv.inner = (void*)(arg & (~1));
40725 arg_conv.is_owned = false;
40726 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40727 uint32_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
40731 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
40732 LDKPaymentParameters orig_conv;
40733 orig_conv.inner = (void*)(orig & (~1));
40734 orig_conv.is_owned = false;
40735 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40736 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
40737 uint32_t ret_ref = 0;
40738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40741 ret_ref = (uintptr_t)ret_var.inner;
40742 if (ret_var.is_owned) {
40748 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
40749 LDKPaymentParameters o_conv;
40750 o_conv.inner = (void*)(o & (~1));
40751 o_conv.is_owned = false;
40752 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40753 int64_t ret_conv = PaymentParameters_hash(&o_conv);
40757 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
40758 LDKPaymentParameters a_conv;
40759 a_conv.inner = (void*)(a & (~1));
40760 a_conv.is_owned = false;
40761 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40762 LDKPaymentParameters b_conv;
40763 b_conv.inner = (void*)(b & (~1));
40764 b_conv.is_owned = false;
40765 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40766 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
40770 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
40771 LDKPaymentParameters obj_conv;
40772 obj_conv.inner = (void*)(obj & (~1));
40773 obj_conv.is_owned = false;
40774 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40775 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
40776 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40777 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40778 CVec_u8Z_free(ret_var);
40782 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
40783 LDKu8slice ser_ref;
40784 ser_ref.datalen = ser->arr_len;
40785 ser_ref.data = ser->elems;
40786 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
40787 *ret_conv = PaymentParameters_read(ser_ref);
40789 return (uint32_t)ret_conv;
40792 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
40793 LDKPublicKey payee_pubkey_ref;
40794 CHECK(payee_pubkey->arr_len == 33);
40795 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40796 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
40797 uint32_t ret_ref = 0;
40798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40801 ret_ref = (uintptr_t)ret_var.inner;
40802 if (ret_var.is_owned) {
40808 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
40809 LDKPublicKey payee_pubkey_ref;
40810 CHECK(payee_pubkey->arr_len == 33);
40811 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40812 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
40813 uint32_t ret_ref = 0;
40814 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40815 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40817 ret_ref = (uintptr_t)ret_var.inner;
40818 if (ret_var.is_owned) {
40824 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
40825 LDKRouteHint this_obj_conv;
40826 this_obj_conv.inner = (void*)(this_obj & (~1));
40827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40829 RouteHint_free(this_obj_conv);
40832 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
40833 LDKRouteHint this_ptr_conv;
40834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40835 this_ptr_conv.is_owned = false;
40836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40837 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
40838 uint32_tArray ret_arr = NULL;
40839 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40840 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40841 for (size_t o = 0; o < ret_var.datalen; o++) {
40842 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
40843 uint32_t ret_conv_14_ref = 0;
40844 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40845 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40847 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40848 if (ret_conv_14_var.is_owned) {
40849 ret_conv_14_ref |= 1;
40851 ret_arr_ptr[o] = ret_conv_14_ref;
40854 FREE(ret_var.data);
40858 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
40859 LDKRouteHint this_ptr_conv;
40860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40861 this_ptr_conv.is_owned = false;
40862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40863 LDKCVec_RouteHintHopZ val_constr;
40864 val_constr.datalen = val->arr_len;
40865 if (val_constr.datalen > 0)
40866 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40868 val_constr.data = NULL;
40869 uint32_t* val_vals = val->elems;
40870 for (size_t o = 0; o < val_constr.datalen; o++) {
40871 uint32_t val_conv_14 = val_vals[o];
40872 LDKRouteHintHop val_conv_14_conv;
40873 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
40874 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
40875 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
40876 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
40877 val_constr.data[o] = val_conv_14_conv;
40880 RouteHint_set_a(&this_ptr_conv, val_constr);
40883 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
40884 LDKCVec_RouteHintHopZ a_arg_constr;
40885 a_arg_constr.datalen = a_arg->arr_len;
40886 if (a_arg_constr.datalen > 0)
40887 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40889 a_arg_constr.data = NULL;
40890 uint32_t* a_arg_vals = a_arg->elems;
40891 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
40892 uint32_t a_arg_conv_14 = a_arg_vals[o];
40893 LDKRouteHintHop a_arg_conv_14_conv;
40894 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
40895 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
40896 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
40897 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
40898 a_arg_constr.data[o] = a_arg_conv_14_conv;
40901 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
40902 uint32_t ret_ref = 0;
40903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40906 ret_ref = (uintptr_t)ret_var.inner;
40907 if (ret_var.is_owned) {
40913 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
40914 LDKRouteHint ret_var = RouteHint_clone(arg);
40915 uint32_t ret_ref = 0;
40916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40919 ret_ref = (uintptr_t)ret_var.inner;
40920 if (ret_var.is_owned) {
40925 uint32_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
40926 LDKRouteHint arg_conv;
40927 arg_conv.inner = (void*)(arg & (~1));
40928 arg_conv.is_owned = false;
40929 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40930 uint32_t ret_conv = RouteHint_clone_ptr(&arg_conv);
40934 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
40935 LDKRouteHint orig_conv;
40936 orig_conv.inner = (void*)(orig & (~1));
40937 orig_conv.is_owned = false;
40938 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40939 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
40940 uint32_t ret_ref = 0;
40941 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40942 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40944 ret_ref = (uintptr_t)ret_var.inner;
40945 if (ret_var.is_owned) {
40951 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
40952 LDKRouteHint o_conv;
40953 o_conv.inner = (void*)(o & (~1));
40954 o_conv.is_owned = false;
40955 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40956 int64_t ret_conv = RouteHint_hash(&o_conv);
40960 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
40961 LDKRouteHint a_conv;
40962 a_conv.inner = (void*)(a & (~1));
40963 a_conv.is_owned = false;
40964 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40965 LDKRouteHint b_conv;
40966 b_conv.inner = (void*)(b & (~1));
40967 b_conv.is_owned = false;
40968 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40969 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
40973 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
40974 LDKRouteHint obj_conv;
40975 obj_conv.inner = (void*)(obj & (~1));
40976 obj_conv.is_owned = false;
40977 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40978 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
40979 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40980 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40981 CVec_u8Z_free(ret_var);
40985 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
40986 LDKu8slice ser_ref;
40987 ser_ref.datalen = ser->arr_len;
40988 ser_ref.data = ser->elems;
40989 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
40990 *ret_conv = RouteHint_read(ser_ref);
40992 return (uint32_t)ret_conv;
40995 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
40996 LDKRouteHintHop this_obj_conv;
40997 this_obj_conv.inner = (void*)(this_obj & (~1));
40998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41000 RouteHintHop_free(this_obj_conv);
41003 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
41004 LDKRouteHintHop this_ptr_conv;
41005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41006 this_ptr_conv.is_owned = false;
41007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41008 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41009 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
41013 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
41014 LDKRouteHintHop this_ptr_conv;
41015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41016 this_ptr_conv.is_owned = false;
41017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41018 LDKPublicKey val_ref;
41019 CHECK(val->arr_len == 33);
41020 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41021 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
41024 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
41025 LDKRouteHintHop this_ptr_conv;
41026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41027 this_ptr_conv.is_owned = false;
41028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41029 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
41033 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
41034 LDKRouteHintHop this_ptr_conv;
41035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41036 this_ptr_conv.is_owned = false;
41037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41038 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
41041 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
41042 LDKRouteHintHop this_ptr_conv;
41043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41044 this_ptr_conv.is_owned = false;
41045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41046 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
41047 uint32_t ret_ref = 0;
41048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41051 ret_ref = (uintptr_t)ret_var.inner;
41052 if (ret_var.is_owned) {
41058 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
41059 LDKRouteHintHop this_ptr_conv;
41060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41061 this_ptr_conv.is_owned = false;
41062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41063 LDKRoutingFees val_conv;
41064 val_conv.inner = (void*)(val & (~1));
41065 val_conv.is_owned = (val & 1) || (val == 0);
41066 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41067 val_conv = RoutingFees_clone(&val_conv);
41068 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
41071 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
41072 LDKRouteHintHop this_ptr_conv;
41073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41074 this_ptr_conv.is_owned = false;
41075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41076 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
41080 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
41081 LDKRouteHintHop this_ptr_conv;
41082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41083 this_ptr_conv.is_owned = false;
41084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41085 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41088 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
41089 LDKRouteHintHop this_ptr_conv;
41090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41091 this_ptr_conv.is_owned = false;
41092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41093 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41094 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
41095 uint32_t ret_ref = (uintptr_t)ret_copy;
41099 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
41100 LDKRouteHintHop this_ptr_conv;
41101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41102 this_ptr_conv.is_owned = false;
41103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41104 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41105 CHECK_ACCESS(val_ptr);
41106 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41107 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41108 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
41111 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
41112 LDKRouteHintHop this_ptr_conv;
41113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41114 this_ptr_conv.is_owned = false;
41115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41116 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41117 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
41118 uint32_t ret_ref = (uintptr_t)ret_copy;
41122 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
41123 LDKRouteHintHop this_ptr_conv;
41124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41125 this_ptr_conv.is_owned = false;
41126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41127 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41128 CHECK_ACCESS(val_ptr);
41129 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41130 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41131 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
41134 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) {
41135 LDKPublicKey src_node_id_arg_ref;
41136 CHECK(src_node_id_arg->arr_len == 33);
41137 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
41138 LDKRoutingFees fees_arg_conv;
41139 fees_arg_conv.inner = (void*)(fees_arg & (~1));
41140 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
41141 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41142 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41143 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
41144 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
41145 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
41146 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
41147 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
41148 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
41149 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
41150 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
41151 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);
41152 uint32_t ret_ref = 0;
41153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41156 ret_ref = (uintptr_t)ret_var.inner;
41157 if (ret_var.is_owned) {
41163 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
41164 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
41165 uint32_t ret_ref = 0;
41166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41169 ret_ref = (uintptr_t)ret_var.inner;
41170 if (ret_var.is_owned) {
41175 uint32_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
41176 LDKRouteHintHop arg_conv;
41177 arg_conv.inner = (void*)(arg & (~1));
41178 arg_conv.is_owned = false;
41179 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41180 uint32_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
41184 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
41185 LDKRouteHintHop orig_conv;
41186 orig_conv.inner = (void*)(orig & (~1));
41187 orig_conv.is_owned = false;
41188 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41189 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
41190 uint32_t ret_ref = 0;
41191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41194 ret_ref = (uintptr_t)ret_var.inner;
41195 if (ret_var.is_owned) {
41201 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
41202 LDKRouteHintHop o_conv;
41203 o_conv.inner = (void*)(o & (~1));
41204 o_conv.is_owned = false;
41205 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41206 int64_t ret_conv = RouteHintHop_hash(&o_conv);
41210 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
41211 LDKRouteHintHop a_conv;
41212 a_conv.inner = (void*)(a & (~1));
41213 a_conv.is_owned = false;
41214 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41215 LDKRouteHintHop b_conv;
41216 b_conv.inner = (void*)(b & (~1));
41217 b_conv.is_owned = false;
41218 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41219 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
41223 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
41224 LDKRouteHintHop obj_conv;
41225 obj_conv.inner = (void*)(obj & (~1));
41226 obj_conv.is_owned = false;
41227 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41228 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
41229 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41230 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41231 CVec_u8Z_free(ret_var);
41235 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
41236 LDKu8slice ser_ref;
41237 ser_ref.datalen = ser->arr_len;
41238 ser_ref.data = ser->elems;
41239 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
41240 *ret_conv = RouteHintHop_read(ser_ref);
41242 return (uint32_t)ret_conv;
41245 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) {
41246 LDKPublicKey our_node_pubkey_ref;
41247 CHECK(our_node_pubkey->arr_len == 33);
41248 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41249 LDKRouteParameters route_params_conv;
41250 route_params_conv.inner = (void*)(route_params & (~1));
41251 route_params_conv.is_owned = false;
41252 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41253 LDKNetworkGraph network_graph_conv;
41254 network_graph_conv.inner = (void*)(network_graph & (~1));
41255 network_graph_conv.is_owned = false;
41256 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41257 LDKCVec_ChannelDetailsZ first_hops_constr;
41258 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
41259 if (first_hops != 0) {
41260 first_hops_constr.datalen = first_hops->arr_len;
41261 if (first_hops_constr.datalen > 0)
41262 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41264 first_hops_constr.data = NULL;
41265 uint32_t* first_hops_vals = first_hops->elems;
41266 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
41267 uint32_t first_hops_conv_16 = first_hops_vals[q];
41268 LDKChannelDetails first_hops_conv_16_conv;
41269 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
41270 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
41271 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
41272 first_hops_constr.data[q] = first_hops_conv_16_conv;
41275 first_hops_ptr = &first_hops_constr;
41277 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41278 CHECK_ACCESS(logger_ptr);
41279 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41280 if (logger_conv.free == LDKLogger_JCalls_free) {
41281 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41282 LDKLogger_JCalls_cloned(&logger_conv);
41284 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
41285 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
41286 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
41287 unsigned char random_seed_bytes_arr[32];
41288 CHECK(random_seed_bytes->arr_len == 32);
41289 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41290 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41291 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41292 *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);
41293 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
41294 return (uint32_t)ret_conv;
41297 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) {
41298 LDKPublicKey our_node_pubkey_ref;
41299 CHECK(our_node_pubkey->arr_len == 33);
41300 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41301 LDKCVec_PublicKeyZ hops_constr;
41302 hops_constr.datalen = hops->arr_len;
41303 if (hops_constr.datalen > 0)
41304 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
41306 hops_constr.data = NULL;
41307 int8_tArray* hops_vals = (void*) hops->elems;
41308 for (size_t m = 0; m < hops_constr.datalen; m++) {
41309 int8_tArray hops_conv_12 = hops_vals[m];
41310 LDKPublicKey hops_conv_12_ref;
41311 CHECK(hops_conv_12->arr_len == 33);
41312 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
41313 hops_constr.data[m] = hops_conv_12_ref;
41316 LDKRouteParameters route_params_conv;
41317 route_params_conv.inner = (void*)(route_params & (~1));
41318 route_params_conv.is_owned = false;
41319 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41320 LDKNetworkGraph network_graph_conv;
41321 network_graph_conv.inner = (void*)(network_graph & (~1));
41322 network_graph_conv.is_owned = false;
41323 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41324 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41325 CHECK_ACCESS(logger_ptr);
41326 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41327 if (logger_conv.free == LDKLogger_JCalls_free) {
41328 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41329 LDKLogger_JCalls_cloned(&logger_conv);
41331 unsigned char random_seed_bytes_arr[32];
41332 CHECK(random_seed_bytes->arr_len == 32);
41333 memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41334 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41335 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41336 *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
41337 return (uint32_t)ret_conv;
41340 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
41341 if ((this_ptr & 1) != 0) return;
41342 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41343 CHECK_ACCESS(this_ptr_ptr);
41344 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
41345 FREE((void*)this_ptr);
41346 Score_free(this_ptr_conv);
41349 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
41350 if ((this_ptr & 1) != 0) return;
41351 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41352 CHECK_ACCESS(this_ptr_ptr);
41353 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
41354 FREE((void*)this_ptr);
41355 LockableScore_free(this_ptr_conv);
41358 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
41359 LDKMultiThreadedLockableScore this_obj_conv;
41360 this_obj_conv.inner = (void*)(this_obj & (~1));
41361 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41363 MultiThreadedLockableScore_free(this_obj_conv);
41366 int8_tArray __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint32_t obj) {
41367 LDKMultiThreadedLockableScore obj_conv;
41368 obj_conv.inner = (void*)(obj & (~1));
41369 obj_conv.is_owned = false;
41370 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41371 LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
41372 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41373 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41374 CVec_u8Z_free(ret_var);
41378 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
41379 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
41380 CHECK_ACCESS(score_ptr);
41381 LDKScore score_conv = *(LDKScore*)(score_ptr);
41382 if (score_conv.free == LDKScore_JCalls_free) {
41383 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41384 LDKScore_JCalls_cloned(&score_conv);
41386 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
41387 uint32_t ret_ref = 0;
41388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41391 ret_ref = (uintptr_t)ret_var.inner;
41392 if (ret_var.is_owned) {
41398 void __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint32_t this_obj) {
41399 LDKChannelUsage this_obj_conv;
41400 this_obj_conv.inner = (void*)(this_obj & (~1));
41401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41403 ChannelUsage_free(this_obj_conv);
41406 int64_t __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint32_t this_ptr) {
41407 LDKChannelUsage this_ptr_conv;
41408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41409 this_ptr_conv.is_owned = false;
41410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41411 int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
41415 void __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint32_t this_ptr, int64_t val) {
41416 LDKChannelUsage this_ptr_conv;
41417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41418 this_ptr_conv.is_owned = false;
41419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41420 ChannelUsage_set_amount_msat(&this_ptr_conv, val);
41423 int64_t __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint32_t this_ptr) {
41424 LDKChannelUsage this_ptr_conv;
41425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41426 this_ptr_conv.is_owned = false;
41427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41428 int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
41432 void __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint32_t this_ptr, int64_t val) {
41433 LDKChannelUsage this_ptr_conv;
41434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41435 this_ptr_conv.is_owned = false;
41436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41437 ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
41440 uint32_t __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint32_t this_ptr) {
41441 LDKChannelUsage this_ptr_conv;
41442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41443 this_ptr_conv.is_owned = false;
41444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41445 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41446 *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
41447 uint32_t ret_ref = (uintptr_t)ret_copy;
41451 void __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint32_t this_ptr, uint32_t val) {
41452 LDKChannelUsage this_ptr_conv;
41453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41454 this_ptr_conv.is_owned = false;
41455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41456 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41457 CHECK_ACCESS(val_ptr);
41458 LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
41459 val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)val) & ~1));
41460 ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
41463 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) {
41464 void* effective_capacity_arg_ptr = (void*)(((uintptr_t)effective_capacity_arg) & ~1);
41465 CHECK_ACCESS(effective_capacity_arg_ptr);
41466 LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
41467 effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)(((uintptr_t)effective_capacity_arg) & ~1));
41468 LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
41469 uint32_t ret_ref = 0;
41470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41473 ret_ref = (uintptr_t)ret_var.inner;
41474 if (ret_var.is_owned) {
41480 static inline uintptr_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
41481 LDKChannelUsage ret_var = ChannelUsage_clone(arg);
41482 uint32_t ret_ref = 0;
41483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41486 ret_ref = (uintptr_t)ret_var.inner;
41487 if (ret_var.is_owned) {
41492 uint32_t __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint32_t arg) {
41493 LDKChannelUsage arg_conv;
41494 arg_conv.inner = (void*)(arg & (~1));
41495 arg_conv.is_owned = false;
41496 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41497 uint32_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
41501 uint32_t __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint32_t orig) {
41502 LDKChannelUsage orig_conv;
41503 orig_conv.inner = (void*)(orig & (~1));
41504 orig_conv.is_owned = false;
41505 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41506 LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
41507 uint32_t ret_ref = 0;
41508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41511 ret_ref = (uintptr_t)ret_var.inner;
41512 if (ret_var.is_owned) {
41518 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
41519 LDKFixedPenaltyScorer this_obj_conv;
41520 this_obj_conv.inner = (void*)(this_obj & (~1));
41521 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41523 FixedPenaltyScorer_free(this_obj_conv);
41526 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
41527 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
41528 uint32_t ret_ref = 0;
41529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41532 ret_ref = (uintptr_t)ret_var.inner;
41533 if (ret_var.is_owned) {
41538 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
41539 LDKFixedPenaltyScorer arg_conv;
41540 arg_conv.inner = (void*)(arg & (~1));
41541 arg_conv.is_owned = false;
41542 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41543 uint32_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
41547 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
41548 LDKFixedPenaltyScorer orig_conv;
41549 orig_conv.inner = (void*)(orig & (~1));
41550 orig_conv.is_owned = false;
41551 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41552 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
41553 uint32_t ret_ref = 0;
41554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41557 ret_ref = (uintptr_t)ret_var.inner;
41558 if (ret_var.is_owned) {
41564 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
41565 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
41566 uint32_t ret_ref = 0;
41567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41570 ret_ref = (uintptr_t)ret_var.inner;
41571 if (ret_var.is_owned) {
41577 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
41578 LDKFixedPenaltyScorer this_arg_conv;
41579 this_arg_conv.inner = (void*)(this_arg & (~1));
41580 this_arg_conv.is_owned = false;
41581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41582 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41583 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
41584 return (uint32_t)ret_ret;
41587 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
41588 LDKFixedPenaltyScorer obj_conv;
41589 obj_conv.inner = (void*)(obj & (~1));
41590 obj_conv.is_owned = false;
41591 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41592 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
41593 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41594 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41595 CVec_u8Z_free(ret_var);
41599 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
41600 LDKu8slice ser_ref;
41601 ser_ref.datalen = ser->arr_len;
41602 ser_ref.data = ser->elems;
41603 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
41604 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
41606 return (uint32_t)ret_conv;
41609 void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint32_t this_obj) {
41610 LDKProbabilisticScorer this_obj_conv;
41611 this_obj_conv.inner = (void*)(this_obj & (~1));
41612 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41614 ProbabilisticScorer_free(this_obj_conv);
41617 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
41618 LDKProbabilisticScoringParameters this_obj_conv;
41619 this_obj_conv.inner = (void*)(this_obj & (~1));
41620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41622 ProbabilisticScoringParameters_free(this_obj_conv);
41625 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
41626 LDKProbabilisticScoringParameters this_ptr_conv;
41627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41628 this_ptr_conv.is_owned = false;
41629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41630 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
41634 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
41635 LDKProbabilisticScoringParameters this_ptr_conv;
41636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41637 this_ptr_conv.is_owned = false;
41638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41639 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
41642 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
41643 LDKProbabilisticScoringParameters this_ptr_conv;
41644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41645 this_ptr_conv.is_owned = false;
41646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41647 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
41651 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) {
41652 LDKProbabilisticScoringParameters this_ptr_conv;
41653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41654 this_ptr_conv.is_owned = false;
41655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41656 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
41659 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
41660 LDKProbabilisticScoringParameters this_ptr_conv;
41661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41662 this_ptr_conv.is_owned = false;
41663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41664 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
41668 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) {
41669 LDKProbabilisticScoringParameters this_ptr_conv;
41670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41671 this_ptr_conv.is_owned = false;
41672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
41676 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(uint32_t this_ptr) {
41677 LDKProbabilisticScoringParameters this_ptr_conv;
41678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41679 this_ptr_conv.is_owned = false;
41680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41681 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
41685 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) {
41686 LDKProbabilisticScoringParameters this_ptr_conv;
41687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41688 this_ptr_conv.is_owned = false;
41689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41690 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
41693 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) {
41694 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
41695 uint32_t ret_ref = 0;
41696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41699 ret_ref = (uintptr_t)ret_var.inner;
41700 if (ret_var.is_owned) {
41706 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
41707 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
41708 uint32_t ret_ref = 0;
41709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41712 ret_ref = (uintptr_t)ret_var.inner;
41713 if (ret_var.is_owned) {
41718 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
41719 LDKProbabilisticScoringParameters arg_conv;
41720 arg_conv.inner = (void*)(arg & (~1));
41721 arg_conv.is_owned = false;
41722 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41723 uint32_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
41727 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
41728 LDKProbabilisticScoringParameters orig_conv;
41729 orig_conv.inner = (void*)(orig & (~1));
41730 orig_conv.is_owned = false;
41731 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41732 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
41733 uint32_t ret_ref = 0;
41734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41737 ret_ref = (uintptr_t)ret_var.inner;
41738 if (ret_var.is_owned) {
41744 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint32_t params, uint32_t network_graph, uint32_t logger) {
41745 LDKProbabilisticScoringParameters params_conv;
41746 params_conv.inner = (void*)(params & (~1));
41747 params_conv.is_owned = (params & 1) || (params == 0);
41748 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41749 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
41750 LDKNetworkGraph network_graph_conv;
41751 network_graph_conv.inner = (void*)(network_graph & (~1));
41752 network_graph_conv.is_owned = false;
41753 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41754 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41755 CHECK_ACCESS(logger_ptr);
41756 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41757 if (logger_conv.free == LDKLogger_JCalls_free) {
41758 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41759 LDKLogger_JCalls_cloned(&logger_conv);
41761 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
41762 uint32_t ret_ref = 0;
41763 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41764 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41766 ret_ref = (uintptr_t)ret_var.inner;
41767 if (ret_var.is_owned) {
41773 void __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint32_t this_arg) {
41774 LDKProbabilisticScorer this_arg_conv;
41775 this_arg_conv.inner = (void*)(this_arg & (~1));
41776 this_arg_conv.is_owned = false;
41777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41778 ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
41781 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
41782 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
41783 uint32_t ret_ref = 0;
41784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41787 ret_ref = (uintptr_t)ret_var.inner;
41788 if (ret_var.is_owned) {
41794 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint32_t this_arg) {
41795 LDKProbabilisticScorer this_arg_conv;
41796 this_arg_conv.inner = (void*)(this_arg & (~1));
41797 this_arg_conv.is_owned = false;
41798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41799 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41800 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
41801 return (uint32_t)ret_ret;
41804 int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint32_t obj) {
41805 LDKProbabilisticScorer obj_conv;
41806 obj_conv.inner = (void*)(obj & (~1));
41807 obj_conv.is_owned = false;
41808 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41809 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
41810 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41811 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41812 CVec_u8Z_free(ret_var);
41816 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) {
41817 LDKu8slice ser_ref;
41818 ser_ref.datalen = ser->arr_len;
41819 ser_ref.data = ser->elems;
41820 LDKProbabilisticScoringParameters arg_a_conv;
41821 arg_a_conv.inner = (void*)(arg_a & (~1));
41822 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
41823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
41824 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
41825 LDKNetworkGraph arg_b_conv;
41826 arg_b_conv.inner = (void*)(arg_b & (~1));
41827 arg_b_conv.is_owned = false;
41828 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
41829 void* arg_c_ptr = (void*)(((uintptr_t)arg_c) & ~1);
41830 CHECK_ACCESS(arg_c_ptr);
41831 LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
41832 if (arg_c_conv.free == LDKLogger_JCalls_free) {
41833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41834 LDKLogger_JCalls_cloned(&arg_c_conv);
41836 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
41837 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
41839 return (uint32_t)ret_conv;
41842 void __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint32_t this_ptr) {
41843 if ((this_ptr & 1) != 0) return;
41844 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41845 CHECK_ACCESS(this_ptr_ptr);
41846 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
41847 FREE((void*)this_ptr);
41848 ParseError_free(this_ptr_conv);
41851 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
41852 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41853 *ret_copy = ParseError_clone(arg);
41854 uint32_t ret_ref = (uintptr_t)ret_copy;
41857 uint32_t __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint32_t arg) {
41858 LDKParseError* arg_conv = (LDKParseError*)arg;
41859 uint32_t ret_conv = ParseError_clone_ptr(arg_conv);
41863 uint32_t __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint32_t orig) {
41864 LDKParseError* orig_conv = (LDKParseError*)orig;
41865 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41866 *ret_copy = ParseError_clone(orig_conv);
41867 uint32_t ret_ref = (uintptr_t)ret_copy;
41871 uint32_t __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint32_t a) {
41872 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
41873 CHECK_ACCESS(a_ptr);
41874 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
41875 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
41876 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41877 *ret_copy = ParseError_bech32_error(a_conv);
41878 uint32_t ret_ref = (uintptr_t)ret_copy;
41882 uint32_t __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
41884 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41885 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
41886 uint32_t ret_ref = (uintptr_t)ret_copy;
41890 uint32_t __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
41891 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
41892 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41893 *ret_copy = ParseError_malformed_signature(a_conv);
41894 uint32_t ret_ref = (uintptr_t)ret_copy;
41898 uint32_t __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
41899 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41900 *ret_copy = ParseError_bad_prefix();
41901 uint32_t ret_ref = (uintptr_t)ret_copy;
41905 uint32_t __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
41906 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41907 *ret_copy = ParseError_unknown_currency();
41908 uint32_t ret_ref = (uintptr_t)ret_copy;
41912 uint32_t __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
41913 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41914 *ret_copy = ParseError_unknown_si_prefix();
41915 uint32_t ret_ref = (uintptr_t)ret_copy;
41919 uint32_t __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
41920 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41921 *ret_copy = ParseError_malformed_hrp();
41922 uint32_t ret_ref = (uintptr_t)ret_copy;
41926 uint32_t __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
41927 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41928 *ret_copy = ParseError_too_short_data_part();
41929 uint32_t ret_ref = (uintptr_t)ret_copy;
41933 uint32_t __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
41934 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41935 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
41936 uint32_t ret_ref = (uintptr_t)ret_copy;
41940 uint32_t __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
41942 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41943 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
41944 uint32_t ret_ref = (uintptr_t)ret_copy;
41948 uint32_t __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
41949 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41950 *ret_copy = ParseError_padding_error();
41951 uint32_t ret_ref = (uintptr_t)ret_copy;
41955 uint32_t __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
41956 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41957 *ret_copy = ParseError_integer_overflow_error();
41958 uint32_t ret_ref = (uintptr_t)ret_copy;
41962 uint32_t __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
41963 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41964 *ret_copy = ParseError_invalid_seg_wit_program_length();
41965 uint32_t ret_ref = (uintptr_t)ret_copy;
41969 uint32_t __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
41970 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41971 *ret_copy = ParseError_invalid_pub_key_hash_length();
41972 uint32_t ret_ref = (uintptr_t)ret_copy;
41976 uint32_t __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
41977 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41978 *ret_copy = ParseError_invalid_script_hash_length();
41979 uint32_t ret_ref = (uintptr_t)ret_copy;
41983 uint32_t __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
41984 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41985 *ret_copy = ParseError_invalid_recovery_id();
41986 uint32_t ret_ref = (uintptr_t)ret_copy;
41990 uint32_t __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
41991 LDKStr a_conv = str_ref_to_owned_c(a);
41992 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41993 *ret_copy = ParseError_invalid_slice_length(a_conv);
41994 uint32_t ret_ref = (uintptr_t)ret_copy;
41998 uint32_t __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
41999 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
42000 *ret_copy = ParseError_skip();
42001 uint32_t ret_ref = (uintptr_t)ret_copy;
42005 void __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint32_t this_ptr) {
42006 if ((this_ptr & 1) != 0) return;
42007 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42008 CHECK_ACCESS(this_ptr_ptr);
42009 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
42010 FREE((void*)this_ptr);
42011 ParseOrSemanticError_free(this_ptr_conv);
42014 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
42015 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42016 *ret_copy = ParseOrSemanticError_clone(arg);
42017 uint32_t ret_ref = (uintptr_t)ret_copy;
42020 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint32_t arg) {
42021 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
42022 uint32_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
42026 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint32_t orig) {
42027 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
42028 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42029 *ret_copy = ParseOrSemanticError_clone(orig_conv);
42030 uint32_t ret_ref = (uintptr_t)ret_copy;
42034 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint32_t a) {
42035 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
42036 CHECK_ACCESS(a_ptr);
42037 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
42038 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
42039 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42040 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
42041 uint32_t ret_ref = (uintptr_t)ret_copy;
42045 uint32_t __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
42046 LDKSemanticError a_conv = LDKSemanticError_from_js(a);
42047 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42048 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
42049 uint32_t ret_ref = (uintptr_t)ret_copy;
42053 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
42054 LDKInvoice 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 Invoice_free(this_obj_conv);
42061 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
42063 a_conv.inner = (void*)(a & (~1));
42064 a_conv.is_owned = false;
42065 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42067 b_conv.inner = (void*)(b & (~1));
42068 b_conv.is_owned = false;
42069 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42070 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
42074 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
42075 LDKInvoice ret_var = Invoice_clone(arg);
42076 uint32_t ret_ref = 0;
42077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42080 ret_ref = (uintptr_t)ret_var.inner;
42081 if (ret_var.is_owned) {
42086 uint32_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
42087 LDKInvoice arg_conv;
42088 arg_conv.inner = (void*)(arg & (~1));
42089 arg_conv.is_owned = false;
42090 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42091 uint32_t ret_conv = Invoice_clone_ptr(&arg_conv);
42095 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
42096 LDKInvoice orig_conv;
42097 orig_conv.inner = (void*)(orig & (~1));
42098 orig_conv.is_owned = false;
42099 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42100 LDKInvoice ret_var = Invoice_clone(&orig_conv);
42101 uint32_t ret_ref = 0;
42102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42105 ret_ref = (uintptr_t)ret_var.inner;
42106 if (ret_var.is_owned) {
42112 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
42113 LDKSignedRawInvoice this_obj_conv;
42114 this_obj_conv.inner = (void*)(this_obj & (~1));
42115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42117 SignedRawInvoice_free(this_obj_conv);
42120 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
42121 LDKSignedRawInvoice a_conv;
42122 a_conv.inner = (void*)(a & (~1));
42123 a_conv.is_owned = false;
42124 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42125 LDKSignedRawInvoice b_conv;
42126 b_conv.inner = (void*)(b & (~1));
42127 b_conv.is_owned = false;
42128 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42129 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
42133 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
42134 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
42135 uint32_t ret_ref = 0;
42136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42139 ret_ref = (uintptr_t)ret_var.inner;
42140 if (ret_var.is_owned) {
42145 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
42146 LDKSignedRawInvoice arg_conv;
42147 arg_conv.inner = (void*)(arg & (~1));
42148 arg_conv.is_owned = false;
42149 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42150 uint32_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
42154 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
42155 LDKSignedRawInvoice orig_conv;
42156 orig_conv.inner = (void*)(orig & (~1));
42157 orig_conv.is_owned = false;
42158 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42159 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
42160 uint32_t ret_ref = 0;
42161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42164 ret_ref = (uintptr_t)ret_var.inner;
42165 if (ret_var.is_owned) {
42171 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
42172 LDKRawInvoice this_obj_conv;
42173 this_obj_conv.inner = (void*)(this_obj & (~1));
42174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42176 RawInvoice_free(this_obj_conv);
42179 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
42180 LDKRawInvoice this_ptr_conv;
42181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42182 this_ptr_conv.is_owned = false;
42183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42184 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
42185 uint32_t ret_ref = 0;
42186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42189 ret_ref = (uintptr_t)ret_var.inner;
42190 if (ret_var.is_owned) {
42196 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
42197 LDKRawInvoice this_ptr_conv;
42198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42199 this_ptr_conv.is_owned = false;
42200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42201 LDKRawDataPart val_conv;
42202 val_conv.inner = (void*)(val & (~1));
42203 val_conv.is_owned = (val & 1) || (val == 0);
42204 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42205 val_conv = RawDataPart_clone(&val_conv);
42206 RawInvoice_set_data(&this_ptr_conv, val_conv);
42209 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
42210 LDKRawInvoice a_conv;
42211 a_conv.inner = (void*)(a & (~1));
42212 a_conv.is_owned = false;
42213 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42214 LDKRawInvoice b_conv;
42215 b_conv.inner = (void*)(b & (~1));
42216 b_conv.is_owned = false;
42217 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42218 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
42222 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
42223 LDKRawInvoice ret_var = RawInvoice_clone(arg);
42224 uint32_t ret_ref = 0;
42225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42228 ret_ref = (uintptr_t)ret_var.inner;
42229 if (ret_var.is_owned) {
42234 uint32_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
42235 LDKRawInvoice arg_conv;
42236 arg_conv.inner = (void*)(arg & (~1));
42237 arg_conv.is_owned = false;
42238 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42239 uint32_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
42243 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
42244 LDKRawInvoice orig_conv;
42245 orig_conv.inner = (void*)(orig & (~1));
42246 orig_conv.is_owned = false;
42247 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42248 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
42249 uint32_t ret_ref = 0;
42250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42253 ret_ref = (uintptr_t)ret_var.inner;
42254 if (ret_var.is_owned) {
42260 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
42261 LDKRawDataPart this_obj_conv;
42262 this_obj_conv.inner = (void*)(this_obj & (~1));
42263 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42265 RawDataPart_free(this_obj_conv);
42268 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
42269 LDKRawDataPart this_ptr_conv;
42270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42271 this_ptr_conv.is_owned = false;
42272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42273 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
42274 uint32_t ret_ref = 0;
42275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42278 ret_ref = (uintptr_t)ret_var.inner;
42279 if (ret_var.is_owned) {
42285 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
42286 LDKRawDataPart this_ptr_conv;
42287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42288 this_ptr_conv.is_owned = false;
42289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42290 LDKPositiveTimestamp val_conv;
42291 val_conv.inner = (void*)(val & (~1));
42292 val_conv.is_owned = (val & 1) || (val == 0);
42293 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42294 val_conv = PositiveTimestamp_clone(&val_conv);
42295 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
42298 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
42299 LDKRawDataPart a_conv;
42300 a_conv.inner = (void*)(a & (~1));
42301 a_conv.is_owned = false;
42302 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42303 LDKRawDataPart b_conv;
42304 b_conv.inner = (void*)(b & (~1));
42305 b_conv.is_owned = false;
42306 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42307 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
42311 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
42312 LDKRawDataPart ret_var = RawDataPart_clone(arg);
42313 uint32_t ret_ref = 0;
42314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42317 ret_ref = (uintptr_t)ret_var.inner;
42318 if (ret_var.is_owned) {
42323 uint32_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
42324 LDKRawDataPart arg_conv;
42325 arg_conv.inner = (void*)(arg & (~1));
42326 arg_conv.is_owned = false;
42327 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42328 uint32_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
42332 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
42333 LDKRawDataPart orig_conv;
42334 orig_conv.inner = (void*)(orig & (~1));
42335 orig_conv.is_owned = false;
42336 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42337 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
42338 uint32_t ret_ref = 0;
42339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42342 ret_ref = (uintptr_t)ret_var.inner;
42343 if (ret_var.is_owned) {
42349 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
42350 LDKPositiveTimestamp this_obj_conv;
42351 this_obj_conv.inner = (void*)(this_obj & (~1));
42352 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42354 PositiveTimestamp_free(this_obj_conv);
42357 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
42358 LDKPositiveTimestamp a_conv;
42359 a_conv.inner = (void*)(a & (~1));
42360 a_conv.is_owned = false;
42361 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42362 LDKPositiveTimestamp b_conv;
42363 b_conv.inner = (void*)(b & (~1));
42364 b_conv.is_owned = false;
42365 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42366 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
42370 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
42371 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
42372 uint32_t ret_ref = 0;
42373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42376 ret_ref = (uintptr_t)ret_var.inner;
42377 if (ret_var.is_owned) {
42382 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
42383 LDKPositiveTimestamp arg_conv;
42384 arg_conv.inner = (void*)(arg & (~1));
42385 arg_conv.is_owned = false;
42386 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42387 uint32_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
42391 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
42392 LDKPositiveTimestamp orig_conv;
42393 orig_conv.inner = (void*)(orig & (~1));
42394 orig_conv.is_owned = false;
42395 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42396 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
42397 uint32_t ret_ref = 0;
42398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42401 ret_ref = (uintptr_t)ret_var.inner;
42402 if (ret_var.is_owned) {
42408 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
42409 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
42410 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
42414 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
42415 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
42419 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
42420 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
42424 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
42425 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
42429 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
42430 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
42434 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
42435 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
42436 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
42437 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
42441 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
42442 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
42443 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
42447 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
42448 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
42449 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
42453 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
42454 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
42458 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
42459 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
42463 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
42464 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
42468 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
42469 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
42473 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
42474 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
42478 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
42479 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
42480 int64_t ret_conv = Currency_hash(o_conv);
42484 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
42485 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
42486 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
42487 jboolean ret_conv = Currency_eq(a_conv, b_conv);
42491 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
42492 LDKSha256 this_obj_conv;
42493 this_obj_conv.inner = (void*)(this_obj & (~1));
42494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42496 Sha256_free(this_obj_conv);
42499 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
42500 LDKSha256 ret_var = Sha256_clone(arg);
42501 uint32_t ret_ref = 0;
42502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42505 ret_ref = (uintptr_t)ret_var.inner;
42506 if (ret_var.is_owned) {
42511 uint32_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
42512 LDKSha256 arg_conv;
42513 arg_conv.inner = (void*)(arg & (~1));
42514 arg_conv.is_owned = false;
42515 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42516 uint32_t ret_conv = Sha256_clone_ptr(&arg_conv);
42520 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
42521 LDKSha256 orig_conv;
42522 orig_conv.inner = (void*)(orig & (~1));
42523 orig_conv.is_owned = false;
42524 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42525 LDKSha256 ret_var = Sha256_clone(&orig_conv);
42526 uint32_t ret_ref = 0;
42527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42530 ret_ref = (uintptr_t)ret_var.inner;
42531 if (ret_var.is_owned) {
42537 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
42539 o_conv.inner = (void*)(o & (~1));
42540 o_conv.is_owned = false;
42541 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42542 int64_t ret_conv = Sha256_hash(&o_conv);
42546 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
42548 a_conv.inner = (void*)(a & (~1));
42549 a_conv.is_owned = false;
42550 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42552 b_conv.inner = (void*)(b & (~1));
42553 b_conv.is_owned = false;
42554 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42555 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
42559 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
42560 LDKDescription this_obj_conv;
42561 this_obj_conv.inner = (void*)(this_obj & (~1));
42562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42564 Description_free(this_obj_conv);
42567 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
42568 LDKDescription ret_var = Description_clone(arg);
42569 uint32_t ret_ref = 0;
42570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42573 ret_ref = (uintptr_t)ret_var.inner;
42574 if (ret_var.is_owned) {
42579 uint32_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
42580 LDKDescription arg_conv;
42581 arg_conv.inner = (void*)(arg & (~1));
42582 arg_conv.is_owned = false;
42583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42584 uint32_t ret_conv = Description_clone_ptr(&arg_conv);
42588 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
42589 LDKDescription orig_conv;
42590 orig_conv.inner = (void*)(orig & (~1));
42591 orig_conv.is_owned = false;
42592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42593 LDKDescription ret_var = Description_clone(&orig_conv);
42594 uint32_t ret_ref = 0;
42595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42598 ret_ref = (uintptr_t)ret_var.inner;
42599 if (ret_var.is_owned) {
42605 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
42606 LDKDescription o_conv;
42607 o_conv.inner = (void*)(o & (~1));
42608 o_conv.is_owned = false;
42609 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42610 int64_t ret_conv = Description_hash(&o_conv);
42614 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
42615 LDKDescription a_conv;
42616 a_conv.inner = (void*)(a & (~1));
42617 a_conv.is_owned = false;
42618 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42619 LDKDescription b_conv;
42620 b_conv.inner = (void*)(b & (~1));
42621 b_conv.is_owned = false;
42622 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42623 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
42627 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
42628 LDKPayeePubKey this_obj_conv;
42629 this_obj_conv.inner = (void*)(this_obj & (~1));
42630 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42632 PayeePubKey_free(this_obj_conv);
42635 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
42636 LDKPayeePubKey this_ptr_conv;
42637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42638 this_ptr_conv.is_owned = false;
42639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42640 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42641 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
42645 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
42646 LDKPayeePubKey this_ptr_conv;
42647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42648 this_ptr_conv.is_owned = false;
42649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42650 LDKPublicKey val_ref;
42651 CHECK(val->arr_len == 33);
42652 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42653 PayeePubKey_set_a(&this_ptr_conv, val_ref);
42656 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
42657 LDKPublicKey a_arg_ref;
42658 CHECK(a_arg->arr_len == 33);
42659 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
42660 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
42661 uint32_t ret_ref = 0;
42662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42665 ret_ref = (uintptr_t)ret_var.inner;
42666 if (ret_var.is_owned) {
42672 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
42673 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
42674 uint32_t ret_ref = 0;
42675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42678 ret_ref = (uintptr_t)ret_var.inner;
42679 if (ret_var.is_owned) {
42684 uint32_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
42685 LDKPayeePubKey arg_conv;
42686 arg_conv.inner = (void*)(arg & (~1));
42687 arg_conv.is_owned = false;
42688 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42689 uint32_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
42693 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
42694 LDKPayeePubKey orig_conv;
42695 orig_conv.inner = (void*)(orig & (~1));
42696 orig_conv.is_owned = false;
42697 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42698 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
42699 uint32_t ret_ref = 0;
42700 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42701 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42702 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42703 ret_ref = (uintptr_t)ret_var.inner;
42704 if (ret_var.is_owned) {
42710 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
42711 LDKPayeePubKey o_conv;
42712 o_conv.inner = (void*)(o & (~1));
42713 o_conv.is_owned = false;
42714 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42715 int64_t ret_conv = PayeePubKey_hash(&o_conv);
42719 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
42720 LDKPayeePubKey a_conv;
42721 a_conv.inner = (void*)(a & (~1));
42722 a_conv.is_owned = false;
42723 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42724 LDKPayeePubKey b_conv;
42725 b_conv.inner = (void*)(b & (~1));
42726 b_conv.is_owned = false;
42727 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42728 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
42732 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
42733 LDKExpiryTime this_obj_conv;
42734 this_obj_conv.inner = (void*)(this_obj & (~1));
42735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42737 ExpiryTime_free(this_obj_conv);
42740 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
42741 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
42742 uint32_t ret_ref = 0;
42743 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42744 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42746 ret_ref = (uintptr_t)ret_var.inner;
42747 if (ret_var.is_owned) {
42752 uint32_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
42753 LDKExpiryTime arg_conv;
42754 arg_conv.inner = (void*)(arg & (~1));
42755 arg_conv.is_owned = false;
42756 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42757 uint32_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
42761 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
42762 LDKExpiryTime orig_conv;
42763 orig_conv.inner = (void*)(orig & (~1));
42764 orig_conv.is_owned = false;
42765 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42766 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
42767 uint32_t ret_ref = 0;
42768 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42769 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42771 ret_ref = (uintptr_t)ret_var.inner;
42772 if (ret_var.is_owned) {
42778 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
42779 LDKExpiryTime o_conv;
42780 o_conv.inner = (void*)(o & (~1));
42781 o_conv.is_owned = false;
42782 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42783 int64_t ret_conv = ExpiryTime_hash(&o_conv);
42787 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
42788 LDKExpiryTime a_conv;
42789 a_conv.inner = (void*)(a & (~1));
42790 a_conv.is_owned = false;
42791 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42792 LDKExpiryTime b_conv;
42793 b_conv.inner = (void*)(b & (~1));
42794 b_conv.is_owned = false;
42795 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42796 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
42800 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
42801 LDKMinFinalCltvExpiry this_obj_conv;
42802 this_obj_conv.inner = (void*)(this_obj & (~1));
42803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42805 MinFinalCltvExpiry_free(this_obj_conv);
42808 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
42809 LDKMinFinalCltvExpiry this_ptr_conv;
42810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42811 this_ptr_conv.is_owned = false;
42812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42813 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
42817 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
42818 LDKMinFinalCltvExpiry this_ptr_conv;
42819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42820 this_ptr_conv.is_owned = false;
42821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42822 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
42825 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
42826 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
42827 uint32_t ret_ref = 0;
42828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42831 ret_ref = (uintptr_t)ret_var.inner;
42832 if (ret_var.is_owned) {
42838 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
42839 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
42840 uint32_t ret_ref = 0;
42841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42844 ret_ref = (uintptr_t)ret_var.inner;
42845 if (ret_var.is_owned) {
42850 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
42851 LDKMinFinalCltvExpiry arg_conv;
42852 arg_conv.inner = (void*)(arg & (~1));
42853 arg_conv.is_owned = false;
42854 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42855 uint32_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
42859 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
42860 LDKMinFinalCltvExpiry orig_conv;
42861 orig_conv.inner = (void*)(orig & (~1));
42862 orig_conv.is_owned = false;
42863 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42864 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
42865 uint32_t ret_ref = 0;
42866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42869 ret_ref = (uintptr_t)ret_var.inner;
42870 if (ret_var.is_owned) {
42876 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
42877 LDKMinFinalCltvExpiry o_conv;
42878 o_conv.inner = (void*)(o & (~1));
42879 o_conv.is_owned = false;
42880 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42881 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
42885 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
42886 LDKMinFinalCltvExpiry a_conv;
42887 a_conv.inner = (void*)(a & (~1));
42888 a_conv.is_owned = false;
42889 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42890 LDKMinFinalCltvExpiry b_conv;
42891 b_conv.inner = (void*)(b & (~1));
42892 b_conv.is_owned = false;
42893 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42894 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
42898 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
42899 if ((this_ptr & 1) != 0) return;
42900 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42901 CHECK_ACCESS(this_ptr_ptr);
42902 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
42903 FREE((void*)this_ptr);
42904 Fallback_free(this_ptr_conv);
42907 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
42908 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42909 *ret_copy = Fallback_clone(arg);
42910 uint32_t ret_ref = (uintptr_t)ret_copy;
42913 uint32_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
42914 LDKFallback* arg_conv = (LDKFallback*)arg;
42915 uint32_t ret_conv = Fallback_clone_ptr(arg_conv);
42919 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
42920 LDKFallback* orig_conv = (LDKFallback*)orig;
42921 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42922 *ret_copy = Fallback_clone(orig_conv);
42923 uint32_t ret_ref = (uintptr_t)ret_copy;
42927 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
42929 LDKCVec_u8Z program_ref;
42930 program_ref.datalen = program->arr_len;
42931 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
42932 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
42933 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42934 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
42935 uint32_t ret_ref = (uintptr_t)ret_copy;
42939 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
42940 LDKTwentyBytes a_ref;
42941 CHECK(a->arr_len == 20);
42942 memcpy(a_ref.data, a->elems, 20); FREE(a);
42943 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42944 *ret_copy = Fallback_pub_key_hash(a_ref);
42945 uint32_t ret_ref = (uintptr_t)ret_copy;
42949 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
42950 LDKTwentyBytes a_ref;
42951 CHECK(a->arr_len == 20);
42952 memcpy(a_ref.data, a->elems, 20); FREE(a);
42953 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42954 *ret_copy = Fallback_script_hash(a_ref);
42955 uint32_t ret_ref = (uintptr_t)ret_copy;
42959 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
42960 LDKFallback* o_conv = (LDKFallback*)o;
42961 int64_t ret_conv = Fallback_hash(o_conv);
42965 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
42966 LDKFallback* a_conv = (LDKFallback*)a;
42967 LDKFallback* b_conv = (LDKFallback*)b;
42968 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
42972 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
42973 LDKInvoiceSignature this_obj_conv;
42974 this_obj_conv.inner = (void*)(this_obj & (~1));
42975 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42977 InvoiceSignature_free(this_obj_conv);
42980 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
42981 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
42982 uint32_t ret_ref = 0;
42983 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42984 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42986 ret_ref = (uintptr_t)ret_var.inner;
42987 if (ret_var.is_owned) {
42992 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
42993 LDKInvoiceSignature arg_conv;
42994 arg_conv.inner = (void*)(arg & (~1));
42995 arg_conv.is_owned = false;
42996 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42997 uint32_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
43001 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
43002 LDKInvoiceSignature orig_conv;
43003 orig_conv.inner = (void*)(orig & (~1));
43004 orig_conv.is_owned = false;
43005 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43006 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
43007 uint32_t ret_ref = 0;
43008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43011 ret_ref = (uintptr_t)ret_var.inner;
43012 if (ret_var.is_owned) {
43018 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
43019 LDKInvoiceSignature a_conv;
43020 a_conv.inner = (void*)(a & (~1));
43021 a_conv.is_owned = false;
43022 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43023 LDKInvoiceSignature b_conv;
43024 b_conv.inner = (void*)(b & (~1));
43025 b_conv.is_owned = false;
43026 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43027 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
43031 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
43032 LDKPrivateRoute this_obj_conv;
43033 this_obj_conv.inner = (void*)(this_obj & (~1));
43034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43036 PrivateRoute_free(this_obj_conv);
43039 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
43040 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
43041 uint32_t ret_ref = 0;
43042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43045 ret_ref = (uintptr_t)ret_var.inner;
43046 if (ret_var.is_owned) {
43051 uint32_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
43052 LDKPrivateRoute arg_conv;
43053 arg_conv.inner = (void*)(arg & (~1));
43054 arg_conv.is_owned = false;
43055 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43056 uint32_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
43060 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
43061 LDKPrivateRoute orig_conv;
43062 orig_conv.inner = (void*)(orig & (~1));
43063 orig_conv.is_owned = false;
43064 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43065 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
43066 uint32_t ret_ref = 0;
43067 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43068 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43069 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43070 ret_ref = (uintptr_t)ret_var.inner;
43071 if (ret_var.is_owned) {
43077 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
43078 LDKPrivateRoute o_conv;
43079 o_conv.inner = (void*)(o & (~1));
43080 o_conv.is_owned = false;
43081 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43082 int64_t ret_conv = PrivateRoute_hash(&o_conv);
43086 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
43087 LDKPrivateRoute a_conv;
43088 a_conv.inner = (void*)(a & (~1));
43089 a_conv.is_owned = false;
43090 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43091 LDKPrivateRoute b_conv;
43092 b_conv.inner = (void*)(b & (~1));
43093 b_conv.is_owned = false;
43094 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43095 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
43099 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
43100 LDKSignedRawInvoice this_arg_conv;
43101 this_arg_conv.inner = (void*)(this_arg & (~1));
43102 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43104 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
43105 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
43106 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
43107 return ((uint32_t)ret_conv);
43110 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
43111 LDKSignedRawInvoice this_arg_conv;
43112 this_arg_conv.inner = (void*)(this_arg & (~1));
43113 this_arg_conv.is_owned = false;
43114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43115 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
43116 uint32_t ret_ref = 0;
43117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43120 ret_ref = (uintptr_t)ret_var.inner;
43121 if (ret_var.is_owned) {
43127 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
43128 LDKSignedRawInvoice this_arg_conv;
43129 this_arg_conv.inner = (void*)(this_arg & (~1));
43130 this_arg_conv.is_owned = false;
43131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43132 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43133 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
43137 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
43138 LDKSignedRawInvoice this_arg_conv;
43139 this_arg_conv.inner = (void*)(this_arg & (~1));
43140 this_arg_conv.is_owned = false;
43141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43142 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
43143 uint32_t ret_ref = 0;
43144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43147 ret_ref = (uintptr_t)ret_var.inner;
43148 if (ret_var.is_owned) {
43154 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
43155 LDKSignedRawInvoice this_arg_conv;
43156 this_arg_conv.inner = (void*)(this_arg & (~1));
43157 this_arg_conv.is_owned = false;
43158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43159 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
43160 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
43161 return (uint32_t)ret_conv;
43164 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
43165 LDKSignedRawInvoice this_arg_conv;
43166 this_arg_conv.inner = (void*)(this_arg & (~1));
43167 this_arg_conv.is_owned = false;
43168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43169 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
43173 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
43174 LDKRawInvoice this_arg_conv;
43175 this_arg_conv.inner = (void*)(this_arg & (~1));
43176 this_arg_conv.is_owned = false;
43177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43178 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43179 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
43183 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
43184 LDKRawInvoice this_arg_conv;
43185 this_arg_conv.inner = (void*)(this_arg & (~1));
43186 this_arg_conv.is_owned = false;
43187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43188 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
43189 uint32_t ret_ref = 0;
43190 if ((uintptr_t)ret_var.inner > 4096) {
43191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43194 ret_ref = (uintptr_t)ret_var.inner;
43195 if (ret_var.is_owned) {
43202 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
43203 LDKRawInvoice this_arg_conv;
43204 this_arg_conv.inner = (void*)(this_arg & (~1));
43205 this_arg_conv.is_owned = false;
43206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43207 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
43208 uint32_t ret_ref = 0;
43209 if ((uintptr_t)ret_var.inner > 4096) {
43210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43213 ret_ref = (uintptr_t)ret_var.inner;
43214 if (ret_var.is_owned) {
43221 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
43222 LDKRawInvoice this_arg_conv;
43223 this_arg_conv.inner = (void*)(this_arg & (~1));
43224 this_arg_conv.is_owned = false;
43225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43226 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
43227 uint32_t ret_ref = 0;
43228 if ((uintptr_t)ret_var.inner > 4096) {
43229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43232 ret_ref = (uintptr_t)ret_var.inner;
43233 if (ret_var.is_owned) {
43240 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
43241 LDKRawInvoice this_arg_conv;
43242 this_arg_conv.inner = (void*)(this_arg & (~1));
43243 this_arg_conv.is_owned = false;
43244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43245 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
43246 uint32_t ret_ref = 0;
43247 if ((uintptr_t)ret_var.inner > 4096) {
43248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43251 ret_ref = (uintptr_t)ret_var.inner;
43252 if (ret_var.is_owned) {
43259 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
43260 LDKRawInvoice this_arg_conv;
43261 this_arg_conv.inner = (void*)(this_arg & (~1));
43262 this_arg_conv.is_owned = false;
43263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43264 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
43265 uint32_t ret_ref = 0;
43266 if ((uintptr_t)ret_var.inner > 4096) {
43267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43270 ret_ref = (uintptr_t)ret_var.inner;
43271 if (ret_var.is_owned) {
43278 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
43279 LDKRawInvoice this_arg_conv;
43280 this_arg_conv.inner = (void*)(this_arg & (~1));
43281 this_arg_conv.is_owned = false;
43282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43283 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
43284 uint32_t ret_ref = 0;
43285 if ((uintptr_t)ret_var.inner > 4096) {
43286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43289 ret_ref = (uintptr_t)ret_var.inner;
43290 if (ret_var.is_owned) {
43297 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
43298 LDKRawInvoice this_arg_conv;
43299 this_arg_conv.inner = (void*)(this_arg & (~1));
43300 this_arg_conv.is_owned = false;
43301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43302 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43303 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
43307 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
43308 LDKRawInvoice this_arg_conv;
43309 this_arg_conv.inner = (void*)(this_arg & (~1));
43310 this_arg_conv.is_owned = false;
43311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43312 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
43313 uint32_t ret_ref = 0;
43314 if ((uintptr_t)ret_var.inner > 4096) {
43315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43318 ret_ref = (uintptr_t)ret_var.inner;
43319 if (ret_var.is_owned) {
43326 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
43327 LDKRawInvoice this_arg_conv;
43328 this_arg_conv.inner = (void*)(this_arg & (~1));
43329 this_arg_conv.is_owned = false;
43330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43331 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
43332 uint32_tArray ret_arr = NULL;
43333 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43334 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43335 for (size_t o = 0; o < ret_var.datalen; o++) {
43336 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43337 uint32_t ret_conv_14_ref = 0;
43338 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43339 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43341 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43342 if (ret_conv_14_var.is_owned) {
43343 ret_conv_14_ref |= 1;
43345 ret_arr_ptr[o] = ret_conv_14_ref;
43348 FREE(ret_var.data);
43352 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
43353 LDKRawInvoice this_arg_conv;
43354 this_arg_conv.inner = (void*)(this_arg & (~1));
43355 this_arg_conv.is_owned = false;
43356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43357 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43358 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
43359 uint32_t ret_ref = (uintptr_t)ret_copy;
43363 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
43364 LDKRawInvoice this_arg_conv;
43365 this_arg_conv.inner = (void*)(this_arg & (~1));
43366 this_arg_conv.is_owned = false;
43367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43368 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
43372 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
43373 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43374 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
43375 return (uint32_t)ret_conv;
43378 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
43379 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43380 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
43381 return (uint32_t)ret_conv;
43384 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
43385 LDKPositiveTimestamp this_arg_conv;
43386 this_arg_conv.inner = (void*)(this_arg & (~1));
43387 this_arg_conv.is_owned = false;
43388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43389 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
43393 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
43394 LDKPositiveTimestamp this_arg_conv;
43395 this_arg_conv.inner = (void*)(this_arg & (~1));
43396 this_arg_conv.is_owned = false;
43397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43398 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
43402 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
43403 LDKInvoice this_arg_conv;
43404 this_arg_conv.inner = (void*)(this_arg & (~1));
43405 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43407 this_arg_conv = Invoice_clone(&this_arg_conv);
43408 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
43409 uint32_t ret_ref = 0;
43410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43413 ret_ref = (uintptr_t)ret_var.inner;
43414 if (ret_var.is_owned) {
43420 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
43421 LDKInvoice this_arg_conv;
43422 this_arg_conv.inner = (void*)(this_arg & (~1));
43423 this_arg_conv.is_owned = false;
43424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43425 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
43426 *ret_conv = Invoice_check_signature(&this_arg_conv);
43427 return (uint32_t)ret_conv;
43430 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
43431 LDKSignedRawInvoice signed_invoice_conv;
43432 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
43433 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
43434 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
43435 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
43436 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
43437 *ret_conv = Invoice_from_signed(signed_invoice_conv);
43438 return (uint32_t)ret_conv;
43441 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
43442 LDKInvoice this_arg_conv;
43443 this_arg_conv.inner = (void*)(this_arg & (~1));
43444 this_arg_conv.is_owned = false;
43445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43446 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
43450 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
43451 LDKInvoice this_arg_conv;
43452 this_arg_conv.inner = (void*)(this_arg & (~1));
43453 this_arg_conv.is_owned = false;
43454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43455 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43456 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
43460 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
43461 LDKInvoice this_arg_conv;
43462 this_arg_conv.inner = (void*)(this_arg & (~1));
43463 this_arg_conv.is_owned = false;
43464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43465 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43466 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
43470 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
43471 LDKInvoice this_arg_conv;
43472 this_arg_conv.inner = (void*)(this_arg & (~1));
43473 this_arg_conv.is_owned = false;
43474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43475 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43476 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
43480 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
43481 LDKInvoice this_arg_conv;
43482 this_arg_conv.inner = (void*)(this_arg & (~1));
43483 this_arg_conv.is_owned = false;
43484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43485 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
43486 uint32_t ret_ref = 0;
43487 if ((uintptr_t)ret_var.inner > 4096) {
43488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43491 ret_ref = (uintptr_t)ret_var.inner;
43492 if (ret_var.is_owned) {
43499 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
43500 LDKInvoice this_arg_conv;
43501 this_arg_conv.inner = (void*)(this_arg & (~1));
43502 this_arg_conv.is_owned = false;
43503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43504 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43505 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
43509 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
43510 LDKInvoice this_arg_conv;
43511 this_arg_conv.inner = (void*)(this_arg & (~1));
43512 this_arg_conv.is_owned = false;
43513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43514 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
43518 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
43519 LDKInvoice this_arg_conv;
43520 this_arg_conv.inner = (void*)(this_arg & (~1));
43521 this_arg_conv.is_owned = false;
43522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43523 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
43527 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
43528 LDKInvoice this_arg_conv;
43529 this_arg_conv.inner = (void*)(this_arg & (~1));
43530 this_arg_conv.is_owned = false;
43531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43532 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
43536 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
43537 LDKInvoice this_arg_conv;
43538 this_arg_conv.inner = (void*)(this_arg & (~1));
43539 this_arg_conv.is_owned = false;
43540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43541 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
43542 uint32_tArray ret_arr = NULL;
43543 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43544 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43545 for (size_t o = 0; o < ret_var.datalen; o++) {
43546 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43547 uint32_t ret_conv_14_ref = 0;
43548 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43549 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43551 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
43552 if (ret_conv_14_var.is_owned) {
43553 ret_conv_14_ref |= 1;
43555 ret_arr_ptr[o] = ret_conv_14_ref;
43558 FREE(ret_var.data);
43562 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
43563 LDKInvoice this_arg_conv;
43564 this_arg_conv.inner = (void*)(this_arg & (~1));
43565 this_arg_conv.is_owned = false;
43566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43567 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
43568 uint32_tArray ret_arr = NULL;
43569 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
43570 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
43571 for (size_t l = 0; l < ret_var.datalen; l++) {
43572 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43573 uint32_t ret_conv_11_ref = 0;
43574 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43575 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43577 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
43578 if (ret_conv_11_var.is_owned) {
43579 ret_conv_11_ref |= 1;
43581 ret_arr_ptr[l] = ret_conv_11_ref;
43584 FREE(ret_var.data);
43588 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
43589 LDKInvoice this_arg_conv;
43590 this_arg_conv.inner = (void*)(this_arg & (~1));
43591 this_arg_conv.is_owned = false;
43592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43593 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
43597 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
43598 LDKInvoice this_arg_conv;
43599 this_arg_conv.inner = (void*)(this_arg & (~1));
43600 this_arg_conv.is_owned = false;
43601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43602 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43603 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
43604 uint32_t ret_ref = (uintptr_t)ret_copy;
43608 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
43609 LDKStr description_conv = str_ref_to_owned_c(description);
43610 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
43611 *ret_conv = Description_new(description_conv);
43612 return (uint32_t)ret_conv;
43615 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
43616 LDKDescription this_arg_conv;
43617 this_arg_conv.inner = (void*)(this_arg & (~1));
43618 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43620 this_arg_conv = Description_clone(&this_arg_conv);
43621 LDKStr ret_str = Description_into_inner(this_arg_conv);
43622 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43627 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
43628 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
43629 uint32_t ret_ref = 0;
43630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43633 ret_ref = (uintptr_t)ret_var.inner;
43634 if (ret_var.is_owned) {
43640 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
43641 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
43642 uint32_t ret_ref = 0;
43643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43646 ret_ref = (uintptr_t)ret_var.inner;
43647 if (ret_var.is_owned) {
43653 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
43654 LDKExpiryTime this_arg_conv;
43655 this_arg_conv.inner = (void*)(this_arg & (~1));
43656 this_arg_conv.is_owned = false;
43657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43658 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
43662 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
43663 LDKExpiryTime this_arg_conv;
43664 this_arg_conv.inner = (void*)(this_arg & (~1));
43665 this_arg_conv.is_owned = false;
43666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43667 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
43671 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
43672 LDKRouteHint hops_conv;
43673 hops_conv.inner = (void*)(hops & (~1));
43674 hops_conv.is_owned = (hops & 1) || (hops == 0);
43675 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
43676 hops_conv = RouteHint_clone(&hops_conv);
43677 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
43678 *ret_conv = PrivateRoute_new(hops_conv);
43679 return (uint32_t)ret_conv;
43682 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
43683 LDKPrivateRoute this_arg_conv;
43684 this_arg_conv.inner = (void*)(this_arg & (~1));
43685 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43687 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
43688 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
43689 uint32_t ret_ref = 0;
43690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43693 ret_ref = (uintptr_t)ret_var.inner;
43694 if (ret_var.is_owned) {
43700 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
43701 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
43702 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
43706 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
43707 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
43711 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
43712 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
43716 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
43717 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
43721 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
43722 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
43726 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
43727 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
43731 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
43732 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
43733 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
43734 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
43738 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
43739 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
43740 LDKStr ret_str = CreationError_to_str(o_conv);
43741 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43746 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
43747 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
43748 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
43752 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
43753 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
43757 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
43758 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
43762 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
43763 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
43767 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
43768 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
43772 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
43773 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
43777 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
43778 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
43782 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
43783 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
43787 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
43788 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
43792 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
43793 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
43797 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
43798 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
43802 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
43803 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
43804 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
43805 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
43809 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
43810 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
43811 LDKStr ret_str = SemanticError_to_str(o_conv);
43812 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43817 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
43818 if ((this_ptr & 1) != 0) return;
43819 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43820 CHECK_ACCESS(this_ptr_ptr);
43821 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
43822 FREE((void*)this_ptr);
43823 SignOrCreationError_free(this_ptr_conv);
43826 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
43827 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43828 *ret_copy = SignOrCreationError_clone(arg);
43829 uint32_t ret_ref = (uintptr_t)ret_copy;
43832 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
43833 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
43834 uint32_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
43838 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
43839 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
43840 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43841 *ret_copy = SignOrCreationError_clone(orig_conv);
43842 uint32_t ret_ref = (uintptr_t)ret_copy;
43846 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
43847 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43848 *ret_copy = SignOrCreationError_sign_error();
43849 uint32_t ret_ref = (uintptr_t)ret_copy;
43853 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
43854 LDKCreationError a_conv = LDKCreationError_from_js(a);
43855 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43856 *ret_copy = SignOrCreationError_creation_error(a_conv);
43857 uint32_t ret_ref = (uintptr_t)ret_copy;
43861 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
43862 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
43863 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
43864 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
43868 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
43869 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
43870 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
43871 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43876 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
43877 LDKInvoicePayer this_obj_conv;
43878 this_obj_conv.inner = (void*)(this_obj & (~1));
43879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43881 InvoicePayer_free(this_obj_conv);
43884 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
43885 if ((this_ptr & 1) != 0) return;
43886 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43887 CHECK_ACCESS(this_ptr_ptr);
43888 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
43889 FREE((void*)this_ptr);
43890 Payer_free(this_ptr_conv);
43893 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
43894 if ((this_ptr & 1) != 0) return;
43895 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43896 CHECK_ACCESS(this_ptr_ptr);
43897 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43898 FREE((void*)this_ptr);
43899 Router_free(this_ptr_conv);
43902 void __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint32_t this_ptr) {
43903 if ((this_ptr & 1) != 0) return;
43904 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43905 CHECK_ACCESS(this_ptr_ptr);
43906 LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
43907 FREE((void*)this_ptr);
43908 Retry_free(this_ptr_conv);
43911 static inline uintptr_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
43912 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43913 *ret_copy = Retry_clone(arg);
43914 uint32_t ret_ref = (uintptr_t)ret_copy;
43917 uint32_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint32_t arg) {
43918 LDKRetry* arg_conv = (LDKRetry*)arg;
43919 uint32_t ret_conv = Retry_clone_ptr(arg_conv);
43923 uint32_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint32_t orig) {
43924 LDKRetry* orig_conv = (LDKRetry*)orig;
43925 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43926 *ret_copy = Retry_clone(orig_conv);
43927 uint32_t ret_ref = (uintptr_t)ret_copy;
43931 uint32_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
43932 LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43933 *ret_copy = Retry_attempts(a);
43934 uint32_t ret_ref = (uintptr_t)ret_copy;
43938 jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint32_t a, uint32_t b) {
43939 LDKRetry* a_conv = (LDKRetry*)a;
43940 LDKRetry* b_conv = (LDKRetry*)b;
43941 jboolean ret_conv = Retry_eq(a_conv, b_conv);
43945 int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint32_t o) {
43946 LDKRetry* o_conv = (LDKRetry*)o;
43947 int64_t ret_conv = Retry_hash(o_conv);
43951 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
43952 if ((this_ptr & 1) != 0) return;
43953 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43954 CHECK_ACCESS(this_ptr_ptr);
43955 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
43956 FREE((void*)this_ptr);
43957 PaymentError_free(this_ptr_conv);
43960 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
43961 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43962 *ret_copy = PaymentError_clone(arg);
43963 uint32_t ret_ref = (uintptr_t)ret_copy;
43966 uint32_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
43967 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
43968 uint32_t ret_conv = PaymentError_clone_ptr(arg_conv);
43972 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
43973 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
43974 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43975 *ret_copy = PaymentError_clone(orig_conv);
43976 uint32_t ret_ref = (uintptr_t)ret_copy;
43980 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
43981 LDKStr a_conv = str_ref_to_owned_c(a);
43982 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43983 *ret_copy = PaymentError_invoice(a_conv);
43984 uint32_t ret_ref = (uintptr_t)ret_copy;
43988 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
43989 LDKLightningError a_conv;
43990 a_conv.inner = (void*)(a & (~1));
43991 a_conv.is_owned = (a & 1) || (a == 0);
43992 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43993 a_conv = LightningError_clone(&a_conv);
43994 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43995 *ret_copy = PaymentError_routing(a_conv);
43996 uint32_t ret_ref = (uintptr_t)ret_copy;
44000 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
44001 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
44002 CHECK_ACCESS(a_ptr);
44003 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
44004 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
44005 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
44006 *ret_copy = PaymentError_sending(a_conv);
44007 uint32_t ret_ref = (uintptr_t)ret_copy;
44011 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) {
44012 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
44013 CHECK_ACCESS(payer_ptr);
44014 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
44015 if (payer_conv.free == LDKPayer_JCalls_free) {
44016 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44017 LDKPayer_JCalls_cloned(&payer_conv);
44019 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
44020 CHECK_ACCESS(router_ptr);
44021 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
44022 if (router_conv.free == LDKRouter_JCalls_free) {
44023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44024 LDKRouter_JCalls_cloned(&router_conv);
44026 LDKMultiThreadedLockableScore scorer_conv;
44027 scorer_conv.inner = (void*)(scorer & (~1));
44028 scorer_conv.is_owned = false;
44029 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
44030 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44031 CHECK_ACCESS(logger_ptr);
44032 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44033 if (logger_conv.free == LDKLogger_JCalls_free) {
44034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44035 LDKLogger_JCalls_cloned(&logger_conv);
44037 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
44038 CHECK_ACCESS(event_handler_ptr);
44039 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
44040 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
44041 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44042 LDKEventHandler_JCalls_cloned(&event_handler_conv);
44044 void* retry_ptr = (void*)(((uintptr_t)retry) & ~1);
44045 CHECK_ACCESS(retry_ptr);
44046 LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
44047 retry_conv = Retry_clone((LDKRetry*)(((uintptr_t)retry) & ~1));
44048 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
44049 uint32_t ret_ref = 0;
44050 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44051 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44053 ret_ref = (uintptr_t)ret_var.inner;
44054 if (ret_var.is_owned) {
44060 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
44061 LDKInvoicePayer this_arg_conv;
44062 this_arg_conv.inner = (void*)(this_arg & (~1));
44063 this_arg_conv.is_owned = false;
44064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44065 LDKInvoice invoice_conv;
44066 invoice_conv.inner = (void*)(invoice & (~1));
44067 invoice_conv.is_owned = false;
44068 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44069 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44070 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
44071 return (uint32_t)ret_conv;
44074 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) {
44075 LDKInvoicePayer this_arg_conv;
44076 this_arg_conv.inner = (void*)(this_arg & (~1));
44077 this_arg_conv.is_owned = false;
44078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44079 LDKInvoice invoice_conv;
44080 invoice_conv.inner = (void*)(invoice & (~1));
44081 invoice_conv.is_owned = false;
44082 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
44083 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44084 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
44085 return (uint32_t)ret_conv;
44088 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) {
44089 LDKInvoicePayer this_arg_conv;
44090 this_arg_conv.inner = (void*)(this_arg & (~1));
44091 this_arg_conv.is_owned = false;
44092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44093 LDKPublicKey pubkey_ref;
44094 CHECK(pubkey->arr_len == 33);
44095 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
44096 LDKThirtyTwoBytes payment_preimage_ref;
44097 CHECK(payment_preimage->arr_len == 32);
44098 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
44099 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
44100 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
44101 return (uint32_t)ret_conv;
44104 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
44105 LDKInvoicePayer this_arg_conv;
44106 this_arg_conv.inner = (void*)(this_arg & (~1));
44107 this_arg_conv.is_owned = false;
44108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44109 unsigned char payment_hash_arr[32];
44110 CHECK(payment_hash->arr_len == 32);
44111 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
44112 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
44113 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
44116 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
44117 LDKInvoicePayer this_arg_conv;
44118 this_arg_conv.inner = (void*)(this_arg & (~1));
44119 this_arg_conv.is_owned = false;
44120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44121 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
44122 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
44123 return (uint32_t)ret_ret;
44126 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) {
44127 LDKChannelManager channelmanager_conv;
44128 channelmanager_conv.inner = (void*)(channelmanager & (~1));
44129 channelmanager_conv.is_owned = false;
44130 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
44131 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
44132 CHECK_ACCESS(keys_manager_ptr);
44133 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44134 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44135 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44136 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44138 LDKCurrency network_conv = LDKCurrency_from_js(network);
44139 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
44140 CHECK_ACCESS(amt_msat_ptr);
44141 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
44142 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
44143 LDKSha256 description_hash_conv;
44144 description_hash_conv.inner = (void*)(description_hash & (~1));
44145 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
44146 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
44147 description_hash_conv = Sha256_clone(&description_hash_conv);
44148 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
44149 *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);
44150 return (uint32_t)ret_conv;
44153 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) {
44154 LDKChannelManager channelmanager_conv;
44155 channelmanager_conv.inner = (void*)(channelmanager & (~1));
44156 channelmanager_conv.is_owned = false;
44157 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
44158 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
44159 CHECK_ACCESS(keys_manager_ptr);
44160 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44161 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44162 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44163 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44165 LDKCurrency network_conv = LDKCurrency_from_js(network);
44166 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
44167 CHECK_ACCESS(amt_msat_ptr);
44168 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
44169 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
44170 LDKStr description_conv = str_ref_to_owned_c(description);
44171 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
44172 *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);
44173 return (uint32_t)ret_conv;
44176 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
44177 LDKDefaultRouter this_obj_conv;
44178 this_obj_conv.inner = (void*)(this_obj & (~1));
44179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44181 DefaultRouter_free(this_obj_conv);
44184 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger, int8_tArray random_seed_bytes) {
44185 LDKNetworkGraph network_graph_conv;
44186 network_graph_conv.inner = (void*)(network_graph & (~1));
44187 network_graph_conv.is_owned = false;
44188 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44189 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
44190 CHECK_ACCESS(logger_ptr);
44191 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44192 if (logger_conv.free == LDKLogger_JCalls_free) {
44193 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44194 LDKLogger_JCalls_cloned(&logger_conv);
44196 LDKThirtyTwoBytes random_seed_bytes_ref;
44197 CHECK(random_seed_bytes->arr_len == 32);
44198 memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
44199 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
44200 uint32_t ret_ref = 0;
44201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44204 ret_ref = (uintptr_t)ret_var.inner;
44205 if (ret_var.is_owned) {
44211 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
44212 LDKDefaultRouter this_arg_conv;
44213 this_arg_conv.inner = (void*)(this_arg & (~1));
44214 this_arg_conv.is_owned = false;
44215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44216 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44217 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44218 return (uint32_t)ret_ret;
44221 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
44222 LDKChannelManager this_arg_conv;
44223 this_arg_conv.inner = (void*)(this_arg & (~1));
44224 this_arg_conv.is_owned = false;
44225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44226 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
44227 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
44228 return (uint32_t)ret_ret;
44231 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
44232 LDKStr s_conv = str_ref_to_owned_c(s);
44233 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
44234 *ret_conv = SiPrefix_from_str(s_conv);
44235 return (uint32_t)ret_conv;
44238 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
44239 LDKStr s_conv = str_ref_to_owned_c(s);
44240 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
44241 *ret_conv = Invoice_from_str(s_conv);
44242 return (uint32_t)ret_conv;
44245 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
44246 LDKStr s_conv = str_ref_to_owned_c(s);
44247 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
44248 *ret_conv = SignedRawInvoice_from_str(s_conv);
44249 return (uint32_t)ret_conv;
44252 jstring __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint32_t o) {
44253 LDKParseError* o_conv = (LDKParseError*)o;
44254 LDKStr ret_str = ParseError_to_str(o_conv);
44255 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44260 jstring __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint32_t o) {
44261 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
44262 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
44263 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44268 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
44270 o_conv.inner = (void*)(o & (~1));
44271 o_conv.is_owned = false;
44272 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44273 LDKStr ret_str = Invoice_to_str(&o_conv);
44274 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44279 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
44280 LDKSignedRawInvoice o_conv;
44281 o_conv.inner = (void*)(o & (~1));
44282 o_conv.is_owned = false;
44283 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44284 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
44285 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44290 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
44291 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
44292 LDKStr ret_str = Currency_to_str(o_conv);
44293 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44298 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
44299 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
44300 LDKStr ret_str = SiPrefix_to_str(o_conv);
44301 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);